Beispiel #1
0
 public ActionResult Index(ChangePasswordViewModel model)
 {
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             var memberID = Convert.ToInt32(CookieHelper.UID);
             if (!MemberService.ChangePassword(memberID, model.OldPassword, model.NewPassword))
             {
                 result.Message = "旧密码错误!";
                 result.AddServiceError("旧密码错误");
                 return View(model);
             }
             result.Message = "密码修改成功!";
             return RedirectToAction("index");
         }
         catch (Exception ex)
         {
             result.Message = "密码修改失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + model.MemberID + "密码修改失败!", ex);
         }
     }
     return View(model);
 }
Beispiel #2
0
        public ActionResult Create(DepartmentViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    Department entity = new Department();
                    entity.Name = model.Name;
                    entity.Description = model.Description;
                    entity.Level = model.Level;
                    entity.PID = model.PID;
                    entity.Code = model.Code;
                    DepartmentService.Create(entity);
                    result.Message = "添加部门成功!";
                    LogHelper.WriteLog("添加部门成功");
                    return RedirectToAction("index");
                }
                catch (DbEntityValidationException ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加部门错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            ViewBag.Data_PID = GetSelectList();
            return View(model);
        }
 public ActionResult Create(RelationCateViewModel model)
 {
     ViewBag.Data_PID = GetSelectList();
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             RelationCate entity = new RelationCate();
             entity.CateName = model.CateName;
             entity.PID = model.PID == 0 ? null : model.PID;
             entity.Level = model.Level;
             entity.OrderIndex = model.OrderIndex;
             entity.Code = model.Code;
             cityService.Create(entity);
             result.Message = "添加城市信息成功!";
             LogHelper.WriteLog("添加城市信息成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加城市信息错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Beispiel #4
0
        public ActionResult AjaxCreate(PlanLogViewModel model)
        {
            ServiceResult result = new ServiceResult();

            if (!ModelState.IsValid)
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            else
            {
                try
                {
                    PlanLogService.Create(model);
                    result.Message = "添加计划日志成功!";
                }
                catch (Exception ex)
                {
                    result.Message = ex.Message;
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加计划日志失败!", ex);
                }
            }
            return Json(result);
        }
Beispiel #5
0
 public ActionResult AjaxCreate(TraceLogViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (!ModelState.IsValid)
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     else
     {
         try
         {
             TraceLogService.Create(model);
             //CustomerCompanyService.ChangeRelation(model.CompanyID, model.RelationID);
             result.Message = "添加跟单日志成功!";
         }
         catch (Exception ex)
         {
             result.Message = ex.Message;
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加跟单日志失败!", ex);
         }
     }
     ViewBag.Data_RelationID = Utilities.GetSelectListData(RelationCateService.GetALL(), x => x.ID, x => x.CateName, true);
     return Json(result);
 }
 public ActionResult Delete(int ID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var entity = CustomerShareService.Find(ID);
         CustomerShareService.Delete(entity);
         result.Message = "删除共享人员成功!";
     }
     catch (Exception ex)
     {
         result.Message = "删除共享人员失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "删除共享人员失败!", ex);
     }
     return Json(result);
 }
Beispiel #7
0
        public ActionResult Create(ArticleViewModel model)
        {
            ViewBag.Data_ArticleCode = GetForeignData();
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    Article article = new Article()
                    {
                        AddTime = DateTime.Now,
                        ArticleCodeValue = model.ArticleCode,
                        Content = model.Content,
                        Name = model.Name,
                        LastTime = DateTime.Now,
                        ArticleCode = Convert.ToInt32(model.ArticleCode.Split(',').Last())
                    };

                    ArticleService.Create(article);
                    result.Message = "添加文章信息成功!";
                    LogHelper.WriteLog("添加文章信息成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加文章信息错误", ex);
                    return View(model);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");
                return View(model);
            }
        }
