Ejemplo n.º 1
0
        void PageAccessControl()
        {
            if (!IsPostBack)
            {
                PGAccess = dl.UP_Fetch_ModuleAccess("Proposal", empRole);
                ViewState["PGAccess"] = PGAccess;
                ProjAccess = dl.UP_Fetch_ModuleAccess("Projects", empRole);
                ViewState["ProjAccess"] = ProjAccess;
            }
            else
            {
                PGAccess = (PageAccess)ViewState["PGAccess"];
                ProjAccess = (PageAccess)ViewState["ProjAccess"];
            }
            if (!PGAccess.AllowPage)
                Response.Redirect("NoAccess.aspx");

            if (PGAccess.AllowAdd)
                btnadd.Visible = true;
            else
                btnadd.Visible = false;
        }
Ejemplo n.º 2
0
        void PageAccessControl()
        {
            empRole = Session["EmployeeRole"].ToString();
            if (!IsPostBack)
            {
                PGAccess = dl.UP_Fetch_ModuleAccess(strmastername, empRole);
                ViewState["PGAccess"] = PGAccess;
            }
            else
            {
                PGAccess = (PageAccess)ViewState["PGAccess"];
            }
            if (!PGAccess.AllowPage)
                Response.Redirect("NoAccess.aspx");

            if (PGAccess.AllowEdit || PGAccess.AllowAdd)
                btn_submit.Visible = true;
            else
                btn_submit.Visible = false;

            if (PGAccess.AllowAdd)
                btnadd.Visible = true;
            else
                btnadd.Visible = false;
        }
Ejemplo n.º 3
0
        public PageAccess UP_Fetch_ModuleAccess(string Modulename, string Role)
        {
            PageAccess result = new PageAccess();
            Database objDataBase = DatabaseFactory.CreateDatabase();
            DataSet ds = new DataSet();
            DbCommand cmd;

            if (Role == "Administrator")
            {
                result.AllowAdd = true; result.AllowEdit = true; result.AllowDelete = true; result.AllowPage = true;
            }
            else
            {
                cmd = objDataBase.GetStoredProcCommand("UP_Fetch_ModuleAccess");
                objDataBase.AddInParameter(cmd, "@Modulename", DbType.String, Modulename);
                objDataBase.AddInParameter(cmd, "@Role", DbType.String, Role);
                ds = objDataBase.ExecuteDataSet(cmd);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    result.AllowAdd = Convert.ToBoolean(ds.Tables[0].Rows[0]["AllowAdd"].ToString());
                    result.AllowEdit = Convert.ToBoolean(ds.Tables[0].Rows[0]["AllowEdit"].ToString());
                    result.AllowDelete = Convert.ToBoolean(ds.Tables[0].Rows[0]["AllowDelete"].ToString());
                    result.AllowPage = true;
                }
                else
                {
                    result.AllowAdd = false; result.AllowEdit = false; result.AllowDelete = false; result.AllowPage = false;
                }
            }

            return result;
        }
Ejemplo n.º 4
0
        void PageAccessControl()
        {
            empRole = Session["EmployeeRole"].ToString();
            if (!IsPostBack)
            {
                PGAccess = dl.UP_Fetch_ModuleAccess("Proposal", empRole);
                ViewState["PGAccess"] = PGAccess;
                if (Session["ProposalID"].ToString() == "New")
                    ViewState["NewProposal"] = "Yes";
                else
                    ViewState["NewProposal"] = "No";

                ProjAccess = dl.UP_Fetch_ModuleAccess("Projects", empRole);
                ViewState["ProjAccess"] = ProjAccess;
            }
            else
            {
                PGAccess = (PageAccess)ViewState["PGAccess"];
                ProjAccess = (PageAccess)ViewState["ProjAccess"];
            }
            if (!PGAccess.AllowPage)
                Response.Redirect("NoAccess.aspx");

            if (PGAccess.AllowEdit || (PGAccess.AllowAdd && ViewState["NewProposal"].ToString()=="Yes"))
            {
                btnsave.Visible = true;
                btnsavecontinue.Visible = true;
                btnfinalsumbit.Visible = true;
                btn_addclient.Visible = true;

                if (!IsPostBack && ds.Tables[2].Rows.Count > 0)
                {
                    if (ds.Tables[2].Rows[0]["Status"].ToString() == "Won")
                    {
                        btnsave.Visible = false;
                        btnsavecontinue.Visible = false;
                        btnfinalsumbit.Visible = false;
                        btn_addclient.Visible = false;
                    }
                }
            }
            else
            {
                btnsave.Visible = false;
                btnsavecontinue.Visible = false;
                btnfinalsumbit.Visible = false;
                btn_addclient.Visible = false;
            }

            if (!ProjAccess.AllowAdd)
            {
                if (btnCreateProject.Visible)
                    btnCreateProject.Visible = false;
            }
        }
Ejemplo n.º 5
0
        void PageAccessControl()
        {
            empRole = Session["EmployeeRole"].ToString();
            if (!IsPostBack)
            {
                PGAccess = dl.UP_Fetch_ModuleAccess("Projects", empRole);
                ViewState["PGAccess"] = PGAccess;
                if (Session["ProjectID"].ToString() == "New")
                    ViewState["NewProject"] = "Yes";
                else
                    ViewState["NewProject"] = "No";
            }
            else
            {
                PGAccess = (PageAccess)ViewState["PGAccess"];
            }
            if (!PGAccess.AllowPage)
                Response.Redirect("NoAccess.aspx");

            if (PGAccess.AllowEdit || (PGAccess.AllowAdd && ViewState["NewProject"].ToString() == "Yes"))
            {
                btnsave.Visible = true;
                btnsavecontinue.Visible = true;
                btnfinalsumbit.Visible = true;
            }
            else
            {
                btnsave.Visible = false;
                btnsavecontinue.Visible = false;
                btnfinalsumbit.Visible = false;
            }
        }