protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomChucNang_Them"))) { var it = new TBT_AdminFunctionGroup(); var txt = (e.Item.FindControl("txt_FunctionGroupName")) as TextBox; if (txt != null) { it.FunctionGroupName = txt.Text; } var txt1 = (e.Item.FindControl("txt_FunctionGroupOrder")) as ASPxTextBox; if (txt1 != null) { it.FunctionGroupOrder = Int32.Parse(txt1.Text); } txt = (e.Item.FindControl("txt_FunctionGroupDesc")) as TextBox; if (txt != null) { it.FunctionGroupDesc = txt.Text; } MemberGroupDAO.ThemNhomChucNang(it); this.lv_ThongTinSP.EditIndex = -1; this.BinList(); } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
public JsonResult GetMemberGroup() { var dao = new MemberGroupDAO(); var data = dao.LoadListMemberGroup(); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDecent(int Id) { var dao = new MemberGroupDAO(); var decent = dao.GetDecent(Id); return(Json(new { data = decent }, JsonRequestBehavior.AllowGet)); }
public JsonResult GetMemberGroupById(int Id) { var dao = new MemberGroupDAO(); var data = dao.GetMemberGroupByID(Id); return(Json(new { data = data }, JsonRequestBehavior.AllowGet)); }
private void ListGroupMember() { this.lb_Nhom.DataSource = MemberGroupDAO.getAllGroupName(); this.lb_Nhom.DataTextField = "GroupName"; this.lb_Nhom.DataValueField = "Group_ID"; this.lb_Nhom.DataBind(); }
protected void lv_ThongTinSP_ItemDeleting(object sender, ListViewDeleteEventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomThanhVien_Xoa"))) { var hdf = (this.lv_ThongTinSP.Items[e.ItemIndex].FindControl("hfGroup_ID")) as HiddenField; if (hdf != null) { if (MemberGroupDAO.XoaNhomThanhVien(Int32.Parse(hdf.Value)) != "") { if (!this.Page.ClientScript.IsStartupScriptRegistered("popup")) { this.Page.ClientScript.RegisterStartupScript( this.GetType(), "popup", "popup('Tác vụ xóa thành viên gặp thất bại!.');", true); } } this.lv_ThongTinSP.EditIndex = -1; this.ListGroupName(); } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idPermissionAccess, NotPermissControl); } }
protected void lv_ThongTinSP_ItemDeleting(object sender, ListViewDeleteEventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strTinhNangChucNang_Xoa"))) { var hdf = (this.lv_ThongTinSP.Items[e.ItemIndex].FindControl("hfFunction_ID")) as HiddenField; if (hdf != null) { if (MemberGroupDAO.XoaTinhNangChucNang(Int32.Parse(hdf.Value)) != "") { this.ltr_Notice.Text = this.objComm.ShowNotice(false, "Xóa tính năng chức năng thất bại"); return; } else { this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thành công!"); } this.lv_ThongTinSP.EditIndex = -1; this.BinList(); } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
protected void lv_ThongTinSP_ItemDeleting(object sender, ListViewDeleteEventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomChucNang_Xoa"))) { var hdf = (this.lv_ThongTinSP.Items[e.ItemIndex].FindControl("hfFunction_Group_ID")) as HiddenField; if (hdf != null) { if (MemberGroupDAO.XoaNhomChucNang(Int32.Parse(hdf.Value)) != "") { if (!this.Page.ClientScript.IsStartupScriptRegistered("popup")) { this.Page.ClientScript.RegisterStartupScript( this.GetType(), "popup", "popup('Bạn cần xóa bỏ các chức năng thuộc nhóm này trước khi xóa nhóm!.');", true); } } this.lv_ThongTinSP.EditIndex = -1; this.BinList(); } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
protected void lbtnUpdate_Click(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomChucNang_Sua"))) { try { int tint, ordersort; string function_Group_ID; foreach (ListViewItem lvit in this.lv_ThongTinSP.Items) { if (((HiddenField)lvit.FindControl("hfFunction_Group_ID")).Value != "") { function_Group_ID = ((HiddenField)lvit.FindControl("hfFunction_Group_ID")).Value; } else { this.ltr_Notice.Text = this.objComm.ShowNotice( false, "Cập nhật thông tin thất bại.\nLỗi trong quá trình nhận dạng nhóm chức năng"); return; } string ods = ((ASPxTextBox)lvit.FindControl("txt_OrderSort")).Text; if (Int32.TryParse(ods, out tint)) { ordersort = tint; } else { this.ltr_Notice.Text = this.objComm.ShowNotice( false, "Cập nhật thông tin thất bại.\nThứ tự nhập vào không phải kiểu số.\nHãy kiểm tra và thử lại!"); return; } TBT_AdminFunctionGroup ctit = MemberGroupDAO.LayNhomChucNangById(Int32.Parse(function_Group_ID)); ctit.FunctionGroupName = ((TextBox)lvit.FindControl("txt_FunctionGroupName")).Text; ctit.FunctionGroupOrder = ordersort; ctit.FunctionGroupDesc = ((TextBox)lvit.FindControl("txt_FunctionGroupDesc")).Text; MemberGroupDAO.Update(); } this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thành công!"); } catch { if (!this.Page.ClientScript.IsStartupScriptRegistered("popup")) { this.Page.ClientScript.RegisterStartupScript( this.GetType(), "popup", "popup('Cập nhật thất bại! Bạn hãy tải lại trang để thử lại cập nhật.');", true); } } } else { this.objComm.wr( "<script language='javascript'>alert('Bạn không có quyền thực hiện chức năng này.');location.href='/AppAdmin/Article/Index.aspx';</script>"); } }
public JsonResult GetDecent() { var userLogin = (UserLogin)Session[Common.CommonConstants.USER_SESSION]; var dao = new MemberGroupDAO(); var decent = dao.GetDecentByUserID((int)userLogin.UserID); return(Json(new { data = decent }, JsonRequestBehavior.AllowGet)); }
protected void btn_ChangePass_Click(object sender, EventArgs e) { var t0 = MemberGroupDAO.LayThanhVienTheoUsername(username); t0.Password = this.objComm.EncodePassword(this.txt_MatKhau.Text, ""); MemberGroupDAO.Update(); this.Response.Redirect("quan-ly-thanh-vien"); }
public JsonResult LoadListMemberGroup(int page, int pageSize) { MemberGroupDAO dao = new MemberGroupDAO(); var data = dao.LoadListMemberGroup().Skip((page - 1) * pageSize).Take(pageSize); int totalRow = dao.LoadListMemberGroup().Count(); return(Json(new { data = data, totalRowMemberGroup = totalRow, }, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveDecent(string strDecent) { JavaScriptSerializer serializer = new JavaScriptSerializer(); Decentralization entity = serializer.Deserialize <Decentralization>(strDecent); var dao = new MemberGroupDAO(); bool res = dao.SaveDecent(entity); return(Json(new { res = res })); }
public JsonResult CreateEditGroupMember(string strGrpMember) { JavaScriptSerializer serializer = new JavaScriptSerializer(); MemberGroup entity = serializer.Deserialize <MemberGroup>(strGrpMember); MemberGroupDAO dao = new MemberGroupDAO(); int res = dao.CreateEditMemberGroup(entity); return(Json(new { res = res })); }
private void BinList() { this.lv_ThongTinSP.DataSource = MemberGroupDAO.DanhSachTinhNangChucNang(function_Group_ID); this.lv_ThongTinSP.DataBind(); var ddl_FunctionName = (DropDownList)this.lv_ThongTinSP.InsertItem.FindControl("ddl_FunctionName"); ddl_FunctionName.DataSource = MemberGroupDAO.DanhSachTinhNang(); ddl_FunctionName.DataValueField = "FunctionName_ID"; ddl_FunctionName.DataTextField = "FunctionName"; ddl_FunctionName.DataBind(); }
public JsonResult DeleteMemberGroup(int Id) { var dao = new MemberGroupDAO(); bool check = dao.CheckUsed(Id); int result = 2; if (check == false) { result = dao.DeleteMemberGroup(Id); return(Json(new { res = result })); } return(Json(new { res = result })); }
protected void lbtnUpdate_Click(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strTinhNang_Sua"))) { try { string function_Group_ID; int id = 1; foreach (ListViewItem lvit in this.lv_ThongTinSP.Items) { if (((HiddenField)lvit.FindControl("hfFunction_Group_ID")).Value != "") { function_Group_ID = ((HiddenField)lvit.FindControl("hfFunction_Group_ID")).Value; } else { this.ltr_Notice.Text = this.objComm.ShowNotice( false, "Cập nhật thông tin thất bại.\nLỗi trong quá trình nhận dạng nhóm chức năng"); return; } TBT_AdminFunctionName ctit = MemberGroupDAO.LayTinhNangById(Int32.Parse(function_Group_ID)); ctit.FunctionName = ((TextBox)lvit.FindControl("txt_FunctionGroupName")).Text; ctit.FunctionOrder = id++; ctit.FunctionNameDesc = ((TextBox)lvit.FindControl("txt_FunctionGroupDesc")).Text; MemberGroupDAO.Update(); } this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thành công!"); this.BinList(); } catch { if (!this.Page.ClientScript.IsStartupScriptRegistered("popup")) { this.Page.ClientScript.RegisterStartupScript( this.GetType(), "popup", "popup('Cập nhật thất bại! Bạn hãy tải lại trang để thử lại cập nhật.');", true); } } } else { this.objComm.wr( "<script language='javascript'>alert('Bạn không có quyền thực hiện chức năng này.');location.href='tin-tuc';</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomThanhVien_Them"))) { if (!this.IsPostBack) { tinhNangCount = MemberGroupDAO.DanhSachTinhNang().Count(); this.BindData(); } } else { this.htmlMemberGroupEdit.Visible = false; this.objControl.LoadMyControl(this.idPermissionAccess, NotPermissControl); } }
protected void lbtnSave_Click(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomThanhVien_Them"))) { #region SaveThongTinNhom var it = new Role { GroupName = this.txt_GroupName.Text, GroupDesc = this.txt_GroupDesc.Text, Active = this.ckb_Active.Checked }; MemberGroupDAO.ThemNhomNguoiDung(it); #endregion GroupID = it.Group_ID; try { foreach (string item in HttpContext.Current.Request.Form) { if (item.Substring(0, 6) == "chbFun") { int tempFunction_ID = Int32.Parse(item.Substring(7, item.Length - 7)); this.strSQLInsert = String.Format( "Insert Into TBT_AdminMemberGroupFunction (Function_ID,Group_ID) values('{0}','{1}')", tempFunction_ID, GroupID); this.objDB.Insert(tempFunction_ID, GroupID, this.strSQLInsert); } //i++; } this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thành công!"); this.Response.Redirect("quan-ly-nhom-thanh-vien"); } catch (Exception ex) { this.ltr_Notice.Text = this.objComm.ShowNotice( false, "Cập nhật thông tin thất bại. Chi tiết: " + ex.Message); } } else { this.htmlMemberGroupEdit.Visible = false; this.objControl.LoadMyControl(this.idPermissionAccess, NotPermissControl); } }
protected void lbtnSave_Click(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomThanhVien_Sua"))) { #region SaveThongTinNhom var it = MemberGroupDAO.getGroupByID(GroupID); it.GroupName = this.txt_GroupName.Text; it.GroupDesc = this.txt_GroupDesc.Text; it.Active = this.ckb_Active.Checked; MemberGroupDAO.Update(); #endregion try { MemberGroupDAO.XoaTinhNangByNhomThanhVien(GroupID); foreach (string item in HttpContext.Current.Request.Form) { if (item.Substring(0, 6) == "chbFun") { int tempFunction_ID = Int32.Parse(item.Substring(7, item.Length - 7)); this.strSQLInsert = String.Format( "Insert Into TBT_AdminMemberGroupFunction (Function_ID,Group_ID) values('{0}','{1}')", tempFunction_ID, GroupID); this.objDB.Insert(tempFunction_ID, GroupID, this.strSQLInsert); } //i++; } this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thành công!"); this.BindData(); } catch (Exception ex) { this.ltr_Notice.Text = this.objComm.ShowNotice(true, "Cập nhật thông tin thất bại!" + ex.Message); } } else { this.htmlMemberGroupEdit.Visible = false; this.objControl.LoadMyControl(this.idPermissionAccess, NotPermissControl); } }
protected void SaveData(string type) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strThanhVien_Them"))) { if (this.VerifyThongTin()) { this.GetInPutData(); var obj = new User { UserName = this.strUser, Password = this.strPass, FullName = this.strFullName, Active = Convert.ToBoolean(this.isActive), Address = this.strAddress, Company = this.strCompany, Phone = this.strPhone, Fax = this.strFax, Mobile = this.strMobile, Position = this.strPosi, Email = this.strEmail, Sex = this.strSex, CreateDate = Convert.ToDateTime(this.strCreateDate), Group_ID = int.Parse(this.lb_Nhom.SelectedValue) }; MemberGroupDAO.InsertMember(obj); switch (type) { case "Publish": this.Response.Redirect("them-thanh-vien"); break; case "Save": this.Response.Redirect("quan-ly-thanh-vien"); break; } } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
protected void SaveData(string type) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strThanhVien_Sua"))) { if (this.VerifyThongTin()) { this.strID = Common.RequestID("id"); this.GetInPutData(); var obj = MemberGroupDAO.LayThanhVienTheoUsername(this.strID); obj.UserName = this.strUser; //obj.Password = strPass; obj.FullName = this.strFullName; obj.Active = Convert.ToBoolean(this.isActive); obj.Address = this.strAddress; obj.Company = this.strCompany; obj.Phone = this.strPhone; obj.Fax = this.strFax; obj.Mobile = this.strMobile; obj.Position = this.strPosi; obj.Email = this.strEmail; obj.Sex = this.strSex; obj.ModifiedDate = Convert.ToDateTime(this.strCreateDate); obj.Group_ID = int.Parse(this.lb_Nhom.SelectedValue); MemberGroupDAO.Update(); switch (type) { case "Publish": this.Response.Redirect("them-thanh-vien"); break; case "Save": this.Response.Redirect("quan-ly-thanh-vien"); break; } } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
protected void lv_ThongTinSP_ItemInserting(object sender, ListViewInsertEventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strTinhNangChucNang_Them"))) { int functionName_ID = 0; var txt1 = (e.Item.FindControl("ddl_FunctionName")) as DropDownList; if (txt1 != null) { functionName_ID = Int32.Parse(txt1.SelectedValue); } if (!MemberGroupDAO.KiemTraTonTaiTinhNangChucNang(functionName_ID, function_Group_ID)) { var it = new TBT_AdminFunction(); var txt = (e.Item.FindControl("txt_FunctionCode")) as TextBox; if (txt != null) { it.FunctionCode = txt.Text; } it.FunctionName_ID = functionName_ID; txt = (e.Item.FindControl("txt_FunctionGroupDesc")) as TextBox; if (txt != null) { it.FunctionDesc = txt.Text; } it.Function_Group_ID = function_Group_ID; MemberGroupDAO.ThemTinhNangChucNang(it); this.lv_ThongTinSP.EditIndex = -1; this.BinList(); } else { this.Page.ClientScript.RegisterStartupScript( this.GetType(), "popup", "popup('Tính năng chức năng này đã tồn tại!.');", true); } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
protected void Page_Load(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strTinhNangChucNang_Xem"))) { if (!this.Page.IsPostBack) { if (Common.RequestID("manhom") != "") { function_Group_ID = Int32.Parse(Common.RequestID("manhom")); } this.ltr_Title.Text = "Danh sách tính năng của nhóm chức năng: " + MemberGroupDAO.LayNhomChucNangById(function_Group_ID).FunctionGroupName; this.BinList(); } } else { this.iRightAccess.Visible = false; this.objControl.LoadMyControl(this.idNotPermissionAccess, NotPermissControl); } }
private void LoadInfoEdit() { this.ListGroupMember(); this.strID = Common.RequestID("username"); var obj = MemberGroupDAO.LayThanhVienTheoUsername(this.strID); if (obj != null) { this.txtUserName.Text = obj.UserName; this.txtFullName.Text = obj.FullName; //txtPassword.Text = obj.Password; //txtRePassword.Text = obj.Password; this.txtAddress.Text = obj.Address; this.txtCompany.Text = obj.Company; this.txtEmail.Text = obj.Email; this.txtFax.Text = obj.Fax; this.txtTel.Text = obj.Phone; this.txtMobi.Text = obj.Mobile; this.txtPosi.Text = obj.Position; this.chkIsActive.Checked = (bool)obj.Active; this.lb_Nhom.SelectedValue = obj.Group_ID.ToString(); this.DDLSex.SelectedValue = obj.Sex; } }
protected void Page_Load(object sender, EventArgs e) { if (this.objCheckPermision.Permission(this.objCheckPermision.LayQuyen("strNhomThanhVien_Sua"))) { if (!this.IsPostBack) { if (Common.RequestID("id") != "") { tinhNangCount = MemberGroupDAO.DanhSachTinhNang().Count(); GroupID = Int32.Parse(Common.RequestID("id")); this.BindData(); } else { this.Response.Redirect("quan-ly-nhom-thanh-vien"); } } } else { this.htmlMemberGroupEdit.Visible = false; this.objControl.LoadMyControl(this.idPermissionAccess, NotPermissControl); } }
private void BinList() { this.lv_ThongTinSP.DataSource = MemberGroupDAO.LayDanhSachThanhVien(); this.lv_ThongTinSP.DataBind(); }
private void ListGroupName() { this.lv_ThongTinSP.DataSource = MemberGroupDAO.getAllGroupName(); this.lv_ThongTinSP.DataBind(); }
public void BindData() { #region LoadThongTin var it = MemberGroupDAO.getGroupByID(GroupID); this.txt_GroupName.Text = it.GroupName; this.txt_GroupDesc.Text = it.GroupDesc; this.ckb_Active.Checked = it.Active; #endregion #region Quyền hạn trong từng chức năng #region Header this.tbl.Append( "<div style='padding: 2px; margin: 5px 0px 5px 0px;' class='ui-widget-content ui-corner-top ui-corner-bottom'><div><table cellspacing='0' border='1' style='width: 100%; border-collapse: collapse;' rules='all' class='adminlist'><tbody> <tr> <th scope='col'>Nhóm chức năng</th>"); foreach (TBT_AdminFunctionName t1 in MemberGroupDAO.DanhSachTinhNang()) { this.tbl.Append(String.Format("<th scope='col'>{0}</th>", t1.FunctionName)); } this.tbl.Append("</tr>"); #endregion #region Content foreach (var t1 in MemberGroupDAO.DanhSachNhomChucNang()) { for (int i = 0; i < tinhNangCount; i++) { this.Permission[i] = false; this.bcheck[i] = string.Empty; } this.tbl.Append("<tr class='row0'>"); this.tbl.Append(" <td align='left' width='25%'>"); this.tbl.Append( String.Format( " <a href='JavaScript:checkAllGroupItem({0},document.aspnetForm.chbFunc{0})' class='member_list'>{1}</a>", t1.Function_Group_ID, t1.FunctionGroupName)); this.tbl.Append(" </td>"); foreach (var t2 in MemberGroupDAO.DanhSachTinhNangChucNang1(t1.Function_Group_ID)) { int id = (int)(t2.TBT_AdminFunctionName.FunctionOrder - 1); this.Permission[id] = true; this.Function_Group_Id[id] = t1.Function_Group_ID; this.Function_Id[id] = t2.Function_ID; if ( MemberGroupDAO.DanhSachQuyenHanNhomThanhVien().Any(p => p.Group_ID == GroupID && p.Function_ID == t2.Function_ID)) { this.bcheck[id] = " checked "; } } for (int i = 0; i < tinhNangCount; i++) { if (this.Permission[i]) { this.tbl.Append("<td align='center'>"); this.tbl.Append( String.Format( "<input type='checkbox' name='chbFunc{0}' value='check' id='{1}' {2}>", this.Function_Id[i], this.Function_Group_Id[i], this.bcheck[i])); this.tbl.Append("</td>"); } else { this.tbl.Append("<td align='center'>"); this.tbl.Append(" "); this.tbl.Append("</td>"); } } this.tbl.Append("</tr>"); } this.tbl.Append("</tbody></table></div></div>"); #endregion #endregion this.htmlMemberGroupEdit.InnerHtml = this.tbl.ToString(); }
private void BinList() { this.lv_ThongTinSP.DataSource = MemberGroupDAO.DanhSachNhomChucNang(); this.lv_ThongTinSP.DataBind(); }