Ejemplo n.º 1
0
 //其他部门人员回复问题
 // 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);
 }
 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);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取相关的回复信息
 /// </summary>
 /// <param name="problemId"></param>
 /// <returns></returns>
 public Pts_Records geRecordsProcessing(Guid problemId)
 {
     Pts_Records modelRecords = new Pts_Records();
     var problems = (from d in db.Pts_Problems
                     where d.ProblemID == problemId
                     select d).Single();
     if (problems.IsStart == true)
     {
         modelRecords.SrcUserID = problems.CreateUser;
     }
     else
     {
         var records = (from d in db.Pts_Records
                        where d.ProblemID == problemId
                        orderby d.CreateTime descending
                        select d).First();
         modelRecords.SrcUserID = records.SrcUserID;
     }
     return modelRecords;
 }
Ejemplo n.º 4
0
        public ActionResult Details(FormCollection pts_Records)
        {
            try
            {
                if (ModelState.IsValid)
                {

                    //SqlParameter[] parms = new SqlParameter[1];
                    //parms[0] = new SqlParameter("@ProblemID", pts_Records["ProblemID"]);
                    //int results = db.Database.ExecuteSqlCommand("exec SP_Problems_IsStart_Update @ProblemID", parms);

                    Pts_Records modelPts_Records = new Pts_Records();
                    //  EntityState statebefore = db.Entry(modelPts_Recordsmodel).State;
                    modelPts_Records.RecordID = Guid.NewGuid();
                    modelPts_Records.AssignStateID = new Guid("00000000-0000-0000-0000-000000000000");
                    modelPts_Records.AssignTo = pts_Records["AssignTo"];
                    modelPts_Records.AssignToObjectID = "bbbbbbbb";
                    modelPts_Records.AssignType = Convert.ToInt32(pts_Records["AssignType"]);
                    modelPts_Records.Content = pts_Records["Content"];
                    //modelPts_Records.Title = pts_Records.Title;
                    modelPts_Records.CreateUser = User.Identity.Name;
                    modelPts_Records.CreateTime = DateTime.Now;
                    modelPts_Records.ProblemID = new Guid(pts_Records["ProblemID"]);
                    modelPts_Records.SrcStateID = new Guid("00000000-0000-0000-0000-000000000000");
                    modelPts_Records.SrcUserID = pts_Records["LastUser"] == null ? "000" : pts_Records["LastUser"]; ;
                    modelPts_Records.ProblemStateID = new Guid("9d536318-d184-40e0-b896-fcea3512286e");
                    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();
                    //  EntityState stateafter = db.Entry(modelPts_Recordsmodel).State;
                    return RedirectToAction("Details", "Admin", new { id = modelPts_Records.ProblemID });

                }
                else
                {
                    return Content("-1");
                }
            }
            catch (DbEntityValidationException dbEx)
            {
                return Content("-1");
            }
        }
Ejemplo n.º 5
0
 public ActionResult AdminRecordsCreate(Guid id)
 {
     Pts_Records modelPts_Records = new Pts_Records();
     modelPts_Records.ProblemID = id;
     return PartialView("AdminRecordsCreate", modelPts_Records);
 }
Ejemplo n.º 6
0
        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");
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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");
            }
        }
Ejemplo n.º 9
0
        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");
            }
        }
Ejemplo n.º 10
0
 public ActionResult Edit(Pts_Records pts_records)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pts_records).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.ProblemID = new SelectList(db.Pts_Problems, "ProblemID", "Title", pts_records.ProblemID);
     ViewBag.ProblemStateID = new SelectList(db.Pts_ProblemState, "ProblemStateID", "StateName", pts_records.ProblemStateID);
     return View(pts_records);
 }
Ejemplo n.º 11
0
        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);
        }