Beispiel #8
0
 public ActionResult Create(GroupViewModel model)
 {
     var Roles = GetForeignData();
     ViewBag.Data_Roles = Roles;
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Group entity = new Group();
             entity.Name = model.Name;
             entity.Content = model.Content;
             entity.Description = model.Description;
             var RolesArray = model.Roles.Split(',').Select(x => Convert.ToInt32(x)).ToList();
             var RoleList = RolesService.GetALL().Where(x => RolesArray.Contains(x.ID));
             entity.Roles.AddRange(RoleList);
             GroupService.Create(entity);
             result.Message = "添加群组成功!";
             LogHelper.WriteLog("添加群组成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加群组错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
 public ActionResult Create(PermissionsViewModel model)
 {
     ViewBag.Data_DepartmentID = GetSelectList();
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Permissions entity = new Permissions();
             entity.Name = model.Name;
             entity.Description = model.Description;
             entity.Controller = model.Controller;
             entity.Action = model.Action;
             entity.Namespace = model.Namespace;
             entity.DepartmentID = model.DepartmentID;
             PermissionsService.Create(entity);
             result.Message = "添加权限成功!";
             LogHelper.WriteLog("添加权限成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加权限错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Beispiel #10
0
        public ActionResult Create(TcNoticeViewModel model)
        {
            ServiceResult result = new ServiceResult();
            var DepartmentArray = new List<int>();

            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    DepartmentArray = model.DepartmentID.Split(',').Select(x => Convert.ToInt32(x)).ToList();
                    TcNoticeService.Create(model);
                    result.Message = "添加提成公告成功!";
                    LogHelper.WriteLog("添加提成公告成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加提成公告错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            ViewBag.Data_DepartmentID = Utilities.GetSelectListData(
                 DepartmentService.GetALL()
                 .Where(x => x.PID.Equals(null)),
                 x => x.ID, x => x.Name, DepartmentArray, false);

            return View(model);
        }
Beispiel #11
0
 public ActionResult AjaxCreate(TaskViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (!ModelState.IsValid)
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     else
     {
         try
         {
             var entity = TaskService.Create(model);
             result.SuccessData = new Task()
             {
                 Start = entity.Start,
                 End = entity.End,
                 ID = entity.ID,
                 StartTimeZone = entity.StartTimeZone,
                 EndTimeZone = entity.EndTimeZone,
                 Description = entity.Description,
                 Title = entity.Title,
                 MemberID = entity.MemberID,
                 IsOtherAdd = entity.MemberID != CookieHelper.MemberID
             };
             result.Message = "添加任务安排成功!";
         }
         catch (Exception ex)
         {
             result.Message = ex.Message;
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加任务安排失败!", ex);
         }
     }
     return Json(result);
 }
Beispiel #12
0
        public ActionResult Create(MemberViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    MemberService.Create(model);
                    result.Message = "添加会员信息成功!";
                    LogHelper.WriteLog("添加会员信息成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加会员信息错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            ViewBag.Data_GroupID = Utilities.GetSelectListData(GroupService.GetALL()
              , x => x.ID, x => x.Name, true);
            ViewBag.Data_DepartmentID = Utilities.GetSelectListData(DepartmentService.GetALL()
                , x => x.ID, x => x.Name, true);
            ViewBag.Data_JobTitleID = Utilities.GetSelectListData(
               JobTitleCateService.GetALL()
              , x => x.ID, x => x.CateName, true);
            return View(model);
        }
 public ActionResult Share(string ids, int companyId)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var idlist = Utilities.GetIdList(ids);
         foreach (var id in idlist)
         {
             if (!CustomerShareService.GetALL().Any(x => x.MemberID == id && x.CompanyID == companyId))
             {
                 var shareitem = new CustomerShare()
                 {
                     MemberID = id,
                     AddTime = DateTime.Now,
                     AddUser = CookieHelper.MemberID,
                     CompanyID = companyId
                 };
                 CustomerShareService.Create(shareitem);
             }
         }
         result.Message = "设置共享人员成功!";
     }
     catch (Exception ex)
     {
         result.Message = "设置共享人员失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "设置共享人员失败!", ex);
     }
     return Json(result);
 }
Beispiel #14
0
 public ActionResult Edit(RolesViewModel model)
 {
     var permissionsArray = model.Permissions.Split(',').Select(x => Convert.ToInt32(x)).ToList();
     var permissions = GetGroupForeignData(permissionsArray);
     ViewBag.Data_Permissions = permissions;
     ServiceResult result = new ServiceResult();
     TempData["Service_Result"] = result;
     if (ModelState.IsValid)
     {
         try
         {
             Roles entity = new Roles();
             entity.ID = model.ID;
             entity.Name = model.Name;
             entity.Description = model.Description;
             var PermissionList = PermissionsService.GetALL().Where(x => permissionsArray.Contains(x.ID)).ToList();
             entity.Permissions = PermissionList;
             RolesService.Update(entity);
             result.Message = "编辑角色成功!";
             LogHelper.WriteLog("编辑角色成功");
             return RedirectToAction("index");
         }
         catch (DbEntityValidationException ex)
         {
             result.Message = Utilities.GetInnerMostException(ex);
             result.AddServiceError(result.Message);
             LogHelper.WriteLog("添加角色错误", ex);
             return View(model);
         }
     }
     else
     {
         result.Message = "请检查表单是否填写完整!";
         result.AddServiceError("请检查表单是否填写完整!");
         return View(model);
     }
 }
Beispiel #15
0
        public ActionResult Delete(string Name)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            try
            {
                var filePath = Name;
                var file = new FileInfo(Name);
                file.Delete();
                result.Message = "删除备份成功!";
                LogHelper.WriteLog("删除备份成功!");

            }
            catch (Exception ex)
            {
                //result.Message = Utilities.GetInnerMostException(ex);
                result.Message = "删除备份失败!";
                result.AddServiceError(result.Message);
                LogHelper.WriteLog("删除备份失败!", ex);
            }
            return RedirectToAction("index");
        }
Beispiel #16
0
 public ActionResult AjaxEdit(CustomerViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (!ModelState.IsValid)
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     else
     {
         try
         {
             CustomerService.Update(model);
             result.Message = "编辑客户人员信息成功!";
         }
         catch (Exception ex)
         {
             result.Message = "编辑客户人员信息失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑客户人员信息失败!", ex);
         }
     }
     ViewBag.Data_JobID = Utilities.GetSelectListData(JobCateService.GetALL(), x => x.ID, x => x.CateName, model.JobID, true);
     return Json(result);
 }
