public ActionResult QRCode(string MainID) { ViewBag.Title = "客户评价二维码"; int ID = int.Parse(MainID); WXSaleAfterMain main = entity.WXSaleAfterMain.Where(p => p.ID == ID).FirstOrDefault(); if (main.IsFinish == "是") { ViewBag.Content = "已完成评价!"; return(View("Done")); } string url = "http://" + HttpContext.Request.Url.Host + ":" + "/Home/Assessment?MainID=" + MainID; //HttpContext.Request.Url.Port + QRCodeGenerator qrcg = new QRCodeGenerator(); QRCodeData qrcd = qrcg.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q); QRCode qrc = new QRCode(qrcd); Bitmap bit = qrc.GetGraphic(10, Color.Black, Color.White, true); //Graphics g = Graphics.FromImage(bit); MemoryStream ms = new MemoryStream(); bit.Save(ms, ImageFormat.Png); Response.ClearContent(); Response.ContentType = "image/png"; Response.BinaryWrite(ms.ToArray()); return(View()); }
public ActionResult WorkNote(WXSaleAfterWorkNote note, string IsDone) { entity.WXSaleAfterWorkNote.Add(note); entity.SaveChanges(); if (IsDone == "是") { WXSaleAfterMain main = entity.WXSaleAfterMain.Where(p => p.ID == note.MainID).FirstOrDefault(); //MO mo = entity.MO.Where(p => p.MOId == main.MoID).FirstOrDefault(); Ter_Customer_Com_Records tccr = entity.Ter_Customer_Com_Records.Where(p => p.MOName == main.MoID).FirstOrDefault(); tccr.ProblemCompletion = "完成"; entity.SaveChanges(); return(new RedirectResult("/Home/QRCode?MainID=" + note.MainID)); } else { ViewBag.Content = "已记录!"; return(View("Done")); } }
public ActionResult Assessment(WXSaleAfterAssessment assessment) { WXSaleAfterAssessment _assessment = entity.WXSaleAfterAssessment.Where(p => p.MainID == assessment.MainID).FirstOrDefault(); if (_assessment == null) { assessment.AssessmentDate = DateTime.Now; entity.WXSaleAfterAssessment.Add(assessment); entity.SaveChanges(); WXSaleAfterMain main = entity.WXSaleAfterMain.Where(p => p.ID == assessment.MainID).FirstOrDefault(); main.IsFinish = "是"; //MO mo = entity.MO.Where(p => p.MOId == main.MoID).FirstOrDefault(); Ter_Customer_Com_Records tccr = entity.Ter_Customer_Com_Records.Where(p => p.MOName == main.MoID).FirstOrDefault(); if (tccr == null) { ViewBag.Content = "工单号对应的售后单不存在!"; return(View("Done")); } AfterWorkSchedule aws = entity.AfterWorkSchedule.Where(p => p.Ter_Customer_Com_RecordId == tccr.Ter_Customer_Com_RecordsId).FirstOrDefault(); aws.AfterSalesEvaluation = assessment.SaleAfterAssessment; entity.SaveChanges(); ViewBag.Content = "已完成评价!"; return(View("Done")); } else { WXSaleAfterMain main = entity.WXSaleAfterMain.Where(p => p.ID == _assessment.MainID).FirstOrDefault(); main.IsFinish = "是"; entity.SaveChanges(); ViewBag.Content = "已进行过评价!"; return(View("Done")); } }
public ActionResult Index(WXSaleAfterMain main) { ObjectParameter ftpparameter = new ObjectParameter("PKID", typeof(string)); entity.SysGetObjectPKId(null, "FtpFile", ftpparameter); if (Request.Files.Count > 0 && !string.IsNullOrEmpty(Request.Files[0].FileName)) { Request.Files[0].SaveAs(Server.MapPath("~/App_Data/") + Request.Files[0].FileName); int lastindex = Request.Files[0].FileName.LastIndexOf("."); string postfix = Request.Files[0].FileName.Substring(lastindex); try { FTPHelper.FtpUploadBroken(Server.MapPath("~/App_Data/") + Request.Files[0].FileName, "MesSaleAfter", (string)ftpparameter.Value + postfix); main.Filename = (string)ftpparameter.Value + postfix; } catch (Exception ex) { ViewBag.Content = ex.Message; return(View("Done")); } } entity.WXSaleAfterMain.Add(main); entity.SaveChanges(); if (main.ServiceReason == "故障检查维修" || main.ServiceReason == "安装调试" || main.ServiceReason == "日常回访" || main.ServiceReason == "其他") { if (main.IsXJR == "否") { ObjectParameter parameter = new ObjectParameter("PKID", typeof(string)); entity.SysGetObjectPKId(null, "Ter_Customer_Com_Records", parameter); Ter_Customer_Com_Records tccr = new Ter_Customer_Com_Records(); tccr.Ter_Customer_Com_RecordsId = (string)parameter.Value; tccr.MOName = main.MoID; if (!string.IsNullOrEmpty(main.MoID)) { MO mo = entity.MO.Where(p => p.MOName == main.MoID).FirstOrDefault(); //tccr.MOName = mo.MOName; if (mo != null) { tccr.MachineNo = mo.SAP_CHARG; } } int serialNumber = (int)entity.Ter_Customer_Com_Records.Max(p => p.SerialNumber); tccr.SerialNumber = serialNumber + 1; tccr.ComplaintTime = DateTime.Now; tccr.ComplaintContent = main.ProblemDescription; tccr.CustomerAddress = main.CustomerAddress; tccr.CustomerContact = main.CustomerContact + "," + main.CustomerPhone; tccr.CustomerName = main.CustomerName; tccr.DefectType = main.ProblemType; tccr.CustomerId = main.ID.ToString(); tccr.ProblemCompletion = "进行中"; tccr.CreateDate = DateTime.Now; tccr.WorkflowStepId = "WFS10000033Z"; tccr.WorkflowStatus = "1"; if (!string.IsNullOrEmpty(main.Filename)) { FtpFile ftpfile = new FtpFile(); ftpfile.FtpFileId = (string)ftpparameter.Value; ftpfile.FtpFileName = main.Filename; ftpfile.FtpDirectory = ""; ftpfile.FtpFileSize = 0; ftpfile.PluginCommand = "TCCR"; ftpfile.UploadUser = main.UserName; ftpfile.UploadComputer = ""; ftpfile.CreateDate = DateTime.Now; ftpfile.PKId = (string)parameter.Value; entity.FtpFile.Add(ftpfile); tccr.ImageID = (string)ftpparameter.Value; } entity.Ter_Customer_Com_Records.Add(tccr); entity.SaveChanges(); } else { ObjectParameter parameter = new ObjectParameter("PKID", typeof(string)); entity.SysGetObjectPKId(null, "Q_issue_Rec_ForCustomer", parameter); Q_issue_Rec_ForCustomer qirf = new Q_issue_Rec_ForCustomer(); qirf.Q_issue_Rec_ForCustomerId = (string)parameter.Value; qirf.OrderName = main.MoID; if (!string.IsNullOrEmpty(main.MoID)) { MO mo = entity.MO.Where(p => p.MOName == main.MoID).FirstOrDefault(); ///qirf.OrderName = mo.MOName; if (mo != null) { qirf.MachineNo = mo.SAP_CHARG; } } qirf.CustomerId = "CUS10000027Y"; ProductRoot pr = entity.ProductRoot.Where(p => p.ProductName == main.ProductID).FirstOrDefault(); if (pr != null) { qirf.ProductID = pr.DefaultProductId; } qirf.FeedbackDate = DateTime.Now; qirf.IssueDesc = main.ProblemDescription; if (!string.IsNullOrEmpty(main.Filename)) { FtpFile ftpfile = new FtpFile(); ftpfile.FtpFileId = (string)ftpparameter.Value; ftpfile.FtpFileName = main.Filename; ftpfile.FtpDirectory = ""; ftpfile.FtpFileSize = 0; ftpfile.PluginCommand = "QIRF"; ftpfile.UploadUser = main.UserName; ftpfile.UploadComputer = ""; ftpfile.CreateDate = DateTime.Now; ftpfile.PKId = (string)parameter.Value; entity.FtpFile.Add(ftpfile); qirf.Image4ID = (string)ftpparameter.Value; } qirf.WorkflowStepId = "WFS10000033X"; qirf.WorkflowStatus = "1"; entity.Q_issue_Rec_ForCustomer.Add(qirf); entity.SaveChanges(); } } ViewBag.Content = "添加售后维护单成功!"; return(View("Done")); }