Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IOccupation OccupationManager;

            try
            {
                if (!IsPostBack)
                {
                    OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration");
                    DataSet theDS = OccupationManager.GetOccupation();
                    this.grdOccupation.DataSource = theDS.Tables[0];
                    this.grdOccupation.DataBind();
                    if (ViewState["grdDataSource"] == null)
                    {
                        ViewState["grdDataSource"] = theDS.Tables[0];
                    }
                    ViewState["SortDirection"] = "Desc";
                    BindGrid();
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", this);
                return;
            }
            finally
            {
                OccupationManager = null;
            }
        }
    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";
        if (Page.IsPostBack != true)
        {
            lblH2.Text = Request.QueryString["name"];

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


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


            IOccupation OccupationManager;
            try
            {
                if (Request.QueryString["name"] == "Edit")
                {
                    OccupationId = Convert.ToInt32(Request.QueryString["occupationId"]);

                    OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration");
                    DataSet theDS = OccupationManager.GetOccupationByID(OccupationId);
                    this.txtOccupationName.Text = theDS.Tables[0].Rows[0]["OccupationName"].ToString();
                    if (theDS.Tables[0].Rows[0]["DeleteFlag"].ToString() == "True")
                    {
                        this.ddStatus.SelectedValue = "1";
                    }
                    else
                    {
                        this.ddStatus.SelectedValue = "0";
                    }
                    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
            {
                OccupationManager = null;
            }
        }
    }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (FieldValidation() == false)
            {
                return;
            }
            IOccupation OccupationManager;

            try
            {
                if (Request.QueryString["name"] == "Add")
                {
                    OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration");
                    int OccupationId = OccupationManager.SaveNewOccupation(txtOccupationName.Text, 1, Convert.ToInt32(this.txtSeq.Text));
                    if (OccupationId == 0)
                    {
                        IQCareMsgBox.Show("OccupationExists", this);
                        return;
                    }
                    else
                    {
                        IQCareMsgBox.Show("OccupationSave", this);
                        clear_fields();
                    }
                }
                else if (Request.QueryString["name"] == "Edit")
                {
                    OccupationManager = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration");
                    int OccupationId = OccupationManager.UpdateOccupation(Convert.ToInt32(Request.QueryString["occupationid"]), txtOccupationName.Text.ToUpper(), 1, Convert.ToInt32(this.ddStatus.SelectedValue), Convert.ToInt32(this.txtSeq.Text));
                    IQCareMsgBox.Show("OccupationUpdate", this);
                }
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", this);
                return;
            }
            finally
            {
                OccupationManager = null;
            }
        }
Example #4
0
        protected void grdOccupation_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            IOccupation OccupationManager;

            try
            {
                grdOccupation.PageIndex = e.NewPageIndex;
                OccupationManager       = (IOccupation)ObjectFactory.CreateInstance("BusinessProcess.Administration.BOccupation, BusinessProcess.Administration");
                DataSet theDS = OccupationManager.GetOccupation();
                this.grdOccupation.DataSource = theDS.Tables[0];
                this.grdOccupation.DataBind();
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", this);
                return;
            }
            finally
            {
                OccupationManager = null;
            }
        }
        public static List <ThisEntity> Search(string filter, int pageNumber, int pageSize, ref int pTotalRows)
        {
            var list = OccupationManager.Search(filter, "", pageNumber, pageSize, ref pTotalRows);

            return(list);
        }
        public static ThisEntity GetBasic(int profileId)
        {
            var profile = OccupationManager.GetBasic(profileId);

            return(profile);
        }
        public static ThisEntity GetDetail(int profileId)
        {
            var profile = OccupationManager.GetForDetail(profileId);

            return(profile);
        }