//其他部门人员回复问题 // GET: /RecordS/Create public ActionResult Create(Guid id) { Pts_Records modelRecords = new Pts_Records(); modelRecords.ProblemID = id; Department clsDepartment = new Department(); UserProfileModel userprofile = GetMyProfile(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(userprofile.Department), "DeptID", "DeptName"); return View(modelRecords); }
// // GET: /UserProblems/Create public ActionResult Create() { string tid = "1"; string cid = "1"; UserProfileModel userprofile = GetMyProfile(); ViewBag.showAssignTo = userprofile.Department; Department clsDepartment = new Department(); Category clsCategory = new Category(); ViewData["CategoryID"] = new SelectList(clsCategory.getFCategoryList(tid, "", " -- "), "CateId", "CateName", cid); Problems clsProblems = new Problems(); ViewBag.UserNewQuestion = clsProblems.UserNewQuestion(User.Identity.Name); ViewBag.UserSolveQuestion = clsProblems.UserSolveQuestion(User.Identity.Name); return View(); }
public ActionResult Create(Pts_Problems model) { //添加[ValidateInput(false)]特性,否则提交内容有html代码会报错 if (ModelState.IsValid) { UserProfileModel userprofile = GetMyProfile(); Pts_Problems obj = new Pts_Problems(); Pts_Records modelPts_Records = new Pts_Records(); Department clsDepartment = new Department(); obj.ProblemID = Guid.NewGuid(); // CategoryModel category = myService.GetCategoryByID(model.CateId); obj.CreateTime = DateTime.Now; obj.CategoryID = model.CategoryID; obj.Title = Utils.FileterStr(model.Title); obj.Description = Utils.NoHTML(string.IsNullOrWhiteSpace(model.Content) ? "" : model.Content); obj.Content = Server.UrlDecode(Utils.DownloadImages(model.Content, "/Content/Upload/", configinfo.Weburl)); //obj.ip = Utils.GetIP(); obj.CreateUser = User.Identity.Name; obj.StartTime = model.StartTime; obj.CloseTime = model.CloseTime; obj.AssignedTo = "0"; obj.AssignedToUser = "******"; obj.IsStart = true; obj.IsClosed = false; obj.CreatUserName = userprofile.NickName; //回复表中添加记录 modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.AssignTo = "0"; modelPts_Records.AssignToObjectID = "0"; modelPts_Records.AssignType = 0; modelPts_Records.Content = "新提交问题"; modelPts_Records.Describe = "新提交问题"; //modelPts_Records.Title = pts_Records.Title; modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = obj.ProblemID; modelPts_Records.SrcStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.SrcUserID = User.Identity.Name; modelPts_Records.Course = userprofile.NickName + "(客户)-->"; modelPts_Records.ProblemStateID = new Guid("9d536318-d184-40e0-b896-fcea3512286e");//待回复 modelPts_Records.ListOrder = 1; db.Pts_Problems.Add(obj); db.Pts_Records.Add(modelPts_Records); db.SaveChanges(); return RedirectToAction("Index"); } return View(model); }
/// <summary> /// 新增文章 /// </summary> public ActionResult AdminAddProblems() { string tid = "1"; string cid = "1"; UserProfileModel userprofile = GetMyProfile(); ViewBag.showAssignTo = userprofile.Department; Department clsDepartment = new Department(); Category clsCategory = new Category(); ViewData["CategoryID"] = new SelectList(clsCategory.getFCategoryList(tid, "", " -- "), "CateId", "CateName", cid); ViewBag.AssignedTo = new SelectList(clsDepartment.GetDepartmentList(userprofile.Department), "DeptID", "DeptName"); ViewBag.CurrentItem = "t" + tid; if (tid == "4") return View("AdminAlbumAdd"); return View(); }
public ViewResult Details(Guid id) { Category clsCategory = new Category(); List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.CategoryID = catelist.Find(c => c.CateId.ToString() == clsPts_Problems.CategoryID.ToString()).CateName.ToString(); Department clsDepartment = new Department(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); return View(clsPts_Problems); }
public ActionResult AdminRecordsAdd(Pts_Records pts_Records) { try { if (ModelState.IsValid) { Pts_Records modelPts_Records = new Pts_Records(); var NewRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime descending select d).First(); var LastRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime ascending select d).First(); Department clsDepartment = new Department(); UserProfileModel userprofile = GetMyProfile(); if ((pts_Records.AssignType == 1) || (pts_Records.AssignType == 3))//直接解决或者不不解决转交上一个人 { modelPts_Records.AssignTo = "1"; modelPts_Records.AssignToObjectID = NewRecords.CreateUser; modelPts_Records.AssignType = 0; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); if (LastRecords.CreateUser == User.Identity.Name)//第一条记录创建人和当前用户,判断是否是问题提交人 { modelPts_Records.ProblemStateID = new Guid("aa36df43-a68b-45e2-8230-21b2f6f5fce2");//问题已解决 } else { //上一个部门 Guid preDPID=clsDepartment.GetPreDeparmentID(userprofile.Department); modelPts_Records.ProblemStateID = clsDepartment.GetProblemStateReplay(preDPID); } modelPts_Records.SrcUserID = NewRecords.CreateUser; } if (pts_Records.AssignType == 2)//转交其他人 { modelPts_Records.AssignTo = pts_Records.AssignTo; modelPts_Records.AssignToObjectID = pts_Records.AssignToObjectID; modelPts_Records.AssignType = 2; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.ProblemStateID = clsDepartment.GetProblemState(pts_Records.AssignTo); modelPts_Records.SrcUserID = NewRecords.CreateUser; } modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.Content = pts_Records.Content; modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = pts_Records.ProblemID; db.Pts_Records.Add(modelPts_Records); var upDateProblems = (from d in db.Pts_Problems where d.ProblemID == modelPts_Records.ProblemID select d).Single(); upDateProblems.IsStart = false; int result = db.SaveChanges(); return RedirectToAction("Details", "Admin", new { id = modelPts_Records.ProblemID }); } else { return Content("-1"); } } catch (DbEntityValidationException dbEx) { return Content("-1"); } }
public ActionResult AdminAddProblems(Pts_Problems model) { //添加[ValidateInput(false)]特性,否则提交内容有html代码会报错 if (ModelState.IsValid) { UserProfileModel userprofile = GetMyProfile(); Pts_Problems obj = new Pts_Problems(); Pts_Records modelPts_Records = new Pts_Records(); Department clsDepartment = new Department(); obj.ProblemID = Guid.NewGuid(); if (userprofile.Department == "6b0500be-2b97-4dc3-8e22-7d34fa9d0acf")//如果是客户提交问题 { // CategoryModel category = myService.GetCategoryByID(model.CateId); obj.CreateTime = DateTime.Now; obj.CategoryID = model.CategoryID; obj.Title = Utils.FileterStr(model.Title); obj.Description = Utils.NoHTML(string.IsNullOrWhiteSpace(model.Description) ? "" : model.Description); obj.Content = Server.UrlDecode(Utils.DownloadImages(model.Content, "/Content/Upload/", configinfo.Weburl)); //obj.ip = Utils.GetIP(); obj.CreateUser = User.Identity.Name; obj.StartTime = model.StartTime; obj.CloseTime = model.CloseTime; obj.AssignedTo = "0"; obj.AssignedToUser = "******"; obj.IsStart = true; obj.IsClosed = false; //回复表中添加记录 modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.AssignTo = "0"; modelPts_Records.AssignToObjectID = "0"; modelPts_Records.AssignType = 0; modelPts_Records.Content = "新提交问题"; //modelPts_Records.Title = pts_Records.Title; modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = obj.ProblemID; modelPts_Records.SrcStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.SrcUserID = User.Identity.Name; modelPts_Records.Course = userprofile.NickName + "-->"; modelPts_Records.ProblemStateID = new Guid("9d536318-d184-40e0-b896-fcea3512286e");//待回复 } else//其他用户提交问题 { obj.CreateTime = DateTime.Now; obj.CategoryID = model.CategoryID; obj.Title = Utils.FileterStr(model.Title); obj.Description = Utils.NoHTML(string.IsNullOrWhiteSpace(model.Description) ? "" : model.Description); obj.Content = Server.UrlDecode(Utils.DownloadImages(model.Content, "/Content/Upload/", configinfo.Weburl)); //obj.ip = Utils.GetIP(); obj.CreateUser = User.Identity.Name; obj.StartTime = model.StartTime; obj.CloseTime = model.CloseTime; obj.AssignedTo = model.AssignedTo; obj.AssignedToUser = model.AssignedToUser; obj.IsStart = true; obj.IsClosed = false; //回复表中添加记录 modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.AssignTo = model.AssignedTo; modelPts_Records.AssignToObjectID = model.AssignedToUser; modelPts_Records.AssignType = 0; modelPts_Records.Content = "新提交问题"; //modelPts_Records.Title = pts_Records.Title; modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = obj.ProblemID; modelPts_Records.SrcStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.SrcUserID = User.Identity.Name; modelPts_Records.Course = userprofile.NickName+"-->"; //提交问题后状态 modelPts_Records.ProblemStateID = clsDepartment.GetProblemState(model.AssignedTo); } db.Pts_Problems.Add(obj); db.Pts_Records.Add(modelPts_Records); db.SaveChanges(); return RedirectToAction("AdminProblems", new { tid = 1, cid = obj.CategoryID }); } return View(model); }
/// <summary> /// 问题修改 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult AdminEdit(Guid id) { Category clsCategory = new Category(); Department clsDepartment = new Department(); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.AssignedTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName", clsPts_Problems.AssignedTo); ViewData["CategoryID"] = new SelectList(clsCategory.getFCategoryList("1", "", " -- "), "CateId", "CateName", clsPts_Problems.CategoryID); return View(clsPts_Problems); }
public ActionResult UCenter() { Department clsDepartment = new Department(); string avatarFlashParam; string EncodeLocalhost; string Localhost; string uid; int port = Request.Url.Port; string ApplicationPath = Request.ApplicationPath != "/" ? Request.ApplicationPath : string.Empty; uid = User.Identity.Name; Localhost = string.Format("{0}://{1}{2}{3}", Request.Url.Scheme, Request.Url.Host, (port == 80 || port == 0) ? "" : ":" + port, ApplicationPath); EncodeLocalhost = HttpUtility.UrlEncode(Localhost); avatarFlashParam = string.Format("{0}/Content/Avatar/common/camera.swf?nt=1&inajax=1&appid=1&input={1}&ucapi={2}/AjaxAvatar.ashx", Localhost, uid, EncodeLocalhost); ViewBag.avatarFlashParam = avatarFlashParam; ViewBag.Localhost = Localhost; ViewBag.uid = uid; UserProfileModel userprofile = GetMyProfile(); ViewBag.GenderInfo = WebUtils.GetGenderList().Find(delegate(SelectItem item) { return item.Value == userprofile.Gender; }).Key; ViewBag.Department = clsDepartment.GetDepartmentName(userprofile.Department); return View(userprofile); }
public ActionResult MyProfile() { Department clsDepartment = new Department(); ViewBag.CI = configinfo; ViewData["Gender"] = new SelectList(WebUtils.GetGenderList(), "Value", "Key", GetProfileItem("gender", "1")); UserProfileModel userprofile = GetMyProfile(); userprofile.Intro = Utils.RemoveHtml(WebUtils.HtmlToUBB(userprofile.Intro)); userprofile.Signature = Utils.RemoveHtml(WebUtils.HtmlToUBB(userprofile.Signature)); ViewBag.Department = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); return PartialView("_UserProfile", userprofile); }
public ActionResult Create(Pts_Records pts_Records) { try { if (ModelState.IsValid) { Pts_Records modelPts_Records = new Pts_Records(); var NewRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime descending select d).First(); var LastRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime ascending select d).First(); var upDateProblems = (from d in db.Pts_Problems where d.ProblemID == pts_Records.ProblemID select d).Single(); Department clsDepartment = new Department(); UserProfileModel userprofile = GetMyProfile(); if ((pts_Records.AssignType == 1) || (pts_Records.AssignType == 3))//直接解决或者不不解决转交上一个人 { modelPts_Records.AssignTo = "1"; modelPts_Records.AssignType = 0; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); //根据问题最终处理人 if (NewRecords.Pts_ProblemState.ListOrder==1) { upDateProblems.SolveUser = User.Identity.Name; } if (LastRecords.CreateUser == User.Identity.Name || (GetUserDP(User.Identity.Name) == "bbf977d8-aeab-4bec-b070-a3d1c1b41cb5"))//第一条记录创建人和当前用户,判断是否是问题提交人GetUserDP(ReplayRecords.CreateUser) { modelPts_Records.AssignToObjectID = userprofile.NickName; modelPts_Records.ProblemStateID = new Guid("aa36df43-a68b-45e2-8230-21b2f6f5fce2");//问题已解决 modelPts_Records.Course = "-->" + userprofile.NickName; upDateProblems.IsClosed = true; } else { //上一个部门 Guid preDPID = clsDepartment.GetPreDeparmentID(userprofile.Department); if (NewRecords.Pts_ProblemState.IsState == 2)//最新一条记录状态为待确定的 { //获取当前记录的隔一条记录 var ReplayRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID && (d.ListOrder == NewRecords.ListOrder - 2) orderby d.CreateTime descending select d).First(); if (ReplayRecords.Pts_ProblemState.IsState == 2) {//解决打回问题 var ReplayRecordsDH = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID && (d.ListOrder == ReplayRecords.ListOrder - 2) orderby d.CreateTime descending select d).First(); modelPts_Records.AssignToObjectID = ReplayRecordsDH.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(GetUserDP(ReplayRecordsDH.CreateUser)) + "(" + GetUserProfile(ReplayRecordsDH.CreateUser) + ")"; } else { modelPts_Records.AssignToObjectID = ReplayRecords.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(GetUserDP(ReplayRecords.CreateUser)) + "(" + GetUserProfile(ReplayRecords.CreateUser) + ")"; } } else { modelPts_Records.AssignToObjectID = NewRecords.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(preDPID.ToString()) + "(" + GetUserProfile(NewRecords.CreateUser) + ")"; } modelPts_Records.ProblemStateID = clsDepartment.GetProblemStateReplay(preDPID); } modelPts_Records.SrcUserID = NewRecords.CreateUser; } if (pts_Records.AssignType == 2)//转交其他人 { modelPts_Records.AssignTo = pts_Records.AssignTo; modelPts_Records.AssignToObjectID = pts_Records.AssignToObjectID; modelPts_Records.AssignType = 2; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.ProblemStateID = clsDepartment.GetProblemState(pts_Records.AssignTo); modelPts_Records.SrcUserID = NewRecords.CreateUser; //提交问题记录相关信息 if (pts_Records.AssignToObjectID == "0") { modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(pts_Records.AssignTo) + "(部门所有人)"; } else { modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(pts_Records.AssignTo) + "(" + GetUserProfile(pts_Records.AssignToObjectID) + ")"; } } modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.Content = pts_Records.Content; modelPts_Records.Describe = Utils.NoHTML(string.IsNullOrWhiteSpace(pts_Records.Content) ? "" : pts_Records.Content); modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = pts_Records.ProblemID; modelPts_Records.ListOrder = NewRecords.ListOrder + 1; modelPts_Records.ResponseTotalTime = Utils.TimeDifference(NewRecords.CreateTime); db.Pts_Records.Add(modelPts_Records); //更新问题表待调整 upDateProblems.IsStart = false; upDateProblems.HandlingUser = modelPts_Records.AssignToObjectID; upDateProblems.ProblemStateID = modelPts_Records.ProblemStateID; int result = db.SaveChanges(); return RedirectToAction("Details", "Problems", new { id = modelPts_Records.ProblemID }); } else { return Content("-1"); } } catch (DbEntityValidationException dbEx) { return Content("-1"); } }
public ActionResult YFCreate(Pts_Records pts_Records) { try { if (ModelState.IsValid) { Pts_Records modelPts_Records = new Pts_Records(); var NewRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime descending select d).First(); var LastRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID orderby d.CreateTime ascending select d).First(); var upDateProblems = (from d in db.Pts_Problems where d.ProblemID == pts_Records.ProblemID select d).Single(); Department clsDepartment = new Department(); UserProfileModel userprofile = GetMyProfile(); if ((pts_Records.AssignType == 1) || (pts_Records.AssignType == 3))//直接解决或者不不解决转交上一个人 { modelPts_Records.AssignTo = "1"; modelPts_Records.AssignType = 0; //根据问题最终处理人 upDateProblems.SolveUser = User.Identity.Name; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); if (LastRecords.CreateUser == User.Identity.Name)//第一条记录创建人和当前用户,判断是否是问题提交人 { modelPts_Records.AssignToObjectID = NewRecords.CreateUser; modelPts_Records.ProblemStateID = new Guid("aa36df43-a68b-45e2-8230-21b2f6f5fce2");//问题已解决 modelPts_Records.Course = "-->" + userprofile.NickName; upDateProblems.IsClosed = true; } else { //上一个部门 Guid preDPID = clsDepartment.GetPreDeparmentID(userprofile.Department); if (NewRecords.Pts_ProblemState.IsState == 2)//最新一条记录状态为待确定的 { //获取当前记录的隔一条记录 var ReplayRecords = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID && (d.ListOrder == NewRecords.ListOrder - 1) orderby d.CreateTime descending select d).First(); //不存在此情况 if (ReplayRecords.Pts_ProblemState.IsState == 2) {//解决打回问题 var ReplayRecordsDH = (from d in db.Pts_Records where d.ProblemID == pts_Records.ProblemID && (d.ListOrder == ReplayRecords.ListOrder - 2) orderby d.CreateTime descending select d).First(); modelPts_Records.AssignToObjectID = ReplayRecordsDH.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(GetUserDP(ReplayRecordsDH.CreateUser)) + "(" + GetUserProfile(ReplayRecordsDH.CreateUser) + ")"; } else { modelPts_Records.AssignToObjectID = ReplayRecords.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(GetUserDP(ReplayRecords.CreateUser)) + "(" + GetUserProfile(ReplayRecords.CreateUser) + ")"; } } else { modelPts_Records.AssignToObjectID = NewRecords.CreateUser; modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(preDPID.ToString()) + "(" + GetUserProfile(NewRecords.CreateUser) + ")"; } modelPts_Records.ProblemStateID = clsDepartment.GetProblemStateReplay(preDPID); } modelPts_Records.SrcUserID = NewRecords.CreateUser; modelPts_Records.ListOrder = NewRecords.ListOrder +1; } if (pts_Records.AssignType == 2)//转交其他人 { modelPts_Records.AssignTo = "2ba34c68-9c2c-4e06-9e17-ecd2e1156438";//部门研发 modelPts_Records.AssignToObjectID = User.Identity.Name; modelPts_Records.AssignType = 2; modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.ProblemStateID = new Guid("9c3f96c9-1869-41c4-92f5-f81c5f3e6e5c");//研发中 modelPts_Records.SrcUserID = NewRecords.CreateUser; modelPts_Records.YFWay = pts_Records.YFWay; modelPts_Records.YFTime = pts_Records.YFTime; //提交问题记录相关信息 modelPts_Records.Course = "--研发中:预计时间(" + string.Format("{0:d}", pts_Records.YFTime) + ")--"; //研发状态特殊处理 modelPts_Records.ListOrder = NewRecords.ListOrder +1; } modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.Content = pts_Records.Content; modelPts_Records.Describe = Utils.NoHTML(string.IsNullOrWhiteSpace(pts_Records.Content) ? "" : pts_Records.Content); modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = pts_Records.ProblemID; modelPts_Records.ResponseTotalTime = Utils.TimeDifference(NewRecords.CreateTime); db.Pts_Records.Add(modelPts_Records); //更新问题表待调整 upDateProblems.IsStart = false; upDateProblems.HandlingUser = modelPts_Records.AssignToObjectID; upDateProblems.ProblemStateID = modelPts_Records.ProblemStateID; int result = db.SaveChanges(); return RedirectToAction("Details", "Problems", new { id = modelPts_Records.ProblemID }); } else { return Content("-1"); } } catch (DbEntityValidationException dbEx) { return Content("-1"); } }
public ActionResult Create(Pts_Problems model) { //添加[ValidateInput(false)]特性,否则提交内容有html代码会报错 if (ModelState.IsValid) { UserProfileModel userprofile = GetMyProfile(); Pts_Problems obj = new Pts_Problems(); Pts_Records modelPts_Records = new Pts_Records(); Department clsDepartment = new Department(); obj.ProblemID = Guid.NewGuid(); obj.CreateTime = DateTime.Now; obj.CategoryID = model.CategoryID; obj.Title = Utils.FileterStr(model.Title); obj.Description = Utils.NoHTML(string.IsNullOrWhiteSpace(model.Description) ? "" : model.Description); obj.Content = Server.UrlDecode(Utils.DownloadImages(model.Content, "/Content/Upload/", configinfo.Weburl)); //obj.ip = Utils.GetIP(); obj.CreateUser = User.Identity.Name; obj.StartTime = model.StartTime; obj.CloseTime = model.CloseTime; obj.AssignedTo = model.AssignedTo; obj.AssignedToUser = model.AssignedToUser; obj.IsStart = true; obj.IsClosed = false; obj.HandlingUser = model.AssignedToUser; obj.CreatUserName = userprofile.NickName; //回复表中添加记录 modelPts_Records.RecordID = Guid.NewGuid(); modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.AssignTo = model.AssignedTo; modelPts_Records.AssignToObjectID = model.AssignedToUser; modelPts_Records.AssignType = 0; modelPts_Records.Content = "新提交问题"; //modelPts_Records.Title = pts_Records.Title; modelPts_Records.CreateUser = User.Identity.Name; modelPts_Records.CreateTime = DateTime.Now; modelPts_Records.ProblemID = obj.ProblemID; modelPts_Records.SrcStateID = new Guid("00000000-0000-0000-0000-000000000000"); modelPts_Records.SrcUserID = User.Identity.Name; modelPts_Records.Describe = "新提交问题"; modelPts_Records.ListOrder = 1; //提交问题记录相关信息 if (model.AssignedToUser == "0") { modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(model.AssignedTo) + "(部门所有人)"; } else { modelPts_Records.Course = userprofile.NickName + "-->" + clsDepartment.GetDepartmentName(model.AssignedTo) + "(" + GetUserProfile(model.AssignedToUser) + ")"; } //提交问题后状态 modelPts_Records.ProblemStateID = clsDepartment.GetProblemState(model.AssignedTo); obj.ProblemStateID = clsDepartment.GetProblemState(model.AssignedTo);//问题表中状态 db.Pts_Problems.Add(obj); db.Pts_Records.Add(modelPts_Records); db.SaveChanges(); return RedirectToAction("Index", new { tid = 1, cid = obj.CategoryID }); } return View(model); }
// // GET: /Problems/Details/5 public ViewResult Details(Guid id) { var NewRecords = (from d in db.Pts_Records where d.ProblemID == id orderby d.CreateTime descending select d).First(); Category clsCategory = new Category(); UserProfileModel userprofile = GetMyProfile(); List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.CategoryID = catelist.Find(c => c.CateId.ToString() == clsPts_Problems.CategoryID.ToString()).CateName.ToString(); Department clsDepartment = new Department(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); ViewBag.Department = userprofile.Department; //显示修改按钮相关 Problems clsProblems = new Problems(); ViewBag.Edit = NewRecords.ProblemStateID.ToString() == "9c3f96c9-1869-41c4-92f5-f81c5f3e6e5c" ? "1" : "0"; return View(clsPts_Problems); }
// // GET: /UserProblems/Details/5 public ViewResult Details(Guid id) { var NewRecords = (from d in db.Pts_Records where d.ProblemID == id orderby d.CreateTime descending select d).First(); Category clsCategory = new Category(); UserProfileModel userprofile = GetMyProfile(); List<CategoryModel> catelist = clsCategory.getFCategoryList("1", "", " -- "); Pts_Problems clsPts_Problems = db.Pts_Problems.Find(id); ViewBag.CategoryID = catelist.Find(c => c.CateId.ToString() == clsPts_Problems.CategoryID.ToString()).CateName.ToString(); Department clsDepartment = new Department(); ViewBag.AssignTo = new SelectList(clsDepartment.GetDepartmentList(), "DeptID", "DeptName"); ViewBag.Department = userprofile.Department; //显示修改按钮相关 Problems clsProblems = new Problems(); ViewBag.UserNewQuestion = clsProblems.UserNewQuestion(User.Identity.Name); ViewBag.UserSolveQuestion = clsProblems.UserSolveQuestion(User.Identity.Name); return View(clsPts_Problems); }