public static bool UpdateProviderLinkMan(ProviderLinkManModel model)
 {
     UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
     if (model.ID <= 0)
     {
         return false;
     }
     try
     {
         bool succ = false;
         LogInfoModel logModel = InitLogInfo("联络人ID:"+Convert.ToString(model.ID));
         logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
         //设置模块ID 模块ID请在ConstUtil中定义,以便维护
         logModel.ModuleID = ConstUtil.MODULE_ID_PROVIDERLINKMAN_ADD;
         succ = ProviderLinkManDBHelper.UpdateProviderLinkMan(model);
         if (!succ)
             logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
         else
             logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
         LogDBHelper.InsertLog(logModel);
         return succ;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
 public static bool InsertProviderLinkMan(ProviderLinkManModel model, out string ID)
 {
     try
     {
         bool succ = false;
         succ = ProviderLinkManDBHelper.InsertProviderLinkMan(model, out ID);
         string LinkManID = ID;
         LogInfoModel logModel = InitLogInfo("联络人ID:" + LinkManID);
         logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
         //设置模块ID 模块ID请在ConstUtil中定义,以便维护
         logModel.ModuleID = ConstUtil.MODULE_ID_PROVIDERLINKMAN_ADD;
         if (!succ)
             logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
         else
             logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
         LogDBHelper.InsertLog(logModel);
         return succ;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
        public static bool InsertProviderLinkMan(ProviderLinkManModel model, out string ID)
        {
            ArrayList listADD = new ArrayList();
            bool result = false;
            ID = "0";
            #region  采购供应商联系人添加SQL语句
            StringBuilder sqlArrive = new StringBuilder();
            sqlArrive.AppendLine("INSERT INTO officedba.ProviderLinkMan");
            sqlArrive.AppendLine("(CustNo,CompanyCD,LinkManName,Sex,Important,Company,Appellation,Department,Position,Operation,");
            sqlArrive.AppendLine("WorkTel,Fax,Handset,MailAddress,HomeTel,MSN,QQ,Post,HomeAddress,Remark,");
            sqlArrive.AppendLine("Age,Likes,LinkType,Birthday,PaperType,PaperNum,Photo,ModifiedDate,ModifiedUserID)");

            sqlArrive.AppendLine("VALUES (@CustNo,@CompanyCD,@LinkManName,@Sex,@Important,@Company,@Appellation,@Department,@Position,@Operation,");
            sqlArrive.AppendLine("@WorkTel,@Fax,@Handset,@MailAddress,@HomeTel,@MSN,@QQ,@Post,@HomeAddress,@Remark,");
            sqlArrive.AppendLine("@Age,@Likes,@LinkType,@Birthday,@PaperType,@PaperNum,@Photo,getdate(),@ModifiedUserID)");
            sqlArrive.AppendLine("set @ID=@@IDENTITY");

            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@CustNo", model.CustNo));
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManName", model.LinkManName));
            comm.Parameters.Add(SqlHelper.GetParameter("@Sex", model.Sex));
            comm.Parameters.Add(SqlHelper.GetParameter("@Important", model.Important));
            comm.Parameters.Add(SqlHelper.GetParameter("@Company", model.Company));
            comm.Parameters.Add(SqlHelper.GetParameter("@Appellation", model.Appellation));
            comm.Parameters.Add(SqlHelper.GetParameter("@Department", model.Department));
            comm.Parameters.Add(SqlHelper.GetParameter("@Position", model.Position));
            comm.Parameters.Add(SqlHelper.GetParameter("@Operation", model.Operation));
            comm.Parameters.Add(SqlHelper.GetParameter("@WorkTel", model.WorkTel));
            comm.Parameters.Add(SqlHelper.GetParameter("@Fax", model.Fax));
            comm.Parameters.Add(SqlHelper.GetParameter("@Handset", model.Handset));
            comm.Parameters.Add(SqlHelper.GetParameter("@MailAddress", model.MailAddress));
            comm.Parameters.Add(SqlHelper.GetParameter("@HomeTel", model.HomeTel));
            comm.Parameters.Add(SqlHelper.GetParameter("@MSN", model.MSN));
            comm.Parameters.Add(SqlHelper.GetParameter("@QQ", model.QQ));
            comm.Parameters.Add(SqlHelper.GetParameter("@Post", model.Post));
            comm.Parameters.Add(SqlHelper.GetParameter("@HomeAddress", model.HomeAddress));
            comm.Parameters.Add(SqlHelper.GetParameter("@Remark", model.Remark));
            comm.Parameters.Add(SqlHelper.GetParameter("@Age", model.Age));
            comm.Parameters.Add(SqlHelper.GetParameter("@Likes", model.Likes));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkType", model.LinkType));
            comm.Parameters.Add(SqlHelper.GetParameter("@Birthday", model.Birthday == null  ? SqlDateTime.Null :SqlDateTime.Parse(model.Birthday.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@PaperType", model.PaperType));
            comm.Parameters.Add(SqlHelper.GetParameter("@PaperNum", model.PaperNum));
            comm.Parameters.Add(SqlHelper.GetParameter("@Photo", model.Photo));
            comm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID));
            comm.Parameters.Add(SqlHelper.GetOutputParameter("@ID", SqlDbType.Int));
            comm.CommandText = sqlArrive.ToString();
            listADD.Add(comm);
            #endregion


            try
            {
                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    ID = comm.Parameters["@ID"].Value.ToString();
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool UpdateProviderLinkMan(ProviderLinkManModel model)
        {
            if (model.ID <= 0)
            {
                return false;
            }
            ArrayList listADD = new ArrayList();
            bool result = false;

            #region  修改供应商联系人
            StringBuilder sqlArrive = new StringBuilder();

            sqlArrive.AppendLine("Update  Officedba.ProviderLinkMan set CustNo=@CustNo,");
            sqlArrive.AppendLine("CompanyCD=@CompanyCD,LinkManName=@LinkManName,Sex=@Sex,Important=@Important,Company=@Company,");
            sqlArrive.AppendLine("Appellation=@Appellation,Department=@Department,Position=@Position,Operation=@Operation,WorkTel=@WorkTel,");
            sqlArrive.AppendLine("Fax=@Fax,Handset=@Handset,MailAddress=@MailAddress,HomeTel=@HomeTel,MSN=@MSN,");
            sqlArrive.AppendLine("QQ=@QQ,Post=@Post,HomeAddress=@HomeAddress,Remark=@Remark,Age=@Age,");
            sqlArrive.AppendLine("Likes=@Likes,LinkType=@LinkType,Birthday=@Birthday,PaperType=@PaperType,PaperNum=@PaperNum,");
            sqlArrive.AppendLine("Photo=@Photo,ModifiedDate=getdate(),ModifiedUserID=@ModifiedUserID where CompanyCD=@CompanyCD and ID=@ID");


            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@CustNo", model.CustNo));
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManName", model.LinkManName));
            comm.Parameters.Add(SqlHelper.GetParameter("@Sex", model.Sex));
            comm.Parameters.Add(SqlHelper.GetParameter("@Important", model.Important));
            comm.Parameters.Add(SqlHelper.GetParameter("@Company", model.Company));
            comm.Parameters.Add(SqlHelper.GetParameter("@Appellation", model.Appellation));
            comm.Parameters.Add(SqlHelper.GetParameter("@Department", model.Department));
            comm.Parameters.Add(SqlHelper.GetParameter("@Position", model.Position));
            comm.Parameters.Add(SqlHelper.GetParameter("@Operation", model.Operation));
            comm.Parameters.Add(SqlHelper.GetParameter("@WorkTel", model.WorkTel));
            comm.Parameters.Add(SqlHelper.GetParameter("@Fax", model.Fax));
            comm.Parameters.Add(SqlHelper.GetParameter("@Handset", model.Handset));
            comm.Parameters.Add(SqlHelper.GetParameter("@MailAddress", model.MailAddress));
            comm.Parameters.Add(SqlHelper.GetParameter("@HomeTel", model.HomeTel));
            comm.Parameters.Add(SqlHelper.GetParameter("@MSN", model.MSN));
            comm.Parameters.Add(SqlHelper.GetParameter("@QQ", model.QQ));
            comm.Parameters.Add(SqlHelper.GetParameter("@Post", model.Post));
            comm.Parameters.Add(SqlHelper.GetParameter("@HomeAddress", model.HomeAddress));
            comm.Parameters.Add(SqlHelper.GetParameter("@Remark", model.Remark));
            comm.Parameters.Add(SqlHelper.GetParameter("@Age", model.Age));
            comm.Parameters.Add(SqlHelper.GetParameter("@Likes", model.Likes));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkType", model.LinkType));
            comm.Parameters.Add(SqlHelper.GetParameter("@Birthday", model.Birthday == null    ? SqlDateTime.Null  : SqlDateTime.Parse(model.Birthday.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@PaperType", model.PaperType));
            comm.Parameters.Add(SqlHelper.GetParameter("@PaperNum", model.PaperNum));
            comm.Parameters.Add(SqlHelper.GetParameter("@Photo", model.Photo));
            comm.Parameters.Add(SqlHelper.GetParameter("@ModifiedUserID", model.ModifiedUserID));
            comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
            comm.CommandText = sqlArrive.ToString();


            listADD.Add(comm);
            #endregion

            try
            {
                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }