示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;

        //int AdminId = Convert.ToInt32(Session["AdminId"]);

        HttpCookie cookie = Request.Cookies["DYL"];
        int AdminId = Convert.ToInt32(cookie["userid"]);

        dtAdmin = taAdmin.GetDataByAdminId(AdminId);

        if (dtAdmin[0].Type.ToString() != "admin")
            Response.Redirect("PermissionDenied.aspx");

        if (Request.QueryString["ID"] != null)
        {
            if (Request.QueryString["ID"] == "True")
            {
                lblMsg.Text = "Successfully Added";
            }
        }

        SelectSecurityPageSections();
    }
示例#2
0
 private void BindData()
 {
     dtAdmin = taAdmin.GetAllUsers();
     if (dtAdmin.Rows.Count > 0)
     {
         GridView1.DataSourceID = null;
         GridView1.DataSource = dtAdmin;
         GridView1.DataBind();
     }
     else
     {
         lblMsg.Text = "No record found";
         return;
     }
 }
    protected void btnChangePassword_Click(object sender, EventArgs e)
    {
        HttpCookie cookie = Request.Cookies["DYL"];
        int userId = Convert.ToInt32(cookie["userid"]);

        string HashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtoldpassword.Text.Trim(), "sha1");
        dtAdmin = taAdmin.SelectAdminDetailsbyAdminIdandPassword(userId,
                                                                 HashedPassword);

        if (dtAdmin.Rows.Count > 0)
        {
            string HashedPassword2 = FormsAuthentication.HashPasswordForStoringInConfigFile(txtnewpasword.Text.Trim(), "sha1");
            taAdmin.ChangeAdminPassword(Convert.ToInt32(cookie["AdminId"].ToString()),
                                    HashedPassword2);
            Response.Redirect("ChangePassword.aspx?Id=true");
        }
        else
        {
            lblChangePassword.Text = "Sorry the password could not be changed";
            return;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     HttpCookie cookie = Request.Cookies["DYL"];
     if (cookie == null)
     {
         string ReturnURL = Request.RawUrl.ToString();
         Response.Redirect("Login.aspx?msg=Your session has expired due to inactivity. Please login again.&ReturnURL=" + ReturnURL);
     }
     else
     {
         int AdminId = Convert.ToInt32(cookie["userid"]);
         dtAdmin = taAdmin.GetDataByAdminId(AdminId);
         string currentPageName = GetCurrentPageName();
         if (dtAdmin[0].Type.ToString() != "admin")
         {
             if (currentPageName != "home.aspx"
                 && currentPageName != "ChangePassword.aspx"
                 && currentPageName != "Logout.aspx"
                 && currentPageName != "PermissionDenied.aspx")
             {
                 dtSecurityPages = taSecurityPages.GetDataByPageName(currentPageName);
                 if (dtSecurityPages.Rows.Count > 0)
                 {
                     int SectionId = Convert.ToInt32(dtSecurityPages[0].SecurityPageSectionId);
                     dtPermissions = taPermissions.GetDataBySecurityPageSectionId(SectionId,AdminId);
                     if (dtPermissions.Rows.Count < 1)
                         Response.Redirect("PermissionDenied.aspx");
                     else
                         return;
                 }
                 else
                     Response.Redirect("PermissionDenied.aspx");
             }
             else
                 return;
         }
     }
 }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;

        if (Request.QueryString["ID"] != null)
        {
            if (Request.QueryString["ID"] == "True")
            {
                lblMsg.Text = "Successfully Added";
            }
        }

        HttpCookie cookie = Request.Cookies["DYL"];
        int AdminId = Convert.ToInt32(cookie["userid"]);

        dtAdmin = taAdmin.GetDataByAdminId(AdminId);

        if (dtAdmin[0].Type.ToString() != "admin")
            Response.Redirect("PermissionDenied.aspx");

        if (Request.QueryString["UserId"] != null)
        {
            int UserId = Convert.ToInt32(Request.QueryString["UserId"]);
            dtAdmin = taAdmin.GetDataByAdminId(UserId);
            if (dtAdmin.Rows.Count > 0)
            {
                lblLoginId.Text = dtAdmin[0].LoginId.ToString();
                SelectSecurityPageSections();
                MakeSectionsSelected(UserId);
            }
            else
                btnEdit.Visible = false;
        }
        else
            btnEdit.Visible = false;
    }
示例#6
0
    private void FillBaseFiles(int CompanyId)
    {
        DataTable DT1;
        ylib = new ylibWebClass(constr.connect());

        dtAdmin = taAdmin.GetAllUsers();
        FCF.FillCheckBoxList(ref loclst, dtAdmin, "LoginId", "AdminId");
        DT1 = ylib.GiveDataTable_BySQLStatement("select adminid from Admin_Company_Transaction where companyid=" + CompanyId);
        FCF.SelectItemInCheckBoxList2(ref loclst, DT1, "AdminId", "Int32");
    }