protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtModuName.Text.Trim().Length == 0) { strErr += "ModuName不能为空!\\n"; } //if(!PageValidate.IsNumber(txtModuNumber.Text)) //{ // strErr+="ModuNumber格式错误!\\n"; //} //if(strErr!="") //{ // MessageBox.Show(this,strErr); // return; //} string ModuName = this.txtModuName.Text; int ModuNumber = int.Parse(this.txtModuNumber.Text); CHSS.Model.CModule model = new CHSS.Model.CModule(); model.ModuName = ModuName; model.ModuNumber = ModuNumber; CHSS.BLL.CModule bll = new CHSS.BLL.CModule(); bll.Add(model); //Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { int recordCount = new CHSS.BLL.CModule().GetRecordCount(""); char[] RValueArray = new Char[100]; for (int i = 0; i < MyRepeater.Items.Count; i++) { CheckBoxList checkBoxItem = (CheckBoxList)(MyRepeater.Controls[i].FindControl("MyCheckBoxList")); for (int j = 0; j < checkBoxItem.Items.Count; j++) { RValueArray[int.Parse(checkBoxItem.Items[j].Value)] = checkBoxItem.Items[j].Selected ? '1' : '0'; //RValue += checkBoxItem.Items[j].Selected ? 1 : 0; } } String RValue = new String(RValueArray); int RID = int.Parse(this.txtRID.Text); string RoleNumber = this.txtRoleNumber.Text; string RoleName = this.txtRoleName.Text; string RoleValue = RValue; string RoleDescription = this.txtRoleDescription.Text; CHSS.Model.CRole model = new CHSS.Model.CRole(); model.RID = RID; model.RoleNumber = RoleNumber; model.RoleName = RoleName; model.RoleValue = RoleValue; model.RoleDescription = RoleDescription; CHSS.BLL.CRole bll = new CHSS.BLL.CRole(); bll.Update(model); Response.Redirect("Show.aspx?id=" + RID); }
private void ShowInfo(int RID) { CHSS.BLL.CRole bll = new CHSS.BLL.CRole(); CHSS.Model.CRole model = bll.GetModel(RID); this.txtRID.Text = model.RID.ToString(); this.txtRoleNumber.Text = model.RoleNumber; this.txtRoleName.Text = model.RoleName; this.txtRoleDescription.Text = model.RoleDescription; RValue = model.RoleValue.ToCharArray(); DataSet ds = new CHSS.BLL.CModule().GetAllList(); MyRepeater.DataSource = ds; MyRepeater.DataBind(); //int recordCount = new CHSS.BLL.CModule().GetRecordCount(""); //for (int i = 0; i < recordCount; i++) //{ // CheckBoxList checkBoxItem = (CheckBoxList)(MainDiv.FindControl("CheckBoxList" + (i + 1).ToString())); // for (int j = 0; j < checkBoxItem.Items.Count; j++) // { // checkBoxItem.Items[j].Selected = RValue[i * 4 + j] == '1' ? true : false; // //if (RValue[i * 4 + j] == '1') // // checkBoxItem.Items[j].Selected = true; // //else // // checkBoxItem.Items[j].Selected = false; // } //} }
private void ShowInfo(int MID) { CHSS.BLL.CModule bll = new CHSS.BLL.CModule(); CHSS.Model.CModule model = bll.GetModel(MID); this.lblMID.Text = model.MID.ToString(); this.lblModuName.Text = model.ModuName; this.lblModuNumber.Text = model.ModuNumber.ToString(); }
private void ShowInfo(int RID) { CHSS.BLL.CRole bll = new CHSS.BLL.CRole(); CHSS.Model.CRole model = bll.GetModel(RID); this.txtRID.Text = model.RID.ToString(); this.txtRoleNumber.Text = model.RoleNumber; this.txtRoleName.Text = model.RoleName; this.txtRoleDescription.Text = model.RoleDescription; RValue = model.RoleValue.ToCharArray(); DataSet ds = new CHSS.BLL.CModule().GetAllList(); MyRepeater.DataSource = ds; MyRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try //--判断是否具有权限,若无权限回退到上一页 { char[] AuthorityKey = Session["roleValue"].ToString().ToCharArray(); if (AuthorityKey[0] == '0') { Response.Write("<script>alert('无此权限');document.execCommand('stop');window.stop();window.history.back();</script>"); } } catch { Response.Write("<script>alert('无此权限');document.execCommand('stop');window.stop();window.history.back();</script>"); } //--END if (!IsPostBack) { DataSet ds = new CHSS.BLL.CModule().GetAllList(); MyRepeater.DataSource = ds; MyRepeater.DataBind(); } }