protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); JsonString = RequestData.Get <string>("JsonString"); if (!string.IsNullOrEmpty(id)) { ent = ImgNews.Find(id); } switch (RequestActionString) { case "update": if (!string.IsNullOrEmpty(JsonString)) { ImgNews tempEnt = JsonHelper.GetObject <ImgNews>(JsonString); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(JsonString); DataHelper.MergeData <ImgNews>(ent, tempEnt, dic.Keys); ent.SaveAndFlush(); } else { ent = GetMergedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.SaveAndFlush(); if (RequestData["param"] + "" == "tj") { PageState.Add("rtnId", ent.Id); } } SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case "create": ent = this.GetPostedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = "0"; ent.CreateAndFlush(); if (RequestData["param"] + "" == "tj") { //ent.State = "1"; //提交流程 PageState.Add("rtnId", ent.Id); } SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case "ImportFile": string fileIds = RequestData.Get <string>("fileIds"); if (!string.IsNullOrEmpty(fileIds)) { sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0"; sql = string.Format(sql, fileIds); PageState.Add("Result", DataHelper.QueryDictList(sql)); } break; case "autoexecute": Task[] tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); if (tasks.Length == 0) { System.Threading.Thread.Sleep(1000); tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId")); } if (tasks.Length > 0) { this.PageState.Add("TaskId", tasks[0].ID); string AuditUserId = RequestData.Get <string>("AuditUserId"); string AuditUserName = RequestData.Get <string>("AuditUserName"); if (!string.IsNullOrEmpty(AuditUserId)) { Aim.WorkFlow.WorkFlow.AutoExecute(tasks[0], new string[] { AuditUserId, AuditUserName }); } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } } else { PageState.Add("error", "自动提交申请人失败,请手动提交"); } break; case "submitfinish": string ApproveResult = RequestData.Get <string>("ApproveResult"); ent = ImgNews.Find(id); ent.WFState = "End"; ent.WFResult = ApproveResult; ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; if (ApproveResult == "同意") { ent.State = "2"; } ent.PostTime = DateTime.Now; ent.Update(); break; case "submit": StartFlow(id); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); typeid = RequestData.Get <string>("TypeId"); ImgNews ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.SaveAndFlush(); SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <ImgNews>(); ent.HomePagePopup = RequestData.Get <string>("HomePagePopup"); ent.CreateId = UserInfo.UserID; ent.CreateName = UserInfo.Name; ent.CreateTime = DateTime.Now; ent.State = "1"; if (RequestData["param"] + "" == "tj") { ent.PostUserId = UserInfo.UserID; ent.PostUserName = UserInfo.Name; ent.PostTime = DateTime.Now; ent.State = "2"; } ent.CreateAndFlush(); SaveDetail(ent.Id); InsertCompetence(ent.Id, ent.ReceiveDeptId, ent.ReceiveDeptName); break; case RequestActionEnum.Delete: ent = this.GetTargetData <ImgNews>(); ent.DeleteAndFlush(); this.SetMessage("删除成功!"); return; break; } if (RequestActionString == "ImportFile") { string fileIds = RequestData.Get <string>("fileIds"); if (!string.IsNullOrEmpty(fileIds)) { string sql = @"select * from BJKY_Portal..FileItem where PatIndex('%'+Id+'%','{0}')>0"; sql = string.Format(sql, fileIds); PageState.Add("Result", DataHelper.QueryDictList(sql)); } } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = ImgNews.Find(id); typeid = ent.TypeId; //详细列表数据 PageState.Add("DetailList", ImgNewDetail.FindAllByProperty("PId", ent.Id)); } this.SetFormData(ent); } else { string sql = "select DeptId,ChildDeptName,ParentId,ParentDeptName,len(Path) LenPath from dbo.View_SysUserGroup where UserId='" + UserInfo.UserID + "' and Type=2"; DataTable dtt = DataHelper.QueryDataTable(sql); if (dtt.Rows.Count > 0) { var DeptInfo = new { groupId = dtt.Rows[0]["DeptId"] + "", groupName = dtt.Rows[0]["ChildDeptName"] + "", deptId = dtt.Rows[0]["ParentId"] + "", deptName = dtt.Rows[0]["ParentDeptName"] + "" }; PageState.Add("DeptInfo", DeptInfo); } } if (!String.IsNullOrEmpty(typeid)) { NewsType newsType = NewsType.TryFind(typeid); PageState.Add("NewsType", newsType); } EasyDictionary es = new EasyDictionary(); DataTable dt = DataHelper.QueryDataTable("select Id,TypeName from NewsType where IsEfficient='1'"); foreach (DataRow row in dt.Rows) { es.Add(row["Id"].ToString(), row["TypeName"].ToString()); } PageState.Add("NewsTypeEnum", es); }