Exemplo n.º 1
0
        //Model转换
        public CRM_Company_Audit GetModel(CRM_Company item)
        {
            CRM_Company_Audit model = new CRM_Company_Audit();
            object            value;

            if (item != null)
            {
                string[]       arrField   = new string[] { "CompanyCode", "CompanyName", "Dict_HY_Code", "OrganizationCode", "RegisterAddress", "OfficeAddress" };
                Type           t1         = typeof(CRM_Company);
                PropertyInfo[] propertys1 = t1.GetProperties();
                Type           t2         = typeof(CRM_Company_Audit);
                PropertyInfo[] propertys2 = t2.GetProperties();

                foreach (PropertyInfo pi in propertys2)
                {
                    string name = pi.Name;
                    if (arrField.Contains(name))
                    {
                        value = t1.GetProperty(name).GetValue(item, null);
                        t2.GetProperty(name).SetValue(model, value, null);
                    }
                }
                model.CRM_Company_ID = item.ID;
                model.CreateTime     = DateTime.Now;
                model.CreateUserID   = LoginInfo.UserID;
                model.CreateUserName = LoginInfo.RealName;
                model.BranchID       = LoginInfo.BranchID;
                model.Source         = 2;
                model.OperateStatus  = 1;
                model.OperateNode    = 2;//质控
            }
            return(model);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 修改企业基本信息
 /// </summary>
 /// <param name="entity">企业基本信息</param>
 /// <returns></returns>
 public bool ModifyBaseInfo(ref ValidationErrors validationErrors, CRM_Company_Audit entity)
 {
     try
     {
         repository.ModifyBaseInfo(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
         return(false);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 编辑一个客户_企业信息_待审核
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="entity">一个客户_企业信息_待审核</param>
 /// <returns></returns>
 public bool Edit(ref ValidationErrors validationErrors, CRM_Company_Audit entity)
 {
     try
     {
         repository.Edit(db, entity);
         repository.Save(db);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
Exemplo n.º 4
0
        // PUT api/<controller>/5
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public Common.ClientResult.Result Put([FromBody] CRM_Company_Audit entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                //string currentPerson = GetCurrentPerson();
                //entity.UpdateTime = DateTime.Now;
                //entity.UpdatePerson = currentPerson;

                string returnValue = string.Empty;
                if (m_BLL.Edit(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",客户_企业信息_待审核信息的Id为" + entity.ID, "客户_企业信息_待审核"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    return(result); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",客户_企业信息_待审核信息的Id为" + entity.ID + "," + returnValue, "客户_企业信息_待审核"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }
Exemplo n.º 5
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public Common.ClientResult.Result Post([FromBody] CRM_Company entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {
                CRM_Company_Audit model = GetModel(entity);

                string returnValue = string.Empty;
                if (m_BLL.ModifyBaseInfo(ref validationErrors, model))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",客户_企业信息_待审核的信息的Id为" + entity.ID, "客户_企业信息_待审核"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.InsertSucceed;
                    return(result); //提示创建成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",客户_企业信息_待审核的信息," + returnValue, "客户_企业信息_待审核"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(result); //提示插入失败
                }
            }

            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
Exemplo n.º 6
0
 // 销售经理审核
 public Common.ClientResult.Result NotPass(string id)
 {
     Common.ClientResult.Result result = new Common.ClientResult.Result();
     if (!string.IsNullOrEmpty(id))
     {
         CRM_Company_Audit entity = m_BLL.GetById(int.Parse(id));
         entity.OperateStatus = 0;//审核不通过
         string returnValue = string.Empty;
         if (m_BLL.Edit(ref validationErrors, entity))
         {
             LogClassModels.WriteServiceLog("操作成功" + ",客户_企业信息_待审核信息的Id为" + entity.ID, "客户_企业信息_待审核"
                                            );//写入日志
             result.Code    = Common.ClientCode.Succeed;
             result.Message = Suggestion.UpdateSucceed;
             return(result); //提示更新成功
         }
         else
         {
             if (validationErrors != null && validationErrors.Count > 0)
             {
                 validationErrors.All(a =>
                 {
                     returnValue += a.ErrorMessage;
                     return(true);
                 });
             }
             LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",客户_企业信息_待审核信息的Id为" + entity.ID + "," + returnValue, "客户_企业信息_待审核"
                                            );//写入日志
             result.Code    = Common.ClientCode.Fail;
             result.Message = Suggestion.UpdateFail + returnValue;
             return(result); //提示更新失败
         }
     }
     result.Code    = Common.ClientCode.FindNull;
     result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
     return(result); //提示输入的数据的格式不对
 }