protected void Bt_Search_Click(object sender, EventArgs e) { string sysCodeID = RCB_SysCodeList.SelectedItem.Value.Trim(); BLL.SysCodeDetail scd = new BLL.SysCodeDetail(); List<Model.SysCodeDetail> SyscodeDetialList = new List<Model.SysCodeDetail>(); string keywords = TB_SubCode.Text.ToLower().Trim(); SyscodeDetialList = scd.GetModelList(0,sysCodeID,-1,-1,false); if (keywords != "") { SyscodeDetialList.RemoveAll(st => !st.SYSCodeDetialID.ToLower().Contains(keywords)); } if (SyscodeDetialList == null || SyscodeDetialList.Count==0) return; /*筛选尚未关联的记录*/ List<Model.SysCodeDetail> newSyscodeDetialTypeList = new List<Model.SysCodeDetail>(); List<Model.SysCodeRelation> scrModelList = scr.GetModelList(1,subSysCodeId,-1,-1,false); foreach (Model.SysCodeDetail scdmodel in SyscodeDetialList) { if (scrModelList.Exists(st => (st.SysCodeDetialIDEx.Equals(scdmodel.SYSCodeDetialID) || st.SysCodeDetialIDEx.Equals(scdmodel.SYSCodeDetialID)))) { continue; } newSyscodeDetialTypeList.Add(scdmodel); } ViewState["SyscodeDetialTypeList"] = newSyscodeDetialTypeList; RGrid_SubSysCode.DataSource = newSyscodeDetialTypeList; RGrid_SubSysCode.DataBind(); RGrid_SubSysCode.Visible = true; RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "changeWindowSize();", true); }
protected void Bt_Modify_Click(object sender, EventArgs e) { string SubCodeName = subSysCodeId; string SubCodeContent = TB_SubCodeContent.Text.Trim(); bool SubCodeEnable = RCB_Enable.SelectedItem.Value == "1" ? true : false; string SubCodeMemo = TB_SubCodeMemo.Text.Trim(); if (SubCodeContent == "") { RadScriptManager.RegisterStartupScript(Page, GetType(), "c1", "OpenAlert('代码内容必须为1-50个字符!');", true); return; } Model.Log logModel = new Model.Log(); logModel.OperationItem = "修改小类信息"; logModel.Operator = user.UserInfo.UserID; logModel.OperationTime = DateTime.Now; BLL.SysCodeDetail scd = new BLL.SysCodeDetail(); Model.SysCodeDetail scdModel = scd.GetModel(SubCodeName); scdModel.SYSCodeDetialID = SubCodeName; scdModel.SYSCodeDetialContext = SubCodeContent; scdModel.LastModifyTime = DateTime.Now; scdModel.Memo = SubCodeMemo; scdModel.IsValid = SubCodeEnable; bool isUpdate = false; logModel.OperationDetail = "小类编号:"+SubCodeName + " - 父类编号:" +scdModel.SYSCodeID+ " - 小类名称:"+SubCodeContent + " - 状态:"+SubCodeEnable; try { isUpdate = scd.Update(scdModel); if (isUpdate) { logModel.Memo = "成功"; } else { logModel.Memo = "失败!"; } } catch (Exception ex) { logModel.Memo = "异常:" + ex.Message; } finally { log.Add(logModel); if (isUpdate) { RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!小类\"" + SubCodeName + "\"修改成功!');", true); } else { RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!小类\"" + SubCodeName + "\"修改失败!');", true); } } }
protected void Bt_Search_Click(object sender, EventArgs e) { int searchType = int.Parse(RCB_SearchType.SelectedItem.Value); string keyWords = TB_KeyWords.Text.Trim(); BLL.SysCodeDetail scd = new BLL.SysCodeDetail(); List<Model.SysCodeDetail> scdModelList = scd.GetModelList(0, sysCodeId, -1, -1, false); if (keyWords != "") { if (searchType == 1) { scdModelList.RemoveAll(st => !st.SYSCodeDetialID.Contains(keyWords)); } else{ scdModelList.RemoveAll(st => !st.SYSCodeDetialContext.Contains(keyWords)); } } RGrid_SubSysCode.DataSource = scdModelList; ViewState["SubSysCodeList"] = scdModelList; RGrid_SubSysCode.DataBind(); RGrid_SubSysCode.Visible = true; RadScriptManager.RegisterStartupScript(Page, GetType(), "c0", "changeWindowSize();", true); }
protected void Bt_Add_Click(object sender, EventArgs e) { string sysCodeDetailID = TB_SubCodeName.Text.Trim(); string sysCodeDetailContext = TB_SubCodeContent.Text.Trim(); bool isValid = RCB_Enable.SelectedValue.Trim() == "1" ? true : false; string memo = TB_SubCodeMemo.Text.Trim(); string matchPass_SubCodeName = @"^[a-z0-9A-Z_-]{1,50}$"; if (sysCodeDetailID == "" || !(Regex.IsMatch(sysCodeDetailID, matchPass_SubCodeName))) { RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉!添加失败!代码编号必须为1-50个字符(可以包含英文、数字和下划线)!');", true); return; } if (sysCodeDetailContext == "") { RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码内容必须为1-50个字符!');", true); return; } BLL.SysCodeDetail scd = new BLL.SysCodeDetail(); if (scd.Exists(sysCodeDetailID)) { RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码编号已存在!');", true); return; } Model.SysCodeDetail scdModel = new Model.SysCodeDetail(); scdModel.SYSCodeID = sysCodeId; scdModel.SYSCodeDetialID = sysCodeDetailID; scdModel.SYSCodeDetialContext = sysCodeDetailContext; scdModel.Memo = memo; scdModel.LastModifyTime = DateTime.Now; scdModel.IsValid = isValid; bool isSubAdd = false; Model.Log logModel = new Model.Log(); try { logModel.OperationItem = "添加子类"; logModel.Operator = user.UserInfo.UserID; logModel.OperationTime = DateTime.Now; logModel.OperationDetail = "大类编号:" + sysCodeId + " - 子类编号:" + sysCodeDetailID + " - 子类内容:" + sysCodeDetailContext; isSubAdd = scd.Add(scdModel); if (isSubAdd) { logModel.Memo = "成功"; } else { logModel.Memo = "失败!"; } } catch (Exception ex) { logModel.Memo = "异常:" + ex.Message; } finally { log.Add(logModel); if (isSubAdd) { RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('恭喜!添加成功!');", true); } else { RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('抱歉!添加失败!');", true); } } }
private bool ReadValue() { string SubCodeName = subSysCodeId; BLL.SysCodeDetail scd = new BLL.SysCodeDetail(); Model.SysCodeDetail scdModel = new Model.SysCodeDetail(); scdModel = scd.GetModel(SubCodeName); if (scdModel == null) return false; Lb_SubCodeName.Text = scdModel.SYSCodeDetialID; TB_SubCodeContent.Text = scdModel.SYSCodeDetialContext; RCB_Enable.SelectedValue = scdModel.IsValid ? "1" : "0"; TB_SubCodeMemo.Text = scdModel.Memo; Model.SysCode scModel = sc.GetModel(scdModel.SYSCodeID); if (scModel != null) { HL_SysCodeName.Text = scModel.SYSCodeContext; HL_SysCodeName.NavigateUrl = "SubSysCodeList.aspx?SysCodeId=" + scModel.SYSCodeID.Trim(); } HL_SubSysCodeName.Text = scdModel.SYSCodeDetialContext; HL_SubSysCodeName.NavigateUrl = "SubSysCodeDetail.aspx?subSysCodeId=" + scdModel.SYSCodeDetialID.Trim(); //if (syscodeType.codeId == "SysUser") // Response.Redirect("SysUserDetail.aspx?LoginID=" + SubCodeName); return true; }