Пример #1
0
        public IActionResult Create1(CallLogViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = new ContactCallLog();
                entity.CallLogUuid       = Guid.NewGuid();
                entity.ContactPersonUuid = Guid.Parse(model.ContactPersonUuid);
                if (model.ClientName != "")
                {
                    var dd = _dbContext.Customer.FirstOrDefault(x => x.ClientName == model.ClientName);
                    if (dd != null)
                    {
                        entity.ClientUuid = dd.ClientUuid;
                    }
                }
                if (model.BusinessUuid != null)
                {
                    entity.BusinessUuid = Guid.Parse(model.BusinessUuid);
                }
                entity.CallContent        = model.CallContent;
                entity.ContactDetailsName = model.ContactDetailsName;
                if (model.CallTime == "")
                {
                    response.SetFailed("请选择联系时间");
                    return(Ok(response));
                }
                else
                {
                    var d2 = DateTime.Parse(model.CallTime).ToString("yyyy-MM-dd HH:mm");
                    entity.CallTime = d2;
                }
                if (model.usName != "")
                {
                    var quee    = _dbContext.Customer.FirstOrDefault(x => x.ClientName == model.ClientName);
                    var entity3 = new SystemLog();
                    entity3.SystemLogUuid = Guid.NewGuid();
                    if (quee != null)
                    {
                        entity3.OperationContent = "用户" + model.usName + "给客户" + quee.ClientName + "添加了一条联系记录";
                    }
                    entity3.UserName      = model.usName;
                    entity3.OperationTime = DateTime.Now.ToString("yyyy-MM-dd");
                    entity3.Type          = "添加";
                    entity3.IsDelete      = 0;
                    _dbContext.SystemLog.Add(entity3);
                }
                entity.IsDelete = 0;
                _dbContext.ContactCallLog.Add(entity);
                _dbContext.SaveChanges();
                response.SetSuccess();
                return(Ok(response));
            }
        }
Пример #2
0
 public IActionResult AppConSkipAddCallLog(CallLogViewModels model)
 {
     {
         var response = ResponseModelFactory.CreateInstance;
         using (_dbContext)
         {
             var entity = new ContactCallLog();
             entity.CallLogUuid       = Guid.NewGuid();
             entity.ContactPersonUuid = Guid.Parse(model.ContactPersonUuid);
             entity.ClientUuid        = Guid.Parse(model.ClientUuid);
             if (model.BusinessUuid != "")
             {
                 entity.BusinessUuid = Guid.Parse(model.BusinessUuid);
             }
             entity.CallContent = model.CallContent;
             if (model.ContactDetailsUuid != "")
             {
                 if (model.ContactDetailsUuid == "0")
                 {
                     entity.ContactDetailsName = "微信";
                 }
                 if (model.ContactDetailsUuid == "1")
                 {
                     entity.ContactDetailsName = "QQ";
                 }
                 if (model.ContactDetailsUuid == "2")
                 {
                     entity.ContactDetailsName = "电话";
                 }
                 if (model.ContactDetailsUuid == "3")
                 {
                     entity.ContactDetailsName = "面谈";
                 }
                 if (model.ContactDetailsUuid == "4")
                 {
                     entity.ContactDetailsName = "邮件";
                 }
             }
             if (model.CallTime == "")
             {
                 response.SetFailed("请选择联系时间");
                 return(Ok(response));
             }
             else
             {
                 var d2 = DateTime.Parse(model.CallTime).ToString("yyyy-MM-dd HH:mm");
                 entity.CallTime = d2;
             }
             if (model.usName != "")
             {
                 var quert   = _dbContext.Customer.FirstOrDefault(x => x.ClientUuid == entity.ClientUuid);
                 var entity3 = new SystemLog();
                 entity3.SystemLogUuid = Guid.NewGuid();
                 if (quert != null)
                 {
                     entity3.OperationContent = "钉钉端客户管理系统-用户(" + model.usName + ")添加了一条与客户(" +
                                                quert.ClientName + ")的联系记录";
                 }
                 entity3.UserName      = model.usName;
                 entity3.OperationTime = DateTime.Now.ToString("yyyy-MM-dd");
                 entity3.Type          = "钉钉端添加";
                 entity3.IsDelete      = 0;
                 _dbContext.SystemLog.Add(entity3);
             }
             entity.IsDelete = 0;
             _dbContext.ContactCallLog.Add(entity);
             _dbContext.SaveChanges();
             response.SetSuccess();
             return(Ok(response));
         }
     }
 }