protected void Page_Load(object sender, EventArgs e) { SystemUsersBO aSystemUsersBO = new SystemUsersBO(); PermitsBO aPermitsBO = new PermitsBO(); if (IsPostBack == true) { string Pass = Library.StringUtility.md5(Page.Request.Form["txtPassword"].ToString()); string User = Page.Request.Form["txtUsername"].ToString(); bool disable = false; SystemUsers aSystemUsers = aSystemUsersBO.Sel_ByUsername_ByPassword(User, Pass,disable); if (aSystemUsers != null) { Session["LoginAccount"] = aSystemUsers; List<vw_PermitsViewAll> ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username); Session["LoginPermitViewAll"] = ListPermitViewAll; Response.Redirect("Main.aspx"); } else { Response.Redirect("Default.aspx"); } } }
private void frmUpd_PermitDetail_Load(object sender, EventArgs e) { lblIDPermitDetail.Text = ID_Old.ToString(); PermitDetails aPermitDetails = aPermitDetailsBO.Select_ByIDPermitDetail(ID_Old); PermitsBO aPermitsBO = new PermitsBO(); lueIDPermit.Properties.DataSource = aPermitsBO.Select_All(); lueIDPermit.Properties.DisplayMember = "Name"; lueIDPermit.Properties.ValueMember = "ID"; lueIDPermit.EditValue = aPermitDetails.IDPermit; txtName.Text = aPermitDetails.Name; txtPageURL.Text = aPermitDetails.PageURL; cbbDisable.Text = aPermitDetails.Disable.ToString(); cbbStatus.Text = aPermitDetails.Status.ToString(); cbbType.Text = aPermitDetails.Type.ToString(); }
private void frmIns_PermitDetail_Load(object sender, EventArgs e) { try { PermitsBO aPermitsBO = new PermitsBO(); List<Permits> aListPermits = aPermitsBO.Select_All(); lueIDPermit.Properties.DataSource = aListPermits; lueIDPermit.Properties.DisplayMember = "Name"; lueIDPermit.Properties.ValueMember = "ID"; if (aListPermits.Count > 0) { lueIDPermit.EditValue = aListPermits[0].ID; } } catch (Exception ex) { MessageBox.Show("frmIns_PermitDetail.frmIns_PermitDetail_Load\n" +ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmUpd_PermitDetail_Load(object sender, EventArgs e) { try { lblIDPermitDetail.Text = ID_Old.ToString(); PermitDetails aPermitDetails = aPermitDetailsBO.Select_ByIDPermitDetail(ID_Old); PermitsBO aPermitsBO = new PermitsBO(); lueIDPermit.Properties.DataSource = aPermitsBO.Select_All(); lueIDPermit.Properties.DisplayMember = "Name"; lueIDPermit.Properties.ValueMember = "ID"; lueIDPermit.EditValue = aPermitDetails.IDPermit; txtName.Text = aPermitDetails.Name; txtPageURL.Text = aPermitDetails.PageURL; cbbDisable.Text = aPermitDetails.Disable.ToString(); cbbStatus.Text = aPermitDetails.Status.ToString(); cbbType.Text = aPermitDetails.Type.ToString(); } catch (Exception ex) { MessageBox.Show("frmUpd_PermitDetail_Load\n" + ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Del_ByID(HttpContext context) { String jSonString = ""; try { int id = Convert.ToInt32(context.Request.QueryString["ID"]); PermitsBO aPermitsBo = new PermitsBO(); int ret = aPermitsBo.Del_ByID(id); if (ret != 0) jSonString = "{\"status\": \"success\"}"; if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}"; } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}"; } finally { context.Response.Write(jSonString); } }
private void Upd_Type_ByID(HttpContext context) { String jSonString = ""; try { PermitsBO permitsBO = new PermitsBO(); int id = Convert.ToInt32(context.Request.QueryString["ID"]); int type = Convert.ToInt32(context.Request.QueryString["Type"]); int ret = permitsBO.Upd_Type(id, type); if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}"; if (ret != 0) jSonString = "{\"status\": \"success\"}"; } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}"; } finally { context.Response.Write(jSonString); } }
private void Upd_ByID(HttpContext context) { String jSonString = ""; try { Permits aPermits = new Permits(); int idPermits = Convert.ToInt32(context.Request.Form["txtID"]); aPermits.ID = idPermits; aPermits.Name = !String.IsNullOrEmpty(context.Request.Form["txtName"]) ? Convert.ToString(context.Request.Form["txtName"]) : aPermits.Name; aPermits.SystemKey = !String.IsNullOrEmpty(context.Request.Form["txtSystemKey"]) ? Convert.ToString(context.Request.Form["txtSystemKey"]) : aPermits.SystemKey; aPermits.IsAdmin = !String.IsNullOrEmpty(context.Request.Form["cbbIsAdmin"]) ? Convert.ToBoolean(context.Request.Form["cbbIsAdmin"]) : aPermits.IsAdmin; aPermits.IsContent = !String.IsNullOrEmpty(context.Request.Form["cbbIsContent"]) ? Convert.ToBoolean(context.Request.Form["cbbIsContent"]) : aPermits.IsContent; aPermits.IsPartner = !String.IsNullOrEmpty(context.Request.Form["cbbIsPartner"]) ? Convert.ToBoolean(context.Request.Form["cbbIsPartner"]) : aPermits.IsPartner; aPermits.Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : aPermits.Type; aPermits.Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : aPermits.Status; aPermits.Disable = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : aPermits.Disable; PermitsBO aPermitsBo = new PermitsBO(); int ret = aPermitsBo.Upd(aPermits); if (ret != 0) jSonString = "{\"status\": \"success\"}"; if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}"; } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}"; } finally { context.Response.Write(jSonString); } }
private void Sel_ByType_ByStatus(HttpContext context) { String jSonString = ""; PermitsBO permitsBO = new PermitsBO(); int type = Convert.ToInt32(context.Request.QueryString["Type"]); int status = Convert.ToInt32(context.Request.QueryString["Status"]); bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"])) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; List<Permits> listPermits = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"])) ? permitsBO.Sel_ByType_ByStatus(type, status) : permitsBO.Sel_ByType_ByStatus(type, status, disable); if (listPermits.Any()) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(listPermits, _converter); } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }
private void Sel_ByID(HttpContext context) { String jSonString = ""; PermitsBO permitsBO = new PermitsBO(); int id = Convert.ToInt32(context.Request.QueryString["ID"]); bool disable = !String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"])) ? Convert.ToBoolean(context.Request.QueryString["Disable"]) : false; Permits permits = String.IsNullOrEmpty(Convert.ToString(context.Request.QueryString["Disable"])) ? permitsBO.Sel_ByID(id) : permitsBO.Sel_ByID(id, disable); if (permits != null) { _converter.DateTimeFormat = "dd/MM/yyyy"; jSonString = JsonConvert.SerializeObject(permits, _converter); } jSonString = "{\"data\":" + jSonString + "}"; context.Response.Write(jSonString); }
private void Ins(HttpContext context) { String jSonString = ""; try { Permits permits = new Permits { Name = !String.IsNullOrEmpty(context.Request.Form["txtName"]) ? Convert.ToString(context.Request.Form["txtName"]) : "", IsAdmin = !String.IsNullOrEmpty(context.Request.Form["cbbIsAdmin"]) ? Convert.ToBoolean(context.Request.Form["cbbIsAdmin"]) : false, IsContent = !String.IsNullOrEmpty(context.Request.Form["cbbIsContent"]) ? Convert.ToBoolean(context.Request.Form["cbbIsContent"]) : false, IsPartner = !String.IsNullOrEmpty(context.Request.Form["cbbIsPartner"]) ? Convert.ToBoolean(context.Request.Form["cbbIsPartner"]) : false, Type = !String.IsNullOrEmpty(context.Request.Form["cbbType"]) ? Convert.ToInt32(context.Request.Form["cbbType"]) : 0, Status = !String.IsNullOrEmpty(context.Request.Form["cbbStatus"]) ? Convert.ToInt32(context.Request.Form["cbbStatus"]) : 0, SystemKey = !String.IsNullOrEmpty(context.Request.Form["txtSystemKey"]) ? Convert.ToString(context.Request.Form["txtSystemKey"]) : "", Disable = !String.IsNullOrEmpty(context.Request.Form["cbbDisable"]) ? Convert.ToBoolean(context.Request.Form["cbbDisable"]) : false }; PermitsBO permitsBo = new PermitsBO(); int ret = permitsBo.Ins(permits); if (ret != 0) jSonString = "{\"status\": \"success\"}"; if (ret == 0) jSonString = "{\"status\":\"error|" + ret + "\"}"; } catch (Exception ex) { jSonString = "{\"status\":\"error\" ,\"message\":\"" + ex.Message + "\"}"; } finally { context.Response.Write(jSonString); } }
private static bool Login(string UserName, string Password) { try { SystemUsersBO aSystemUsersBO = new SystemUsersBO(); SystemUsers aSystemUsers = aSystemUsersBO.CheckAccount(UserName, Password); if (aSystemUsers != null) { if (aSystemUsers.Disable == true) { throw new Exception("Bạn đang bị tạm khóa toàn hệ thống với lý do:[Chưa rõ]"); } else { PermitsBO aPermitsBO = new PermitsBO(); CORE.CURRENTUSER.ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username) .Where(p => p.Permits_SystemUsers_Disable == false) .Where(p => p.Permits_Disable == false) .Where(p => p.PermitDetails_Disable == false) .Where(p => p.Permits_SystemKey == CORE.SYSTEM.SystemKey).ToList(); if (CORE.CURRENTUSER.ListPermitViewAll.Count == 0) { throw new Exception("Bạn không đủ quyền vào phần mềm này"); } else { CORE.CURRENTUSER.SystemUser = aSystemUsers; return true; } } } else { throw new Exception("Sai username hoặc password"); } } catch (Exception eee) { throw eee; } }