Beispiel #17
0
        public ActionResult Edit(CustomerViewModel model)
        {
            ServiceResult result = new ServiceResult();

            TempData["Service_Result"] = result;
            if (!ModelState.IsValid)
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            else
            {
                try
                {
                    CustomerService.Update(model);
                    result.Message = "编辑客户人员信息成功!";
                    return RedirectToAction("details", "customercompany", new { id = model.CompanyID });
                }
                catch (Exception ex)
                {
                    result.Message = "编辑客户人员信息失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑客户人员信息失败!", ex);
                }

            }
            ViewBag.Data_JobID = Utilities.GetSelectListData(JobCateService.GetALL(), x => x.ID, x => x.CateName, model.JobID, true);
            return View(model);
        }
 public ActionResult ChangStatus(int ID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = ContactRequireService.Find(ID);
         var entity = new ContactRequire()
         {
             ID = model.ID,
             Description = model.Description,
             AttachmentPath = model.AttachmentPath,
             IsRoot = model.IsRoot,
             Status = 1,
             Name = model.Name
         };
         ContactRequireService.Update(entity);
         LogHelper.WriteLog("更改合同状态成功");
         result.Message = "更改合同状态成功!";
     }
     catch (DbEntityValidationException ex)
     {
         result.Message = "更改合同状态错误!";
         result.AddServiceError("更改合同状态错误!");
         LogHelper.WriteLog("更改合同状态错误", ex);
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Beispiel #19
0
        public ActionResult Create(MemberClerkViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {

                    //groupID 6  指的是基本业务功能的会员群组
                    var entity = new MemberViewModel()
                    {
                        Address = model.Address,
                        BirthDay = model.BirthDay,
                        DepartmentID = model.DepartmentID,
                        Description = model.Description,
                        Email = model.Email,
                        IsLeader = model.IsLeader,
                        IsLeap = model.IsLeap,
                        Mobile = model.Mobile,
                        Mobile1 = model.Mobile1,
                        NickName = model.NickName,
                        Password = model.Password,
                        QQ = model.QQ,
                        Sex = model.Sex,
                        GroupID = 6,
                        FamilySituation = model.FamilySituation,
                        IDNumber = model.IDNumber,
                        JobExp = model.JobExp,
                        AvtarUrl = model.AvtarUrl,
                        StudyExp = model.StudyExp
                    };
                    MemberService.Create(entity);
                    result.Message = "添加业务人员成功!";
                    LogHelper.WriteLog("添加业务人员成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加业务人员错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            var member = MemberService.GetALL().Include(x => x.Department)
                 .Single(x => x.MemberID == CookieHelper.MemberID);
            var departCode = member.Department.Code;
            var maxCode = Utilities.GetMaxCode(departCode, member.Department.Level);
            ViewBag.Data_DepartmentID = Utilities.GetSelectListData(
                DepartmentService.GetALL().Where(x => x.Code >= departCode && x.Code <= maxCode)
                , x => x.ID, x => x.Name, true);
            return View(model);
        }
Beispiel #20
0
 public ActionResult SetDelete(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         MemberService.ChangeStatus(ids, MemberCurrentStatus.Delete);
         result.Message = "禁用员工帐号成功!";
     }
     catch (Exception ex)
     {
         result.Message = "禁用员工帐号失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "禁用员工帐号失败!", ex);
     }
     return Json(result);
 }
Beispiel #21
0
        public ActionResult Edit(FileShareViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {

                    FileShareService.Update(model);
                    result.Message = "编辑文件共享成功!";
                    LogHelper.WriteLog("编辑文件共享成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("编辑文件共享错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            ViewBag.Data_FileCateID = Utilities.GetSelectListData(
               FileCateService.GetALL().Where(x => x.PID.Equals(null))
               , x => x.ID, x => x.CateName, model.FileCateID, true, true);

            var departlist = DepartmentService.GetALL().Where(x => x.PID.Equals(null));

            var hasPermission = CookieHelper.CheckPermission("boss");
            if (!hasPermission)
            {
                var member = MemberService.Find(CookieHelper.MemberID);
                var depart = DepartmentService.Find(member.DepartmentID);
                if (depart.Level == 0)
                {
                    departlist = departlist.Where(x => x.ID == depart.ID);
                }
                else
                {
                    var rootCode = Utilities.GetRootCode(depart.Code, depart.Level);
                    departlist = departlist.Where(x => x.Code == rootCode);
                }
            }
            ViewBag.Data_DepartmentID = Utilities.GetSelectListData(
             departlist
               , x => x.ID, x => x.Name, model.DepartmentID, true, true);
            return View(model);
        }
Beispiel #22
0
        public ActionResult Create(NoticeViewModel model)
        {
            ServiceResult result = new ServiceResult();
            TempData["Service_Result"] = result;
            if (ModelState.IsValid)
            {
                try
                {
                    NoticeService.Create(model);
                    result.Message = "添加部门公告成功!";
                    LogHelper.WriteLog("添加部门公告成功");
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加部门公告错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }
            var list = DepartmentService.GetALL().Where(x => x.PID.Equals(null));
            var hasPermission = CookieHelper.CheckPermission("boss");
            if (!hasPermission)
            {
                var member = MemberService.Find(CookieHelper.MemberID);
                list = list.Where(x => x.ID == member.DepartmentID);
            }
            ViewBag.Data_DepartmentID = Utilities.GetSelectListData(
                list
                , x => x.ID, x => x.Name, true);

            return View(model);
        }
 public ActionResult SetRefresh(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         CustomerCompanyService.ChangeStatus(ids, CustomerCompanyStatus.Default);
         result.Message = "客户信息恢复成功!";
     }
     catch (Exception ex)
     {
         result.Message = "客户信息恢复失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "客户信息恢复失败!", ex);
     }
     return Json(result);
 }
        public ActionResult Edit(CustomerCompanyViewModel model)
        {
            ServiceResult result = new ServiceResult();

            TempData["Service_Result"] = result;
            if (!ModelState.IsValid)
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            else
            {
                try
                {
                    CustomerCompanyService.Update(model);
                    //标记为已合作客户
                    if (model.CustomerCateID == 5)
                    {
                        var contact = new ContactRequireViewModel()
                        {
                            CompanyID = model.ID,
                            //财务部
                            DepartmentID = 8,
                            Name = model.Name + "财务合同请求",
                            Description = model.Name + "财务合同请求",
                            SenderID = CookieHelper.MemberID,
                            IsRoot = 1
                        };
                        ContactRequireService.Create(contact);
                    }
                    result.Message = "编辑客户成功!";
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = "编辑客户失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑客户失败!", ex);
                }
            }
            ViewBag.Data_RelationID = Utilities.GetSelectListData(RelationCateService.GetALL(), x => x.ID, x => x.CateName, model.RelationID, true);
            ViewBag.Data_CustomerCateID = Utilities.GetSelectListData(CustomerCateService.GetALL(), x => x.ID, x => x.CateName, model.CustomerCateID, true);
            return View(model);
        }
        public ActionResult Create(CustomerCompanyViewModel model)
        {
            ServiceResult result = new ServiceResult();

            TempData["Service_Result"] = result;
            if (!ModelState.IsValid)
            {
                result.Message = "表单输入有误,请仔细填写表单!";
                result.AddServiceError("表单输入有误,请仔细填写表单!");
            }
            else
            {
                try
                {
                    CustomerCompanyService.Create(model);
                    result.Message = "添加客户成功!";
                    return RedirectToAction("index");
                }
                catch (Exception ex)
                {
                    result.Message = "添加客户失败!";
                    result.AddServiceError(Utilities.GetInnerMostException(ex));
                    LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加客户失败!", ex);
                }

            }
            ViewBag.Data_RelationID = Utilities.GetSelectListData(RelationCateService.GetALL(), x => x.ID, x => x.CateName, true);
            ViewBag.Data_CustomerCateID = Utilities.GetSelectListData(CustomerCateService.GetALL(), x => x.ID, x => x.CateName, true);
            return View(model);
        }
Beispiel #26
0
 public ActionResult AjaxAppend(MediaRequireAppendViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (!ModelState.IsValid)
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     else
     {
         try
         {
             var entity = new MediaRequireViewModel()
             {
                 DepartmentID = model.DepartmentID,
                 AttachmentPath = model.AttachmentPath,
                 CompanyID = model.CompanyID,
                 Description = model.Description,
                 IsRoot = model.IsRoot,
                 ID = model.ID,
                 Name = model.Name,
                 ResolveID = model.ResolveID,
                 PID = model.PID,
                 SenderID = model.SenderID,
                 Status = model.Status
             };
             MediaRequireService.Create(entity);
             result.Message = "追加回复成功!";
         }
         catch (Exception ex)
         {
             result.Message = "追加回复失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "追加回复失败!", ex);
         }
     }
     return Json(result);
 }
Beispiel #27
0
 public ActionResult SetDelete(string ids)
 {
     ServiceResult result = new ServiceResult();
     var IdArr = ids.Split(',').Select(x => Convert.ToInt32(x)).ToList();
     try
     {
         for (var i = 0; i < IdArr.Count; i++)
         {
             var model = FileShareService.Find(IdArr[i]);
             FileShareService.Delete(model);
         }
         LogHelper.WriteLog("删除文件共享成功");
         result.Message = "删除文件共享成功!";
     }
     catch (DbEntityValidationException ex)
     {
         result.Message = "删除文件共享错误!";
         result.AddServiceError("删除文件共享错误!");
         LogHelper.WriteLog("删除文件共享错误", ex);
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Beispiel #28
0
 public ActionResult Delete(int ID)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var model = TaskService.Find(ID);
         TaskService.Delete(model);
         LogHelper.WriteLog("删除任务安排成功");
         result.Message = "删除任务安排成功!";
     }
     catch (DbEntityValidationException ex)
     {
         result.Message = "删除任务安排错误!";
         result.AddServiceError("删除任务安排错误!");
         LogHelper.WriteLog("删除任务安排错误", ex);
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
 public ActionResult SetReplace(string ids)
 {
     ServiceResult result = new ServiceResult();
     try
     {
         var idslist = Utilities.GetIdList(ids);
         foreach (var id in idslist)
         {
             CustomerCompanyService.Replace(id, CookieHelper.MemberID);
         }
         result.Message = "客户信息替换成功!";
     }
     catch (Exception ex)
     {
         result.Message = "客户信息替换失败!";
         result.AddServiceError(Utilities.GetInnerMostException(ex));
         LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "客户信息替换失败!", ex);
     }
     return Json(result);
 }
 public ActionResult AjaxCreate(MediaRequireViewModel model)
 {
     ServiceResult result = new ServiceResult();
     if (!ModelState.IsValid)
     {
         result.Message = "表单输入有误,请仔细填写表单!";
         result.AddServiceError("表单输入有误,请仔细填写表单!");
     }
     else
     {
         try
         {
             var resolver = MemberService.Find(model.ResolveID);
             model.DepartmentID = resolver.DepartmentID;
             MediaRequireService.Create(model);
             result.Message = "添加媒体请求成功!";
         }
         catch (Exception ex)
         {
             result.Message = "添加媒体请求失败!";
             result.AddServiceError(Utilities.GetInnerMostException(ex));
             LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加媒体请求失败!", ex);
         }
     }
     return Json(result);
 }