public void BindInfo() { using (IFMPDBContext db = new IFMPDBContext()) { BaseFlowRole BaseFlowRole = db.BaseFlowRole.FirstOrDefault(t => t.ID == BaseFlowRoleID); if (BaseFlowRole != null) { Flow Flow = db.Flow.FirstOrDefault(t => t.ID == BaseFlowRole.FlowID); this.ddl_TableType.SelectedValue = ((int)Flow.TableTypeID).ToString(); this.txt_Role.Text = db.Role.FirstOrDefault(t => t.ID == BaseFlowRole.RoleID).Name; this.hf_RoleID.Value = BaseFlowRole.RoleID.ToString(); } } }
protected void btn_Sumbit_Click(object sender, EventArgs e) { try { using (IFMPDBContext db = new IFMPDBContext()) { int FlowID = Convert.ToInt32(this.ddl_Flow.SelectedValue); if (db.Flow.FirstOrDefault(t => t.ID == FlowID) == null) { ShowMessage("请选择正确的流程"); return; } string rolearray = this.hf_RoleID.Value.TrimEnd(',').TrimStart(',').Trim(); foreach (string role in rolearray.Split(',')) { int roleid = Convert.ToInt32(role); BaseFlowRole BaseFlowRole = db.BaseFlowRole.FirstOrDefault(t => t.RoleID == roleid && t.FlowID == FlowID); if (BaseFlowRole == null && db.Role.FirstOrDefault(t => t.ID == roleid) != null) { BaseFlowRole = new BaseFlowRole(); BaseFlowRole.RoleID = roleid; BaseFlowRole.FlowID = FlowID; db.BaseFlowRole.Add(BaseFlowRole); } } ShowMessage(); new SysLogDAO().AddLog(LogType.操作日志_添加, "添加基础流程权限", UserID); db.SaveChanges(); } } catch (Exception error) { ShowMessage(error.Message); } }
protected void btn_Delete_Click(object sender, EventArgs e) { try { string ids = this.hf_CheckIDS.Value.TrimEnd(','); using (IFMPDBContext db = new IFMPDBContext()) { try { foreach (string id in ids.Split(',')) { int selid = Convert.ToInt32(id); BaseFlowRole BaseFlowRole = db.BaseFlowRole.FirstOrDefault(t => t.ID == selid); db.BaseFlowRole.Remove(BaseFlowRole); } db.SaveChanges(); new SysLogDAO().AddLog(LogType.操作日志_删除, "删除基础流程权限设置信息", UserID); ShowMessage("删除成功"); } catch { ShowMessage("删除失败"); return; } } } catch (Exception ex) { new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID); ShowMessage(ex.Message); } this.hf_CheckIDS.Value = ""; DataBindList(); }