public void getDC(HttpContext context) { List <Common.Entity.DealerContact> dealerContactResult = new List <Common.Entity.DealerContact>(); List <Common.Entity.OrderDealerContact> orderContactResult = new List <Common.Entity.OrderDealerContact>(); BLL.DealerContact dealerContact = new BLL.DealerContact(); string DealerId = context.Request["DealerId"]; string orderId = context.Request["orderId"]; string IsEdit = context.Request["IsEdit"]; if (!string.IsNullOrEmpty(DealerId)) { if ("1" == IsEdit) { dealerContactResult = dealerContact.GetListByDealerID(DealerId); var model = new CommonFunction.DataResult <Common.Entity.DealerContact> { dataList = dealerContactResult }; context.Response.Write(JsonConvert.SerializeObject(model)); } } else { orderContactResult = dealerContact.GetListByOrdersID(orderId); var model = new CommonFunction.DataResult <Common.Entity.OrderDealerContact> { dataList = orderContactResult }; context.Response.Write(JsonConvert.SerializeObject(model)); } }
/// <summary> /// 获取实体对象 /// </summary> /// <param name="context"></param> public void GetDealerContactByPKID(HttpContext context) { int pkid = Convert.ToInt32(context.Request["keyword"]); if (pkid > 0) { Common.Entity.DealerContact model = new BLL.DealerContact().GetDealerContactByPKID(pkid); if (model != null) { context.Response.Write(JsonConvert.SerializeObject(model)); } } }
/// <summary> /// 删除 /// </summary> /// <param name="context">上下文对象</param> public void DeleteDealerContact(HttpContext context) { int PKID = Convert.ToInt32(context.Request["PKID"]); if (PKID > 0) { BLL.DealerContact bll = new BLL.DealerContact(); bool result = bll.DELETEContactDATE(PKID); if (result) { context.Response.Write("{\"msg\":\"删除成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"删除失败。\",\"success\":false}"); } } }
/// <summary> /// 经销店联系人分页列表 /// </summary> /// <param name="context">上下文对象</param> public void GetDealerContactManagerPager(HttpContext context) { int pageIndex = Convert.ToInt32(context.Request["page"]); // 当前页码 int pageSize = Convert.ToInt32(context.Request["rows"]); // 页码大小 int totalCount = 0; var orderName = context.Request["sort"]; // 排序字段 var orderBy = context.Request["sortOrder"]; // 排序规则 var sort = sortInfo.GetSortOrder(orderName, orderBy); userName = context.User.Identity.Name; SysUserEntity model = new BLL.sysUser().GetSysUserByLoginName(userName); List <Common.Entity.DealerContact> list = new List <Common.Entity.DealerContact>(); string search_Name = context.Request.Form["Name"]; int search_JobID = Convert.ToInt32(context.Request.Form["JobID"]); Common.Entity.DealerContact filter = new Common.Entity.DealerContact { Name = search_Name, JobID = search_JobID }; if (sort.SortName != null && !string.IsNullOrEmpty(sort.IsDesc)) { list = new BLL.DealerContact().GetDealerContactManagerPager(pageIndex, pageSize, model.DealerId, sort.SortName, sort.IsDesc, filter, out totalCount); } else { list = new BLL.DealerContact().GetDealerContactManagerPager(pageIndex, pageSize, model.DealerId, filter, out totalCount); } var models = new BLL.BoostrapTableInfo <Common.Entity.DealerContact> { total = totalCount, rows = list }; string resultJson = JsonConvert.SerializeObject(models); context.Response.Write(resultJson); }
/// <summary> /// 保存数据 /// </summary> /// <param name="context">上下文对象</param> public void SaveDealerContact(HttpContext context) { int HidId = Convert.ToInt32(context.Request["HidId"]); // 获取前端隐藏域ID用来判断是新增还是修改操作 int jobId = Convert.ToInt32(context.Request.Form["fr_JobID"]); int DealerId = Convert.ToInt32(context.Request.Form["DealerId"]); string name = context.Request.Form["fr_Name"]; string Phone = context.Request.Form["Phone"]; string MobileTel = context.Request.Form["MobileTel"]; string Fax = context.Request.Form["Fax"]; string Email = context.Request.Form["Email"]; string OtherContactInfo = context.Request.Form["OtherContactInfo"]; string Remark = context.Request.Form["Remark"]; BLL.DealerContact bll = new BLL.DealerContact(); if (HidId <= 0) { // 添加 Common.Entity.DealerContact model = new Common.Entity.DealerContact(); bool IsExistsNameAndMobileTel = bll.Exists(name, MobileTel); model.DealerID = DealerId; model.Name = name; model.JobID = jobId; model.Phone = Phone; model.MobileTel = MobileTel; model.Fax = Fax; model.Email = Email; model.OtherContactInfo = OtherContactInfo; model.Remark = Remark; int result = bll.Add(model); if (IsExistsNameAndMobileTel) { context.Response.Write("{\"msg\":\"经销店联系人已存在(经销店,姓名,移动电话),请修改。\",\"state\":\"T\"}"); } else if (result > 0) { context.Response.Write("{\"msg\":\"保存成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"保存失败,请重试。\",\"success\":false}"); } } else { Common.Entity.DealerContact entity = new Common.Entity.DealerContact(); entity.PKID = HidId; entity.Name = name; entity.JobID = jobId; entity.Phone = Phone; entity.MobileTel = MobileTel; entity.Fax = Fax; entity.Email = Email; entity.OtherContactInfo = OtherContactInfo; entity.Remark = Remark; bool result = bll.Update(entity); if (result) { context.Response.Write("{\"msg\":\"保存成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"保存失败。\",\"success\":false}"); } } }
/// <summary> /// 职务下拉列表 /// </summary> /// <param name="context"></param> public void GetJobList(HttpContext context) { DataTable dt = new BLL.DealerContact().GetJobList(); context.Response.Write(JsonConvert.SerializeObject(dt)); }
/// <summary> /// 获取一个订单的完全信息 /// </summary> /// <param name="orderId">订单ID</param> /// <param name="viewOriginal">查看原始订购信息</param> /// <returns></returns> public Common.Entity.ReportOrder GetOrderFullInfo(int orderId, bool viewOriginal) { Common.Entity.ReportOrder ordersInfo = new ReportOrder(); // 订单基本信息 BLL.Order bll = new Order(); Common.Entity.Order oInfo = bll.GetOrderByPKID(orderId); if (oInfo != null) { ordersInfo.BaseRemark = oInfo.BaseRemark; ordersInfo.IsApplyMaxCustomerResources = oInfo.IsApplyMaxCustomerResources == 1 ? "是" : "否"; ordersInfo.BuyWay = oInfo.BuyWay; ordersInfo.CarUse = oInfo.CarUse; ordersInfo.CreateTime = oInfo.CreateTime == null ? new DateTime(1990, 1, 1) : (DateTime)oInfo.CreateTime; ordersInfo.CustomerName = oInfo.CustomerName; ordersInfo.CustomerSuggestion = oInfo.CustomerSuggestion; ordersInfo.DealerName = oInfo.DealerName; ordersInfo.DifferentPlace = oInfo.DifferentPlace == 1 ? "是" : "否"; ordersInfo.CustomerID = oInfo.CustomerID; ordersInfo.DealerID = oInfo.DealerID; ordersInfo.PKID = oInfo.PKID; ordersInfo.Watchmaker = oInfo.Watchmaker; ordersInfo.Code = oInfo.Code; ordersInfo.ReComment1 = oInfo.ReComment1; ordersInfo.ReComment2 = oInfo.ReComment2; ordersInfo.ReComment3 = oInfo.ReComment3; ordersInfo.RecordName = oInfo.RecordName; ordersInfo.ReDate1 = oInfo.ReDate1; ordersInfo.ReDate2 = oInfo.ReDate2; ordersInfo.ReDate3 = oInfo.ReDate3; ordersInfo.ReRemark1 = oInfo.ReRemark1; ordersInfo.ReRemark2 = oInfo.ReRemark2; ordersInfo.ReRemark3 = oInfo.ReRemark3; ordersInfo.Replyer1 = oInfo.Replyer1; ordersInfo.Replyer2 = oInfo.Replyer2; ordersInfo.Replyer3 = oInfo.Replyer3; ordersInfo.OrderState = oInfo.OrderState; ordersInfo.SubmitType = oInfo.SubmitType; ordersInfo.BearUser = oInfo.BearUser; ordersInfo.FN_Email = oInfo.Email; ordersInfo.OffAddressOnCardReport = oInfo.OffAddressOnCardReport == 1 ? "是" : "否"; ordersInfo.FN_InvoiceDiffer = oInfo.InvoiceAndCustomerAtypism == 1 ? "是" : "否"; ordersInfo.FN_InvoiceName = oInfo.InvoiceCustomerInfo; } // 客户基本信息 BLL.Customer customer = new Customer(); Common.Entity.Customer cInfo = customer.GetCustomerByPKID(ordersInfo.CustomerID); if (cInfo != null) { ordersInfo.CustomerAddress = cInfo.Address; ordersInfo.CustomerChargeDept = cInfo.CompetentDepartment; ordersInfo.CustomerExecutiveDept = cInfo.ExecutiveDepartment; ordersInfo.CustomerMainBusiness = cInfo.MainBusiness; ordersInfo.CustomerProfiles = cInfo.CustomerProfiles; ordersInfo.CustomerUseDept = cInfo.UseDepartment; ordersInfo.CustomerZipCode = cInfo.Zip; ordersInfo.Customer_Type = cInfo.CustomerNatureName; ordersInfo.Customer_Type2 = cInfo.CustomerNatureName2; ordersInfo.Customer_Memo = cInfo.Remark; ordersInfo.CustomerNo = cInfo.EnterpriseCode; } if (oInfo.ToExamineState > 0) { ordersInfo.CustomerContact = customer.GetListByOrdersID(ordersInfo.PKID); } else { ordersInfo.CustomerContact = customer.GetListByCustomerID(ordersInfo.CustomerID); } if (viewOriginal) { BLL.CarPurchase cdBll = new CarPurchase(); ordersInfo.CarPurchase = cdBll.GetOriginalList(ordersInfo.Code.Substring(0, ordersInfo.Code.IndexOf('.'))); } else { BLL.CarPurchase cdBll = new CarPurchase(); ordersInfo.CarPurchase = cdBll.GetList(ordersInfo.PKID); } // 经销店联系人 BLL.DealerContact dcBLL = new DealerContact(); if (oInfo.ToExamineState > 0) { ordersInfo.DealerContact = dcBLL.GetListByOrdersID(ordersInfo.PKID); } else { ordersInfo.DealerContact = dcBLL.GetListByDealerID(ordersInfo.DealerID); } return(ordersInfo); }