Example #1
0
 public void Update(CustomerShare model)
 {
     var target = Find(model.ID);
     db.Attach<CustomerShare>(target);
     target.CompanyID = model.CompanyID;
     target.MemberID = model.MemberID;
     db.Commit();
 }
Example #2
0
 public CustomerShare Create(ViewModels.CustomerShareViewModel model)
 {
     CustomerShare entity = new CustomerShare();
     entity.CompanyID = model.CompanyID;
     entity.MemberID = model.MemberID;
     entity.AddUser = model.AddUser;
     entity.AddTime = DateTime.Now;
     db.Add<CustomerShare>(entity);
     db.Commit();
     return entity;
 }
 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);
 }
Example #4
0
 public void Delete(CustomerShare model)
 {
     var target = Find(model.ID);
     db.Remove<CustomerShare>(target);
     db.Commit();
 }
Example #5
0
 public void Create(CustomerShare model)
 {
     db.Add<CustomerShare>(model);
     db.Commit();
 }