protected void btnSave_Click(object sender, EventArgs e) { string Month = this.txtMonth.Text.Trim(); string ErrorCount = this.txtErrorCount.Text.Trim(); string TMIndex = this.txtTMIndex.Text.Trim(); string DSRScore = this.txtDSRScore.Text.Trim(); string ResponseTime = this.txtResponseTime.Text.Trim(); string JDResponseTime = this.txtJDResponseTime.Text.Trim(); string JDCustomerService = this.txtJDCustomerService.Text.Trim(); string CustomerComplaints = this.txtCustomerComplaints.Text.Trim(); string EvaluationPoints = this.txtEvaluationPoints.Text.Trim(); if (string.IsNullOrEmpty(Month) || string.IsNullOrEmpty(ErrorCount) || string.IsNullOrEmpty(TMIndex) || string.IsNullOrEmpty(DSRScore) || string.IsNullOrEmpty(ResponseTime) || string.IsNullOrEmpty(JDResponseTime) || string.IsNullOrEmpty(JDCustomerService) || string.IsNullOrEmpty(CustomerComplaints) || string.IsNullOrEmpty(EvaluationPoints)) { base.ShowMessage("数据不能为空!"); return; } else { var date = base.XMAfterSalesDataService.GetXMAfterSalesDataInfoByMonth(Month, CustomerId); if (date == null)//添加 { XMAfterSalesData orderinfoapp = new XMAfterSalesData(); orderinfoapp.CustomerID = CustomerId; orderinfoapp.Type = false; orderinfoapp.Month = Month; orderinfoapp.ErrorCount = int.Parse(ErrorCount); orderinfoapp.TMIndex = decimal.Parse(TMIndex); orderinfoapp.DSRScore = decimal.Parse(DSRScore); orderinfoapp.ResponseTime = decimal.Parse(ResponseTime); orderinfoapp.JDResponseTime = decimal.Parse(JDResponseTime); orderinfoapp.JDCustomerService = decimal.Parse(JDCustomerService); orderinfoapp.CustomerComplaints = int.Parse(CustomerComplaints); orderinfoapp.EvaluationPoints = int.Parse(EvaluationPoints); orderinfoapp.CreateID = HozestERPContext.Current.User.CustomerID; orderinfoapp.CreateTime = DateTime.Now; orderinfoapp.UpdateID = HozestERPContext.Current.User.CustomerID; orderinfoapp.UpdateTime = DateTime.Now; base.XMAfterSalesDataService.InsertXMAfterSalesData(orderinfoapp); base.ShowMessage("保存成功!"); } else if (date.Type == false) { date.Type = false; date.Month = Month; date.ErrorCount = int.Parse(ErrorCount); date.TMIndex = decimal.Parse(TMIndex); date.DSRScore = decimal.Parse(DSRScore); date.ResponseTime = decimal.Parse(ResponseTime); date.JDResponseTime = decimal.Parse(JDResponseTime); date.JDCustomerService = decimal.Parse(JDCustomerService); date.CustomerComplaints = int.Parse(CustomerComplaints); date.EvaluationPoints = int.Parse(EvaluationPoints); date.UpdateID = HozestERPContext.Current.User.CustomerID; date.UpdateTime = DateTime.Now; base.XMAfterSalesDataService.UpdateXMAfterSalesData(date); base.ShowMessage("保存成功!"); } else if (date.Type == true) { base.ShowMessage("该客服此月份数据已存档!"); } } }
public void BindGrid(int paramPageIndex, int paramPageSize) { //开始日期 string beginDate = this.ddlBeginDate.Value.ToString(); //结束日期 string endDate = this.ddlEndDate.Value.ToString(); if (string.IsNullOrEmpty(beginDate) || string.IsNullOrEmpty(endDate)) { base.ShowMessage("请先选择开始日期与结束日期!"); return; } DateTime begin = DateTime.Parse(beginDate); DateTime end = DateTime.Parse(endDate); if (begin >= end) { base.ShowMessage("开始日期不能大于结束日期,请重新选择!"); return; } if (!(begin.Year == end.Year && begin.Month == end.Month)) { base.ShowMessage("请不要跨越月份查询!"); return; } end = end.AddDays(1); //组别 int groupId = int.Parse(this.ddlGroupID.SelectedValue); //姓名 string Name = this.ddlName.Text.ToString(); //级别 string RankName = this.ddlRank.SelectedItem.Text.Trim(); //售后客服DepCode string DepCode = "QC1403-3,QC1403-4,QC1506-2"; //根据条件查询客服信息 var xMProjectList = base.CustomerInfoService.GetCustomerInfoPreList(groupId, Name, DepCode, RankName); List <XMAfterSalesDataAll> all = new List <XMAfterSalesDataAll>(); if (xMProjectList != null && xMProjectList.Count > 0) { for (int i = 0; i < xMProjectList.Count; i++) { XMAfterSalesDataAll one = new XMAfterSalesDataAll(); one.CustomerID = (int)xMProjectList[i].CustomerID; one.CustomerName = xMProjectList[i].Name; one.GroupID = (int)xMProjectList[i].GroupID; one.GroupName = xMProjectList[i].Group; List <QuestionDetailed_Result> PersonalWorkload = base.XMAfterSalesDataService.GetXMAfterSalesDataByPersonalWorkload(begin, end, one.CustomerID); one.PersonalWorkload = PersonalWorkload.Count; List <QuestionDetailed_Result> DemandReturnCount = PersonalWorkload.Where(p => p.IsReturns == true).ToList();//base.XMAfterSalesDataService.GetXMAfterSalesDataByDemandReturn(begin, end, one.CustomerID, ""); one.DemandReturn = DemandReturnCount.Count; int ReturnID = 0; var codelist = base.CodeService.GetCodeListAll(); if (codelist != null) { foreach (CodeList item in codelist) { if (item.CodeName == "退货") { ReturnID = item.CodeID; break; } } } List <QuestionDetailed_Result> ActualReturnCount = PersonalWorkload.Where(p => p.ResultsId == ReturnID).ToList();//base.XMAfterSalesDataService.GetXMAfterSalesDataByDemandReturn(begin, end, one.CustomerID, ReturnID.ToString()); one.ActualReturn = ActualReturnCount.Count(); if (one.DemandReturn != 0) { one.ReturnRate = (Math.Round((Convert.ToDouble(one.DemandReturn - one.ActualReturn) * 100 / Convert.ToDouble(one.DemandReturn)), 2)).ToString() + " %"; } else { one.ReturnRate = "0 %"; } //List<QuestionDetailed_Result> PersonalWorkload = base.XMAfterSalesDataService.GetXMAfterSalesDataByPersonalWorkload(begin, end, one.CustomerID); //one.PersonalWorkload = PersonalWorkload.Count; string date = begin.Year.ToString() + "-" + begin.Month.ToString().PadLeft(2, '0'); XMAfterSalesData data = base.XMAfterSalesDataService.GetXMAfterSalesDataInfoByMonth(date, one.CustomerID); if (data != null)// && begin.Year == end.Year && begin.Month == end.AddDays(-1).Month) { one.ID = data.ID; one.ErrorCount = data.ErrorCount.ToString().Trim(); one.TMIndex = Math.Round((decimal)data.TMIndex, 2) + "%"; one.DSRScore = data.DSRScore.ToString().Trim(); one.ResponseTime = data.ResponseTime.ToString().Trim(); one.JDResponseTime = data.JDResponseTime.ToString().Trim(); one.JDCustomerService = data.JDCustomerService.ToString().Trim(); one.CustomerComplaints = data.CustomerComplaints.ToString().Trim(); one.EvaluationPoints = data.EvaluationPoints.ToString().Trim(); one.IsFile = (bool)data.Type; } else { one.ID = 0; one.ErrorCount = ""; one.TMIndex = ""; one.DSRScore = ""; one.ResponseTime = ""; one.JDResponseTime = ""; one.JDCustomerService = ""; one.CustomerComplaints = ""; one.EvaluationPoints = ""; one.IsFile = false; } all.Add(one); } } //根据项目名称和平台类型查询。 //var xMProjectList = base.XMDSRService.GetXMDSRList(NickId, PlatformTypeId, Month); //分页 var xMProjectPageList = new PagedList <XMAfterSalesDataAll>(all, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); this.Master.BindData(this.grdvClients, xMProjectPageList, paramPageSize + 1); }
/// <summary> /// 得到月售后数据 /// </summary> public XMAfterSalesDataAll GetAfterSalesData(XMPreSalesSalary user, string Month) { string[] year_month = Month.Split('-'); DateTime begin = DateTime.Parse(Month + "-01"); DateTime end = DateTime.Parse(Month + "-" + (DateTime.DaysInMonth(int.Parse(year_month[0]), int.Parse(year_month[1]))).ToString()); XMAfterSalesDataAll one = new XMAfterSalesDataAll(); one.CustomerID = (int)user.CustomerID; one.CustomerName = user.Name; one.GroupID = (int)user.GroupID; one.GroupName = user.Group; List <QuestionDetailed_Result> PersonalWorkload = base.XMAfterSalesDataService.GetXMAfterSalesDataByPersonalWorkload(begin, end, one.CustomerID); one.PersonalWorkload = PersonalWorkload.Count; List <QuestionDetailed_Result> DemandReturnCount = PersonalWorkload.Where(p => p.IsReturns == true).ToList(); one.DemandReturn = DemandReturnCount.Count; int ReturnID = 0; var codelist = base.CodeService.GetCodeListAll(); if (codelist != null) { foreach (CodeList item in codelist) { if (item.CodeName == "退货") { ReturnID = item.CodeID; break; } } } List <QuestionDetailed_Result> ActualReturnCount = PersonalWorkload.Where(p => p.ResultsId == ReturnID).ToList(); one.ActualReturn = ActualReturnCount.Count(); if (one.DemandReturn != 0) { one.ReturnRate = (Math.Round((Convert.ToDouble(one.DemandReturn - one.ActualReturn) * 100 / Convert.ToDouble(one.DemandReturn)), 2)).ToString() + " %"; } else { one.ReturnRate = "0 %"; } string date = begin.Year.ToString() + "-" + begin.Month.ToString().PadLeft(2, '0'); XMAfterSalesData data = base.XMAfterSalesDataService.GetXMAfterSalesDataInfoByMonth(Month, one.CustomerID); if (data != null) { one.ID = data.ID; one.ErrorCount = data.ErrorCount.ToString().Trim(); one.TMIndex = Math.Round((decimal)data.TMIndex, 2) + "%"; one.DSRScore = data.DSRScore.ToString().Trim(); one.ResponseTime = data.ResponseTime.ToString().Trim(); one.JDResponseTime = data.JDResponseTime.ToString().Trim(); one.JDCustomerService = data.JDCustomerService.ToString().Trim(); one.CustomerComplaints = data.CustomerComplaints.ToString().Trim(); one.EvaluationPoints = data.EvaluationPoints.ToString().Trim(); one.ExistXMAfterSalesData = true; } else { one.ID = 0; one.ErrorCount = ""; one.TMIndex = ""; one.DSRScore = ""; one.ResponseTime = ""; one.JDResponseTime = ""; one.JDCustomerService = ""; one.CustomerComplaints = ""; one.EvaluationPoints = ""; one.ExistXMAfterSalesData = false; } return(one); }