protected void Page_Load(object sender, EventArgs e)
    {
        //        (Master.FindControl("lblheader") as Label).Text = "Customise List";
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
        (Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text  = "Customise List";
        lblH2.Text = Request.QueryString["name"];

        if (lblH2.Text == "Add")
        {
            ddStatus.Visible  = false;
            lblStatus.Visible = false;
            lblH2.Text        = "Add Designation";
        }


        else if (lblH2.Text == "Edit")
        {
            lblH2.Text = "Edit Designation";
        }

        IDesignation DesignationManager;

        if (!IsPostBack)
        {
            try
            {
                if (Request.QueryString["name"] == "Edit")
                {
                    DesignationId = Convert.ToInt32(Request.QueryString["DesignationId"]);

                    DesignationManager = (IDesignation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDesignation, BusinessProcess.Administration");
                    DataSet theDS = DesignationManager.GetDesignationByID(DesignationId);
                    this.txtDesignationName.Text = theDS.Tables[0].Rows[0]["Designation_Name"].ToString();
                    if (theDS.Tables[0].Rows[0]["Status"].ToString() == "Active")
                    {
                        this.ddStatus.SelectedValue = "0";
                    }
                    else
                    {
                        this.ddStatus.SelectedValue = "1";
                    }
                    this.txtSeq.Text = theDS.Tables[0].Rows[0]["Sequence"].ToString();
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                DesignationManager = null;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("~/frmlogin.aspx", true);
        }
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Visible = false;
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Customise List";
        IDesignation DesignationManager;

        if (!IsPostBack)
        {
            try
            {
                ViewState["TableName"]  = Request.QueryString["TableName"].ToString();
                ViewState["CategoryId"] = Request.QueryString["CategoryId"].ToString();
                ViewState["ListName"]   = Request.QueryString["LstName"].ToString();
                ViewState["FID"]        = Request.QueryString["Fid"].ToString();
                ViewState["Update"]     = Request.QueryString["Upd"].ToString();
                if (Request.QueryString["CCID"] != null)
                {
                    ViewState["CCID"] = Request.QueryString["CCID"].ToString();
                }
                if (Request.QueryString["ModId"].ToString() != "")
                {
                    ViewState["ModuleId"] = Convert.ToInt32(Request.QueryString["ModId"]);
                }

                if (Request.QueryString["Upd"] == "1")
                {
                    DesignationId      = Convert.ToInt32(Request.QueryString["SelectedId"]);
                    DesignationManager = (IDesignation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDesignation, BusinessProcess.Administration");
                    DataSet theDS = DesignationManager.GetDesignationByID(DesignationId);
                    this.txtDesignationName.Text = theDS.Tables[0].Rows[0]["Designation_Name"].ToString();
                    DesignationName = theDS.Tables[0].Rows[0]["Designation_Name"].ToString();
                    if (theDS.Tables[0].Rows[0]["Status"].ToString() == "Active")
                    {
                        this.ddStatus.SelectedValue = "0";
                    }
                    else
                    {
                        this.ddStatus.SelectedValue = "1";
                    }
                    if (Convert.ToString(theDS.Tables[0].Rows[0]["DisplayMode"]) == "0")
                    {
                        this.rdouserName.Checked = true;
                    }
                    else if (Convert.ToString(theDS.Tables[0].Rows[0]["DisplayMode"]) == "1")
                    {
                        this.rdouserlist.Checked = true;
                    }
                    this.txtSeq.Text = theDS.Tables[0].Rows[0]["Sequence"].ToString();
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
                return;
            }
            finally
            {
                DesignationManager = null;
            }
        }
    }