// protected void btnPassOnclick(object sender, EventArgs e) { using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == this.hidProjectId.Value.ToString() select p).First(); if (this.Request["mode"] == "check") { ThisProject.signer = this.LoginUserInfo.Identity; ThisProject.CheckDate = DateTime.Now; ThisProject.CheckNote = this.txtCheckNote.Text; ThisProject.progress = "等待执行"; } else if (this.Request["mode"] == "helpexecute") { ThisProject.helper = this.LoginUserInfo.Identity; ThisProject.HelperFinishDate = DateTime.Now; ThisProject.HelperFinishNote = this.txtHelperFinishNote.Text; } else if (this.Request["mode"] == "pic") { ThisProject.PicProducer = this.LoginUserInfo.Identity; ThisProject.PicFinishDate = DateTime.Now; ThisProject.PicFinishNote = this.txtPicFinishNote.Text; } else if (this.Request["mode"] == "template") { ThisProject.TemplateProducer = this.LoginUserInfo.Identity; ThisProject.TemplateFinishDate = DateTime.Now; ThisProject.TemplateFinishNote = this.txtTemplateFinishNote.Text; } else if (this.Request["mode"] == "attachment") { ThisProject.AttachmentProducer = this.LoginUserInfo.Identity; ThisProject.AttachmentFinishDate = DateTime.Now; ThisProject.AttachmentFinishNote = this.txtAttachmentFinishNote.Text; } else if (this.Request["mode"] == "mchelpexecute") { ThisProject.McHelper = this.LoginUserInfo.Identity; ThisProject.McHelperFinishDate = DateTime.Now; //ThisProject.AttachmentFinishNote = this.txtAttachmentFinishNote.Text; } ProjectModel.SaveChanges(); } this.Redirect("~/pages/MyTask.aspx?mode=manufacture&range=now"); }
// protected void btnDelOnclick(object sender, EventArgs e) { using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == this.hidProjectId.Value.ToString() select p).First(); if (ThisProject != null) { //ProjectModel.BatchProject.Remove(ThisProject); ThisProject.progress = "作废"; } var i = ProjectModel.SaveChanges(); } this.Redirect("~/pages/MyTask.aspx?mode=manufacture&range=now"); }
// protected void gvProject_RowDataBound(object sender, GridViewRowEventArgs e) { string ID = ""; string PageIndex = gvProject.PageIndex.ToString(); int count = gvProject.Rows.Count; for (int i = 0; i < count; i++) { ID = gvProject.DataKeys[i].Value.ToString(); HyperLink CurrentLink = (HyperLink)gvProject.Rows[i].FindControl("aSelect"); //CurrentLink.NavigateUrl = "~/pages/CustomTaskDetails.aspx?mode=" + this.Request["mode"] + "&id=" + ID; string encode = string.Empty; byte[] bytes = Encoding.UTF8.GetBytes(this.LoginUserInfo.LoginName + "_" + this.LoginUserInfo.Password); encode = HttpUtility.UrlEncode(Convert.ToBase64String(bytes), Encoding.UTF8); using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == ID select p).First(); if (this.Request["mode"] == "check") { CurrentLink.NavigateUrl = "~/pages/CustomTaskDetails.aspx?mode=" + this.Request["mode"] + "&id=" + ID; } else if (this.Request["mode"] == "execute") { CurrentLink.NavigateUrl = "http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=disposal&project=" + ThisProject.id + "&login="******"mode"] == "helpexecute") { CurrentLink.NavigateUrl = "~/pages/CustomTaskDetails.aspx?mode=" + this.Request["mode"] + "&id=" + ID; } else if (this.Request["mode"] == "mchelpexecute") { CurrentLink.NavigateUrl = "~/pages/CustomTaskDetails.aspx?mode=" + this.Request["mode"] + "&id=" + ID; } else { CurrentLink.NavigateUrl = "~/pages/CustomTaskDetails.aspx?mode=" + this.Request["mode"] + "&id=" + ID; } } } }
// protected void btnExecuteOnclick(object sender, EventArgs e) { using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == this.hidProjectId.Value.ToString() select p).First(); if (ThisProject.progress == "等待执行") { string encode = string.Empty; byte[] bytes = Encoding.UTF8.GetBytes(this.LoginUserInfo.LoginName + "_" + this.LoginUserInfo.Password); encode = Convert.ToBase64String(bytes); Response.Write("<script>window.open('http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=disposal&project=" + ThisProject.id + "&login="******"','_blank');</script>"); } else { //btnExecute.Text = "已处理"; } } }
// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } // string id = this.Request["id"]; this.hidProjectId.Value = id; using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == id select p).First(); this.InitBrowseData(ThisProject); // #region browse if (this.Request["mode"] == "browse") { try { PanelCheck.Visible = true; this.InitCheckData(ThisProject); } catch { } finally { } // try { PanelFinish.Visible = true; this.InitExecuteData(ThisProject); } catch { } finally { } // try { PanelHelpFinish.Visible = true; this.txtHelpSendingDate.Text = ThisProject.HelpSendingDate.ToString(); this.txtHelper.Text = ThisProject.user_info5.real_name; this.txtHelperFinishDate.Text = ThisProject.HelperFinishDate.ToString(); this.txtHelperFinishNote.Text = ThisProject.HelperFinishNote.ToString(); } catch { } finally { } // // try { PanelPicFinish.Visible = true; this.txtPicSendingDate.Text = ThisProject.PicSendingDate.ToString(); this.txtPicMaker.Text = ThisProject.user_info3.real_name; this.txtPicFinishDate.Text = ThisProject.PicFinishDate.ToString(); this.txtPicFinishNote.Text = ThisProject.PicFinishNote.ToString(); } catch { } finally { } // try { PanelTemplateFinish.Visible = true; this.txtTemplateSendingDate.Text = ThisProject.TemplateSendingDate.ToString(); this.txtTemplateMaker.Text = ThisProject.user_info4.real_name; this.txtTemplateFinishDate.Text = ThisProject.TemplateFinishDate.ToString(); this.txtTemplateFinishNote.Text = ThisProject.TemplateFinishNote.ToString(); } catch { } finally { } // try { PanelAttachmentFinish.Visible = true; this.txtAttachmentSendingDate.Text = ThisProject.AttachmentSendingDate.ToString(); this.txtAttachmentMaker.Text = ThisProject.user_info6.real_name; this.txtAttachmentFinishDate.Text = ThisProject.AttachmentFinishDate.ToString(); this.txtAttachmentFinishNote.Text = ThisProject.AttachmentFinishNote.ToString(); } catch { } finally { } } #endregion browse #region check else if (this.Request["mode"] == "check") { PanelCheck.Visible = true; this.btnPass.Visible = true; btnDel.Visible = true; } #endregion check #region execute else if (this.Request["mode"] == "execute") { PanelCheck.Visible = true; //this.btnExecute.Visible = true; this.btnBack.Visible = true; this.aExecute.Visible = true; this.InitCheckData(ThisProject); if (ThisProject.progress == "等待执行") { string encode = string.Empty; byte[] bytes = Encoding.UTF8.GetBytes(this.LoginUserInfo.LoginName + "_" + this.LoginUserInfo.Password); encode = HttpUtility.UrlEncode(Convert.ToBase64String(bytes), Encoding.UTF8); aExecute.NavigateUrl = "http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=disposal&project=" + ThisProject.id + "&login="******"已处理"; } } #endregion execute #region helpexecute else if (this.Request["mode"] == "helpexecute") { PanelCheck.Visible = true; PanelHelpFinish.Visible = true; this.InitCheckData(ThisProject); this.txtHelpSendingDate.Text = ThisProject.HelpSendingDate.ToString(); byte[] bytes = Encoding.UTF8.GetBytes(this.LoginUserInfo.LoginName + "_" + this.LoginUserInfo.Password); string encode = HttpUtility.UrlEncode(Convert.ToBase64String(bytes), Encoding.UTF8); this.aCourseList.NavigateUrl = "http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=browse&olddata=help&project=" + ThisProject.id + "&login="******"http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=browse&olddata=help&project=" + ThisProject.id + "&login="******"完成"; } #endregion helpexecute #region mchelpexecute else if (this.Request["mode"] == "mchelpexecute") { PanelCheck.Visible = true; PanelMcHelpFinish.Visible = true; this.InitCheckData(ThisProject); this.txtHelpSendingDate.Text = ThisProject.McHelpSendingDate.ToString(); //byte[] bytes = Encoding.UTF8.GetBytes(this.LoginUserInfo.LoginName + "_" + this.LoginUserInfo.Password); //string encode = HttpUtility.UrlEncode(Convert.ToBase64String(bytes), Encoding.UTF8); //this.aCourseList.NavigateUrl = "http://newpms.cei.cn/webpages/V2/index.html#/HomePage?mode=browse&olddata=help&project=" + ThisProject.id + "&login="******"完成"; } #endregion mchelpexecute #region pic else if (this.Request["mode"] == "pic") { PanelCheck.Visible = true; PanelPicFinish.Visible = true; this.InitCheckData(ThisProject); this.txtPicSendingDate.Text = ThisProject.PicSendingDate.ToString(); this.btnPass.Visible = true; this.btnPass.Text = "完成"; } #endregion pic #region template else if (this.Request["mode"] == "template") { PanelCheck.Visible = true; PanelTemplateFinish.Visible = true; this.InitCheckData(ThisProject); this.txtTemplateSendingDate.Text = ThisProject.TemplateSendingDate.ToString(); this.btnPass.Visible = true; this.btnPass.Text = "完成"; } #endregion template #region attachment else if (this.Request["mode"] == "attachment") { PanelCheck.Visible = true; PanelAttachmentFinish.Visible = true; this.InitCheckData(ThisProject); this.txtAttachmentSendingDate.Text = ThisProject.AttachmentSendingDate.ToString(); this.btnPass.Visible = true; this.btnPass.Text = "完成"; } #endregion attachment else { } } }
public void ProcessRequest(HttpContext context) { //Request StreamReader sr = new StreamReader(HttpContext.Current.Request.InputStream); string strReq = sr.ReadToEnd(); //context.Response.AppendHeader("Access-Control-Allow-Headers", "content-type"); //context.Response.AppendHeader("Access-Control-Allow-Origin", "http://localhost:8080"); //context.Response.AppendHeader("Access-Control-Allow-Credentials", "true"); //string origin = HttpContext.Current.Request.Headers.Get("Origin"); //context.Response.AppendHeader("Access-Control-Allow-Origin", "http://localhost:8080"); //context.Response.Headers.Set("Access-Control-Allow-Origin", origin); #region Insert if (HttpContext.Current.Request["method"] == "insert") { JObject o = JObject.Parse(strReq); string id = (string)o["id"]; string custom = (string)o["custom"]; string customerid = (string)o["CustomerId"]; string midcustomerid = (string)o["MidCustomerId"]; string user = (string)o["user"]; string note = (string)o["note"]; string DeadLine = (string)o["DeadLine"]; string TaskRequire = (string)o["require"].ToString(); string CourseData = (string)o["CourseData"].ToString(); using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = new Models.BatchProject(); int ProjectCount = (from p in ProjectModel.BatchProject where p.id == id select p).Count(); if (ProjectCount > 0) { context.Response.ContentType = "text/plain"; context.Response.StatusCode = 204; context.Response.Write("ID Repetition"); return; } ProjectCollection.WebUI.Models.user_info ThisUser = (from u in ProjectModel.user_info where u.login_name == user select u).First(); ThisProject.id = id; ThisProject.custom = custom; ThisProject.customer = customerid; ThisProject.MidCustomer = midcustomerid; ThisProject.CreatorId = ThisUser.user_identity; ThisProject.CreateNote = note; ThisProject.DeadLine = Convert.ToDateTime(DeadLine); ThisProject.TaskRequire = TaskRequire; ThisProject.progress = "等待审核"; ThisProject.CreateDate = DateTime.Now; ThisProject.CourseData = CourseData; ProjectModel.BatchProject.Add(ThisProject); ProjectModel.SaveChanges(); } context.Response.ContentType = "text/plain"; context.Response.StatusCode = 201; context.Response.Write("success"); } #endregion Insert #region Get else if (HttpContext.Current.Request["method"] == "get") { string id = HttpContext.Current.Request["id"]; using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { int ProjectCount = (from p in ProjectModel.BatchProject where p.id == id select p).Count(); if (ProjectCount == 0) { context.Response.ContentType = "text/plain"; context.Response.StatusCode = 404; context.Response.Write("Not Found Project"); return; } ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == id select p).First(); ProjectCollection.WebUI.Models.user_info ThisUser = (from u in ProjectModel.user_info where u.user_identity == ThisProject.CreatorId select u).First(); object OldData; if (ThisProject.HelpCourseData is null) { OldData = ""; } else { OldData = JsonConvert.DeserializeObject(ThisProject.HelpCourseData); } JObject rss = new JObject(); rss = new JObject( new JProperty("id", ThisProject.id), new JProperty("custom", ThisProject.custom), new JProperty("CustomerId", ThisProject.customer), new JProperty("MidCustomerId", ThisProject.MidCustomer), new JProperty("user", ThisUser.real_name), new JProperty("require", JsonConvert.DeserializeObject(ThisProject.TaskRequire)), new JProperty("CreateDate", ThisProject.CreateDate.ToString("yyyy-MM-dd")), new JProperty("DeadLine", ThisProject.DeadLine.HasValue ? ThisProject.DeadLine.Value.ToString("yyyy-MM-dd") : "n/a"), //nullabale type new JProperty("note", ThisProject.CreateNote), new JProperty("CheckDate", ThisProject.CheckDate.HasValue ? ThisProject.CheckDate.Value.ToString("yyyy-MM-dd") : "n/a"), new JProperty("CheckNote", ThisProject.CheckNote), new JProperty("HelpSendingDate", ThisProject.HelpSendingDate.ToString()), new JProperty("HelperFinishDate", ThisProject.HelperFinishDate.ToString()), new JProperty("McHelpSendingDate", ThisProject.McHelpSendingDate.ToString()), new JProperty("McHelperFinishDate", ThisProject.McHelperFinishDate.ToString()), new JProperty("PicSendingDate", ThisProject.PicSendingDate.ToString()), new JProperty("PicFinishDate", ThisProject.PicFinishDate.ToString()), new JProperty("TemplateSendingDate", ThisProject.TemplateSendingDate.ToString()), new JProperty("TemplateFinishDate", ThisProject.TemplateFinishDate.ToString()), new JProperty("AttachmentSendingDate", ThisProject.AttachmentSendingDate.ToString()), new JProperty("AttachmentFinishDate", ThisProject.AttachmentFinishDate.ToString()), new JProperty("FinishDate", ThisProject.FinishDate.ToString()), new JProperty("CourseData", JsonConvert.DeserializeObject(ThisProject.CourseData)), new JProperty("HelpCourseData", OldData) ); context.Response.ContentType = "text/plain"; context.Response.StatusCode = 200; context.Response.Write(rss.ToString()); } } else if (HttpContext.Current.Request["method"] == "OldHelpQuery") { string id = HttpContext.Current.Request["id"]; using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { int ProjectCount = (from p in ProjectModel.BatchProject where p.id == id select p).Count(); if (ProjectCount == 0) { context.Response.ContentType = "text/plain"; context.Response.StatusCode = 404; context.Response.Write("Not Found Project"); return; } ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == id select p).First(); ProjectCollection.WebUI.Models.user_info ThisUser = (from u in ProjectModel.user_info where u.user_identity == ThisProject.CreatorId select u).First(); object OldData; if (ThisProject.HelpCourseData is null) { OldData = ""; } else { OldData = JsonConvert.DeserializeObject(ThisProject.HelpCourseData); } JObject rss = new JObject(); rss = new JObject( new JProperty("id", ThisProject.id), new JProperty("HelpCourseData", OldData) ); context.Response.ContentType = "text/plain"; context.Response.StatusCode = 200; context.Response.Write(rss.ToString()); } } #endregion Get #region Update else if (HttpContext.Current.Request["method"] == "UpdateProgress") { JObject o = JObject.Parse(strReq); string id = (string)o["id"]; //string TaskRequire = (string)o["require"].ToString(); string CourseData = (string)o["CourseData"].ToString(); string transactor = (string)o["transactor"].ToString(); string note = (string)o["note"].ToString(); using (var ProjectModel = new ProjectCollection.WebUI.Models.ProjectCollectionEntities()) { ProjectCollection.WebUI.Models.BatchProject ThisProject = (from p in ProjectModel.BatchProject where p.id == id select p).First(); ProjectCollection.WebUI.Models.user_info ThisUser = (from u in ProjectModel.user_info where u.login_name == transactor select u).First(); if ((ThisProject.AttachmentSendingDate is null || !(ThisProject.AttachmentFinishDate is null)) && (ThisProject.HelpSendingDate is null || !(ThisProject.HelperFinishDate is null)) && (ThisProject.McHelpSendingDate is null || !(ThisProject.McHelperFinishDate is null)) && (ThisProject.PicSendingDate is null || !(ThisProject.PicFinishDate is null)) && (ThisProject.TemplateSendingDate is null || !(ThisProject.TemplateFinishDate is null))) { ThisProject.transactor = ThisUser.user_identity; //ThisProject.TaskRequire = TaskRequire; //ThisProject.CourseData = CourseData; ThisProject.progress = "已完成"; ThisProject.FinishDate = DateTime.Now; ThisProject.FinishNote = note; ProjectModel.SaveChanges(); context.Response.ContentType = "text/plain"; context.Response.StatusCode = 200; context.Response.Write("完成"); } else { //ThisProject.transactor = ThisUser.user_identity; //ThisProject.progress = "已完成"; //ThisProject.FinishDate = DateTime.Now; //ThisProject.FinishNote = note; //ProjectModel.SaveChanges(); context.Response.ContentType = "text/plain"; context.Response.StatusCode = 200; context.Response.Write("请确认所有分项任务已完成"); } }