123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using Common.Model;
- using CoreEntity.Entity;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Text;
- using ZcPeng.PublicLibrary;
- namespace CoreEntity.DAL
- {
- public class ContactDAL
- {
-
- /// <summary>
- /// //
- /// </summary>
- /// <returns></returns>
- public static Dictionary<string, Object> UpdatePushContactState(string GoodsId,string ContactId ,string SuppliersId,string State = "Y",List<DataAccessCommand> listcmd = null)
- {
- Dictionary<string, Object> resultdic = new Dictionary<string, Object>(2);
- #region
- string commandText = "Update k_contactsp set PushFlag = '"+ State + "' " +
- " Where 1=1 " +
- " and GoodsId=@GoodsId " +
- " and ContactId=@ContactId "
- //+" and SuppliersId=@SuppliersId "
- ;
- string result;
- List<List<Object>> parameters = new List<List<Object>>();
- parameters.Add(new List<Object>() { "GoodsId", GoodsId });
- parameters.Add(new List<Object>() { "ContactId", ContactId });
- //parameters.Add(new List<Object>() { "SuppliersId", SuppliersId });
- List<DataAccessCommand> list = new List<DataAccessCommand>();
- #endregion
- if(listcmd == null) {
- list.Add(new DataAccessCommand(commandText, DataAccess.ToParameters(parameters), CommandType.Text, false));
- bool success = DataAccess.ExecuteBatchCommands(list, out result);
- resultdic.Add("success", success);
- resultdic.Add("result", result);
- }
- else
- {
- listcmd.Add(new DataAccessCommand(commandText, DataAccess.ToParameters(parameters), CommandType.Text, false));
- }
- return resultdic;
- }
- /// <summary>
- ///
- /// ContactId
- /// </summary>
- /// <param name="PushAccountId"></param>
- /// <param name="BusinessId"></param>
- /// <returns></returns>
- public static List<ContactDocExt> getContactorByAccountId(string PushAccountId)
- {
- string commandTextContact = "Select ContactId From CONTACTDOC " +
- "Where UserId=@Id and focusMicNo !='' and focusMicNo is not null";
- DataTable dt = new DataTable();
- String ContactId = string.Empty;
- string result;
- List<ContactDocExt> list = new List<ContactDocExt>(0);
- List<List<Object>> parametersContact = new List<List<Object>>();
- if (PushAccountId != null)
- {
- parametersContact.Add(new List<Object>() { "Id", PushAccountId });
- bool success = DataAccess.GetValues(commandTextContact, ref dt, DataAccess.ToParameters(parametersContact).ToArray(), out result);
- }
- else
- {
- return null;
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- list = (List<ContactDocExt>)ModelConvertHelper<ContactDocExt>.ConvertToModel(dt);
- }
- return list;
- }
- /// <summary>
- ///
- /// ContactId
- /// </summary>
- /// <param name="ContactId"></param>
- /// <returns></returns>
- public static ContactDoc getContactor(string ContactId)
- {
- string commandTextContact = "Select * From CONTACTDOC " +
- "Where ContactId=@ContactId ";
- string resultContact;
- DataTable dt = new DataTable();
- List<List<Object>> parametersContact = new List<List<Object>>();
- if (ContactId != null && ContactId != null)
- {
- parametersContact.Add(new List<Object>() { "ContactId", ContactId });
- bool valueContact = DataAccess.GetValues(commandTextContact, ref dt, DataAccess.ToParameters(parametersContact).ToArray(), out resultContact);
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- List<ContactDoc> d = (List<ContactDoc>)ModelConvertHelper<ContactDoc>.ConvertToModel(dt);
- return d.ToArray()[0];
- }
- return null;
- }
- /// <summary>
- /// 条件 isyw='Y' and IsSaleDelegate='N'
- /// 供应商业务员默认第一个 ContactId
- /// </summary>
- /// <param name="ContactId"></param>
- /// <returns></returns>
- public static ContactDoc getOppContactor(string BusinessId)
- {
- string commandTextContact = "Select * From CONTACTDOC " +
- "Where BusinessId=@BusinessId " +
- "and isyw='Y' and IsSaleDelegate='N'";
- string resultContact;
- DataTable dt = new DataTable();
- List<List<Object>> parametersContact = new List<List<Object>>();
- if (BusinessId != null && BusinessId != null)
- {
- parametersContact.Add(new List<Object>() { "BusinessId", BusinessId });
- bool valueContact = DataAccess.GetValues(commandTextContact, ref dt, DataAccess.ToParameters(parametersContact).ToArray(), out resultContact);
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- List<ContactDoc> d = (List<ContactDoc>)ModelConvertHelper<ContactDoc>.ConvertToModel(dt);
- return d.ToArray()[0];
- }
- return null;
- }
- }
- }
|