Пример #1
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL _attendancebll = new Attendance_BLL();

                if (chSalaryCheck.Checked)
                {
                    if (txtbxEid.Text != "")
                    {
                        if (txtbxSalarySearch.Text == null || txtbxSalarySearch.Text == "")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input From Salary!')", true);
                        }
                        else if (txtbxSalryFrom.Text == null || txtbxSalryFrom.Text == "")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Salary!')", true);
                        }
                        else
                        {
                            Decimal Salary   = Convert.ToDecimal(txtbxSalarySearch.Text);
                            Decimal ToSalary = Convert.ToDecimal(txtbxSalryFrom.Text);

                            string eid = Convert.ToString(txtbxEid.Text);

                            List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByIDWithSalary(eid, Salary, ToSalary);
                            if (employess.Count > 0)
                            {
                                grdview.DataSource = employess;
                                grdview.DataBind();
                            }
                            else
                            {
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                        }
                    }
                    else
                    {
                        if (ddlRegion1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Region!')", true);
                        }
                        else if (ddlOffice1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Office!')", true);
                        }
                        else if (ddlDept1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Department!')", true);
                        }
                        else
                        {
                            if (txtbxSalarySearch.Text == null || txtbxSalarySearch.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Salary!')", true);
                            }
                            else if (txtbxSalryFrom.Text == null || txtbxSalryFrom.Text == "")
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Salary!')", true);
                            }
                            else
                            {
                                Decimal ToSalary = Convert.ToDecimal(txtbxSalryFrom.Text);
                                Decimal Salary   = Convert.ToDecimal(txtbxSalarySearch.Text);
                                if (ddlSubSections.SelectedValue.ToString() == "" || ddlSubSections.SelectedValue.ToString() == "0" || ddlSection.SelectedValue.ToString() == "" || ddlSection.SelectedValue.ToString() == "0")
                                {
                                    int DeptId = Convert.ToInt32(ddlDept1.SelectedValue);
                                    List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByOfficeIDWithSalary(DeptId, Salary, ToSalary);
                                    if (employess.Count > 0)
                                    {
                                        grdview.DataSource = employess;
                                        grdview.DataBind();
                                    }
                                    else
                                    {
                                        grdview.DataSource = null;
                                        grdview.DataBind();
                                    }
                                }
                                else
                                {
                                    int ResionId  = Convert.ToInt32(ddlRegion1.SelectedValue);
                                    int OfficeId  = Convert.ToInt32(ddlOffice1.SelectedValue);
                                    int DeptId    = Convert.ToInt32(ddlDept1.SelectedValue);
                                    int sction    = Convert.ToInt32(ddlSection.SelectedValue);
                                    int subsction = Convert.ToInt32(ddlSubSections.SelectedValue);
                                    List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByRODSSUIDWithSalry(ResionId, OfficeId, DeptId, sction, subsction, Salary, ToSalary);
                                    if (employess.Count > 0)
                                    {
                                        grdview.DataSource = employess;
                                        grdview.DataBind();
                                    }
                                    else
                                    {
                                        grdview.DataSource = null;
                                        grdview.DataBind();
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (txtbxEid.Text != "")
                    {
                        string eid = Convert.ToString(txtbxEid.Text);
                        List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByID(eid);
                        if (employess.Count > 0)
                        {
                            grdview.DataSource = employess;
                            grdview.DataBind();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found')", true);
                        }
                    }
                    else
                    {
                        if (ddlRegion1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Region!')", true);
                        }
                        else if (ddlOffice1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Office!')", true);
                        }
                        else if (ddlDept1.SelectedValue == "--Select--")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Seletct Department!')", true);
                        }
                        else
                        {
                            if (ddlSubSections.SelectedValue.ToString() == "" || ddlSubSections.SelectedValue.ToString() == "0" || ddlSection.SelectedValue.ToString() == "" || ddlSection.SelectedValue.ToString() == "0")
                            {
                                int DeptId = Convert.ToInt32(ddlDept1.SelectedValue);
                                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByOfficeID(DeptId);
                                if (employess.Count > 0)
                                {
                                    grdview.DataSource = employess;
                                    grdview.DataBind();
                                }
                                else
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found')", true);
                                }
                            }
                            else
                            {
                                int ResionId  = Convert.ToInt32(ddlRegion1.SelectedValue);
                                int OfficeId  = Convert.ToInt32(ddlOffice1.SelectedValue);
                                int DeptId    = Convert.ToInt32(ddlDept1.SelectedValue);
                                int sction    = Convert.ToInt32(ddlSection.SelectedValue);
                                int subsction = Convert.ToInt32(ddlSubSections.SelectedValue);
                                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByRODSSUID(ResionId, OfficeId, DeptId, sction, subsction);
                                if (employess.Count > 0)
                                {
                                    grdview.DataSource = employess;
                                    grdview.DataBind();
                                }

                                else
                                {
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found')", true);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }