コード例 #1
0
        public void dgSubCategories_Status(object sender, DataGridItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    Label lblStatus = (Label)e.Item.FindControl("lblstatus");

                    if (lblStatus.Text == "True")
                    {
                        lblStatus.Text = "Active";
                    }
                    else if (lblStatus.Text == "False")
                    {
                        lblStatus.Text = "Inactive";
                    }
                }
                else if (e.Item.ItemType == ListItemType.EditItem)
                {
                    clsBLSubCategory objClsBLSubCategory = new clsBLSubCategory();
                    dsCategoryID = objClsBLSubCategory.getCategoryID();
                    DropDownList ddlCategory = (DropDownList)e.Item.Cells[3].FindControl("ddlCategory");
                    ddlCategory.DataSource     = dsCategoryID.Tables[0];
                    ddlCategory.DataValueField = dsCategoryID.Tables[0].Columns["CategoryID"].ToString();
                    ddlCategory.DataTextField  = dsCategoryID.Tables[0].Columns["Category"].ToString();
                    ddlCategory.DataBind();
                }
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "subCategoryMaster.aspx", "dgSubCategories_Status", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Put user code to initialize the page here
                //code to clear all the cache so that after logout, previous page cannot be revisited.
                //--- starts here---------

                //--- ends here---------
                EmployeeID   = Convert.ToInt32(Session["EmployeeID"]);
                SAEmployeeID = Convert.ToInt32(Session["SAEmployeeID"]);
                SuperAdmin   = Convert.ToInt32(Session["SuperAdmin"]);
                // OnlySuperAdmin = Convert.ToInt32(Session["OnlySuperAdmin"]);
                //			pnlAddSubCategory.Visible = false;
                //if (EmployeeID.ToString() == "" || EmployeeID == 0 || SuperAdmin != 0 || OnlySuperAdmin != 0)
                //{
                //    if ((SAEmployeeID.ToString() == "" || SAEmployeeID == 0) && SuperAdmin == 0 && OnlySuperAdmin == 0)
                //    {
                //        Response.Redirect("Login.aspx");
                //    }
                //}
                if (SuperAdmin == 0)
                {
                    if ((SAEmployeeID.ToString() != "" || SAEmployeeID != 0))
                    {
                        Response.Redirect("AuthorizationErrorMessage.aspx");
                    }
                    else
                    {
                        Response.Redirect(ConfigurationManager.AppSettings["Log-OffURL"].ToString());
                    }
                }
                //{
                //    Response.Redirect("Login.aspx");
                //}
                //else
                //{
                //    Response.Redirect("AuthorizationErrorMessage.aspx");
                //}
                if (!Page.IsPostBack)
                {
                    getSubCategories();
                    clsBLSubCategory objClsBLSubCategory = new clsBLSubCategory();
                    dsCategoryID = objClsBLSubCategory.getCategoryID();
                    ddlAddCategory.DataSource     = dsCategoryID.Tables[0];
                    ddlAddCategory.DataValueField = dsCategoryID.Tables[0].Columns["CategoryID"].ToString();
                    ddlAddCategory.DataTextField  = dsCategoryID.Tables[0].Columns["Category"].ToString();
                    ddlAddCategory.DataBind();
                    EmployeePanel.Visible = false;
                }

                btnSubmit.Attributes.Add("onClick", "return isRequire('txtAddSubCategory','Category');");
            }
            catch (System.Threading.ThreadAbortException ex)
            {
            }
            catch (V2Exceptions ex)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                FileLog objFileLog = FileLog.GetLogger();
                objFileLog.WriteLine(LogType.Error, ex.Message, "subCategoryMaster.aspx", "Page_Load", ex.StackTrace);
                throw new V2Exceptions(ex.ToString(), ex);
            }
        }