using BatchService.Framework.Utility; using PalGain.Core; using sbcLabSystem.Data.Domain.Account; using sbcLabSystem.Models.Backstage; using sbcLabSystem.Models.Home; using sbcLabSystem.Service.Account; using sbcLabSystem.Service.QC; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using sbcLabSystem.App_Start.Attribute; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace sbcLabSystem.Controllers { public class UserUIController : BaseController { // // GET: /UserUI/ private AccountService m_AccountService; private QCService _qcService; public UserUIController(AccountService _AccountService, QCService i_qcService) { _qcService = i_qcService; this.m_AccountService = _AccountService; } [UserLogin] public ActionResult Index() { return View(); } [UserLogin] public ActionResult ContactUs() { UserRequestInfo ent = new UserRequestInfo(); string id = Cookie.GetValue("login_user"); if (string.IsNullOrEmpty(id) == false && int.Parse(id) > 0) { ent = m_AccountService.UserRequestInfo(int.Parse(id)); } EmeilInfoModel viewModel = new EmeilInfoModel(); if (ent != null) { viewModel.EmileName = ent.ManagerEmail; } return View(viewModel); } [UserLogin] public ActionResult ModifyUserPwd() { UserRequestInfoModel viewModel = new UserRequestInfoModel() { LabPassword = "", LabName = "" }; return View(viewModel); } [UserLogin] public ActionResult SeveModifyUserPwd(UserRequestInfoModel info) { if (info != null && string.IsNullOrEmpty(info.LabPassword) == false) { string id = Cookie.GetValue("login_user"); if (string.IsNullOrEmpty(id) == false && int.Parse(id) > 0) { UserRequestInfo ent = m_AccountService.UserRequestInfo(int.Parse(id)); if (ent.LabPassword == info.LabPassword) { ent.LabPassword = info.LabName; m_AccountService.UpdateUserRequestInfo(ent); LogHelper.Debug(ent.LabCode + "用户请求修改密码成功"); return Json("ok"); } else { return Json("1"); } } } return Json("no"); } [UserLogin] public ActionResult introduce() { UserRequestInfoModel viewModel = new UserRequestInfoModel(); string id = Cookie.GetValue("login_user"); if (string.IsNullOrEmpty(id) == false && int.Parse(id) > 0) { viewModel = UserRequestInfoModel.FromEntity(m_AccountService.UserRequestInfo(int.Parse(id))); } viewModel.LabPassword = ""; return View(viewModel); } [UserLogin] public ActionResult AgainRegister() { UserRequestInfoModel viewModel = new UserRequestInfoModel(); string id = Cookie.GetValue("login_user"); if (string.IsNullOrEmpty(id) == false && int.Parse(id) > 0) { viewModel = UserRequestInfoModel.FromEntity(m_AccountService.UserRequestInfo(int.Parse(id))); } viewModel.LabPassword = ""; viewModel.ProjectId = 0; return View(viewModel); } [UserLogin] public ActionResult SeveAgainRegister(UserRequestInfo info) { info.UpdateTime = DateTime.Now; m_AccountService.UpdateUserRequestInfo(info); _qcService.SendMail(info.Id, 11); return Json("ok"); } [UserLogin] public ActionResult Process() { ShowPageViewModel viewModel = new ShowPageViewModel(int.Parse(Cookie.GetValue("login_user"))); viewModel.RegList.ForEach(x => { x.AnswerInfo = null; x.AnswerJSON = ""; }); return View(viewModel); } public ActionResult PdfPrint(int qcDistId, int LabId) { try { int loginId = 0; if (!string.IsNullOrEmpty(Cookie.GetValue("login_user"))) { loginId = int.Parse(Cookie.GetValue("login_user")); } if (loginId == 0) { loginId = LabId; } ShowPageViewModel viewModel = new ShowPageViewModel(qcDistId, loginId); return View(viewModel); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } return View(""); } [ValidateInput(false)] public ActionResult PdfPrint2(int qcDistId, string html, int? LabId) { var jsonObj = JsonConvert.DeserializeObject(html) as JObject; string html2 = jsonObj["html"].Value(); if (LabId.GetValueOrDefault() == 0) { LabId = int.Parse(Cookie.GetValue("login_user")); } ShowPageViewModel viewModel = new ShowPageViewModel(qcDistId, LabId.GetValueOrDefault()); this.RenderToPDF(html2, Server.MapPath("/fonts/SIMFANG.TTF")); return Json(""); } [UserLogin] public ActionResult ShowPage(int qcDistId) { ShowPageViewModel viewModel = new ShowPageViewModel(qcDistId, int.Parse(Cookie.GetValue("login_user"))); #region ABO if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_11_1)) { viewModel.RegInfo.AnswerInfo.Result_11_1 = "cb7_Right116"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_11_2)) { viewModel.RegInfo.AnswerInfo.Result_11_2 = "cb7_Right216"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_11_3)) { viewModel.RegInfo.AnswerInfo.Result_11_3 = "cb7_Right316"; } #endregion #region RH if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_12_1)) { viewModel.RegInfo.AnswerInfo.Result_12_1 = "cb7_Right124"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_12_2)) { viewModel.RegInfo.AnswerInfo.Result_12_2 = "cb7_Right224"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_12_3)) { viewModel.RegInfo.AnswerInfo.Result_12_3 = "cb7_Right324"; } #endregion #region ss1 if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_31_1)) { viewModel.RegInfo.AnswerInfo.Result_31_1 = "cb8_161"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_31_2)) { viewModel.RegInfo.AnswerInfo.Result_31_2 = "cb8_261"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_31_3)) { viewModel.RegInfo.AnswerInfo.Result_31_3 = "cb8_361"; } #endregion #region ss2 if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_32_1)) { viewModel.RegInfo.AnswerInfo.Result_32_1 = "cb8_162"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_32_2)) { viewModel.RegInfo.AnswerInfo.Result_32_2 = "cb8_262"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_32_3)) { viewModel.RegInfo.AnswerInfo.Result_32_3 = "cb8_362"; } #endregion #region ss3 if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_33_1)) { viewModel.RegInfo.AnswerInfo.Result_33_1 = "cb8_163"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_33_2)) { viewModel.RegInfo.AnswerInfo.Result_33_2 = "cb8_263"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_33_3)) { viewModel.RegInfo.AnswerInfo.Result_33_3 = "cb8_363"; } #endregion #region sb if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_21_1)) { viewModel.RegInfo.AnswerInfo.Result_21_1 = "cb10_135"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_21_2)) { viewModel.RegInfo.AnswerInfo.Result_21_2 = "cb10_235"; } if (string.IsNullOrEmpty(viewModel.RegInfo.AnswerInfo.Result_21_3)) { viewModel.RegInfo.AnswerInfo.Result_21_3 = "cb10_335"; } #endregion return View(viewModel); } [UserLogin] public ActionResult saveAnswerInfo(QCDistributionRegisterInfoViewModel viewModel) { try { var entity = QCDistributionRegisterInfoViewModel.ToEntity(viewModel); entity.ModifyUser = "admin"; entity.ModifyTime = DateTime.Now; _qcService.SaveQcDistributionRegister(entity); return Json(viewModel, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); } return Json(viewModel, JsonRequestBehavior.AllowGet); } [UserLogin] public ActionResult LogOut() { Cookie.Remove("login_user"); return Json("ok"); } } }