public static bool UpdateProviderContactHistory(ProviderContactHistoryModel model)
 {
     UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
     if (model.ID <= 0)
     {
         return false;
     }
     try
     {
         bool succ = false;
         LogInfoModel logModel = InitLogInfo(model.ContactNo);
         logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
         //设置模块ID 模块ID请在ConstUtil中定义,以便维护
         logModel.ModuleID = ConstUtil.MODULE_ID_PROVIDERCONTRACTHISTORY_ADD;
         succ = ProviderContactHistoryDBHelper.UpdateProviderContactHistory(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 InsertProviderContactHistory(ProviderContactHistoryModel model, out string ID)
        {

            ArrayList listADD = new ArrayList();
            bool result = false;
            ID = "0";

            #region  采购供应商联络添加SQL语句
            StringBuilder sqlArrive = new StringBuilder();


            sqlArrive.AppendLine("INSERT INTO officedba.ProviderContactHistory");
            sqlArrive.AppendLine("(CompanyCD,CustID,ContactNo,Title,LinkManID,LinkManName,LinkReasonID,LinkMode,LinkDate,Linker,Contents)");

            sqlArrive.AppendLine("VALUES (@CompanyCD,@CustID,@ContactNo,@Title,@LinkManID,@LinkManName,@LinkReasonID,@LinkMode,@LinkDate,@Linker,@Contents)");
            sqlArrive.AppendLine("set @ID=@@IDENTITY");

            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustID", model.CustID));
            comm.Parameters.Add(SqlHelper.GetParameter("@ContactNo", model.ContactNo));
            comm.Parameters.Add(SqlHelper.GetParameter("@Title", model.Title));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManID", model.LinkManID));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManName", model.LinkManName));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkReasonID", model.LinkReasonID));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkMode", model.LinkMode));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkDate", model.LinkDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.LinkDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@Linker", model.Linker));
            comm.Parameters.Add(SqlHelper.GetParameter("@Contents", model.Contents));
            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 InsertProviderContactHistory(ProviderContactHistoryModel model, out string ID)
 {
     try
     {
         bool succ = false;
         LogInfoModel logModel = InitLogInfo(model.ContactNo);
         logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
         //设置模块ID 模块ID请在ConstUtil中定义,以便维护
         logModel.ModuleID = ConstUtil.MODULE_ID_PROVIDERCONTRACTHISTORY_ADD;
         succ = ProviderContactHistoryDBHelper.InsertProviderContactHistory(model, out ID);
         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 UpdateProviderContactHistory(ProviderContactHistoryModel model)
        {
            if (model.ID <= 0)
            {
                return false;
            }
            ArrayList listADD = new ArrayList();
            bool result = false;

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

            sqlArrive.AppendLine("Update  Officedba.ProviderContactHistory set CompanyCD=@CompanyCD,");
            sqlArrive.AppendLine("CustID=@CustID,ContactNo=@ContactNo,Title=@Title,LinkManID=@LinkManID,LinkManName=@LinkManName,LinkReasonID=@LinkReasonID,");
            sqlArrive.AppendLine("LinkMode=@LinkMode,LinkDate=@LinkDate,Linker=@Linker,Contents=@Contents where CompanyCD=@CompanyCD and ID=@ID");


            SqlCommand comm = new SqlCommand();
            comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameter("@CustID", model.CustID));
            comm.Parameters.Add(SqlHelper.GetParameter("@ContactNo", model.ContactNo));
            comm.Parameters.Add(SqlHelper.GetParameter("@Title", model.Title));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManID", model.LinkManID));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkManName", model.LinkManName));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkReasonID", model.LinkReasonID));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkMode", model.LinkMode));
            comm.Parameters.Add(SqlHelper.GetParameter("@LinkDate", model.LinkDate == null
                                                        ? SqlDateTime.Null
                                                        : SqlDateTime.Parse(model.LinkDate.ToString())));
            comm.Parameters.Add(SqlHelper.GetParameter("@Linker", model.Linker));
            comm.Parameters.Add(SqlHelper.GetParameter("@Contents", model.Contents));
            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;
            }
        }