public JsonResult SaveCustomer(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); CustomerEntity model = serializer.Deserialize <CustomerEntity>(entity); if (string.IsNullOrEmpty(model.CustomerID)) { model.CustomerID = new CustomBusiness().CreateCustomer(model.Name, model.Type, model.SourceID, model.ActivityID, model.IndustryID, model.Extent, model.CityCode, model.Address, model.ContactName, model.MobilePhone, model.OfficePhone, model.Email, model.Jobs, model.Description, CurrentUser.UserID, CurrentUser.UserID, CurrentUser.AgentID, CurrentUser.ClientID); } else { bool bl = new CustomBusiness().UpdateCustomer(model.CustomerID, model.Name, model.Type, model.IndustryID, model.Extent, model.CityCode, model.Address, model.MobilePhone, model.OfficePhone, model.Email, model.Jobs, model.Description, CurrentUser.UserID, OperateIP, CurrentUser.AgentID, CurrentUser.ClientID); if (!bl) { model.CustomerID = ""; } } JsonDictionary.Add("model", model); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult SavaReply(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); ReplyEntity model = serializer.Deserialize <ReplyEntity>(entity); string replyID = ""; replyID = CustomBusiness.CreateReply(model.GUID, model.Content, CurrentUser.UserID, CurrentUser.AgentID, model.FromReplyID, model.FromReplyUserID, model.FromReplyAgentID); List <ReplyEntity> list = new List <ReplyEntity>(); if (!string.IsNullOrEmpty(replyID)) { model.ReplyID = replyID; model.CreateTime = DateTime.Now; model.CreateUser = CurrentUser; model.CreateUserID = CurrentUser.UserID; model.AgentID = CurrentUser.AgentID; if (!string.IsNullOrEmpty(model.FromReplyUserID) && !string.IsNullOrEmpty(model.FromReplyAgentID)) { model.FromReplyUser = OrganizationBusiness.GetUserByUserID(model.FromReplyUserID, model.FromReplyAgentID); } list.Add(model); } JsonDictionary.Add("items", list); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetCustomerByID(string customerid) { var model = CustomBusiness.BaseBusiness.GetCustomerByID(customerid, CurrentUser.AgentID, CurrentUser.ClientID); model.Industrys = CloudSalesBusiness.Manage.IndustryBusiness.GetIndustrys(); model.Extents = CustomBusiness.GetExtents(); JsonDictionary.Add("model", model); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Create(string id) { if (string.IsNullOrEmpty(id)) { ViewBag.Sources = new SystemBusiness().GetCustomSources(CurrentUser.AgentID, CurrentUser.ClientID).Where(m => m.IsChoose == 1).ToList(); } else { ViewBag.Sources = new SystemBusiness().GetCustomSources(CurrentUser.AgentID, CurrentUser.ClientID); } ViewBag.ActivityID = id; ViewBag.Industrys = CloudSalesBusiness.Manage.IndustryBusiness.GetIndustrys(); ViewBag.Extents = CustomBusiness.GetExtents(); return(View()); }
public JsonResult GetReplys(string guid, int pageSize, int pageIndex) { int pageCount = 0; int totalCount = 0; var list = CustomBusiness.GetReplys(guid, pageSize, pageIndex, ref totalCount, ref pageCount); JsonDictionary.Add("items", list); JsonDictionary.Add("totalCount", totalCount); JsonDictionary.Add("pageCount", pageCount); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }