Example #1
0
 protected void btnProcess_Click(object sender, EventArgs e)
 {
     try
     {
         Attendance_BLL _attendancebll = new Attendance_BLL();
         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
         {
             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
             {
                 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();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
     }
 }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Region')", true);
                }
                else if (txtDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Date')", true);
                }
                else if (drpBenefitType.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Benefit Type')", true);
                }
                else
                {
                    try
                    {
                        Attendance_BLL _attendancebll = new Attendance_BLL();
                        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, Convert.ToDateTime(txtDate.Text));
                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;

                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                //aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                //aemployee.Is_Holiday = aitem.Is_Holiday;
                                aemployee.DATE_JOINED = Convert.ToDateTime(txtDate.Text);
                                aemployee.BenefitType = drpBenefitType.SelectedItem.Text;
                                aemployee.Amount      = Convert.ToDecimal(txtbxAmount.Text);
                                // TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                //aemployee.Shift_TotalHour = in_time;
                                newemployess.Add(aemployee);
                            }

                            List <HRM_EMPLOYEES_VIEWER> ascendingnewemployees = newemployess.OrderBy(x => x.EID).ToList();

                            if (ascendingnewemployees.Count > 0)
                            {
                                grdview.DataSource = ascendingnewemployees;
                                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.GetEmployeeByRODSSUID(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtDate.Text));
                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;
                                //aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                aemployee.DATE_JOINED      = Convert.ToDateTime(txtDate.Text);
                                aemployee.BenefitType      = drpBenefitType.SelectedItem.Text;
                                aemployee.Amount           = Convert.ToDecimal(txtbxAmount.Text);

                                //aemployee.Is_Holiday = aitem.Is_Holiday;
                                // TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                //aemployee.Shift_TotalHour = in_time;
                                newemployess.Add(aemployee);
                            }
                            List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EID).ToList();

                            if (assendingnewemployess.Count > 0)
                            {
                                grdview.DataSource = assendingnewemployess;
                                grdview.DataBind();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #3
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Region!')", true);
                }
                else if (ddlOffice1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Office!')", true);
                    return;
                }
                else if (ddlDept1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Department!')", true);
                    return;
                }
                else if (ddlDeductionType.SelectedItem.ToString() == "-- Select Type--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Deduction Type!')", true);
                }

                else
                {
                    try
                    {
                        Attendance_BLL _attendancebll = new Attendance_BLL();
                        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);
                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;
                                // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                aemployee.Is_Holiday       = aitem.Is_Holiday;
                                aemployee.Salary_Month     = ddlMonthList.SelectedItem.Text;
                                aemployee.Salary_Year      = Convert.ToInt32(ddlYearList.SelectedValue);
                                newemployess.Add(aemployee);
                            }

                            List <HRM_EMPLOYEES_VIEWER> ascendingnewemployees = newemployess.OrderBy(x => x.EID).ToList();

                            if (ascendingnewemployees.Count > 0)
                            {
                                grdview.DataSource = ascendingnewemployees;
                                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.GetEmployeeByRODSSUID(ResionId, OfficeId, DeptId, sction, subsction, DateTime.Now);
                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;
                                // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                aemployee.Salary_Month     = ddlMonthList.SelectedItem.Text;
                                aemployee.Salary_Year      = Convert.ToInt32(ddlYearList.SelectedValue);
                                aemployee.Is_Holiday       = aitem.Is_Holiday;
                                newemployess.Add(aemployee);
                            }
                            List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EID).ToList();

                            if (assendingnewemployess.Count > 0)
                            {
                                grdview.DataSource = assendingnewemployess;
                                grdview.DataBind();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                if (chSalaryIncrementStatus.Checked)
                {
                    Attendance_BLL _attendancebll            = new Attendance_BLL();
                    string         eid                       = txtbxEID.Text.Trim();
                    List <HRM_EMPLOYEES_VIEWER> employess    = _attendancebll.GetEmployeesByEid(eid);
                    List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                    foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                    {
                        HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                        aemployee.EID = aitem.EID;
                        //aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                        aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                        aemployee.DEG_NAME         = aitem.DEG_NAME;
                        aemployee.DATE_JOINED      = Convert.ToDateTime(aitem.DATE_JOINED);
                        aemployee.Type             = drpEntryType.SelectedValue.ToString();
                        aemployee.IncrementDate    = Convert.ToDateTime(txtDate.Text);
                        aemployee.EffectiveDate    = Convert.ToDateTime(txtbxEffectiveDate.Text);
                        aemployee.PreviousSalary   = aitem.PreviousSalary;
                        aemployee.BasicSalary      = aitem.BasicSalary;

                        if (drpEntryType.SelectedValue.ToString() == "Percentage")
                        {
                            decimal calculateSalary = (Convert.ToDecimal(aitem.BasicSalary) * Convert.ToDecimal(txtbxAmountParcentence.Text)) / 100;
                            aemployee.IncrementAmount     = calculateSalary;
                            aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                        }
                        else
                        {
                            decimal calculateSalary = Convert.ToDecimal(txtbxAmountParcentence.Text);
                            aemployee.IncrementAmount     = calculateSalary;
                            aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                        }
                        newemployess.Add(aemployee);
                    }
                    List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.ToList();

                    if (assendingnewemployess.Count > 0)
                    {
                        if (chSalaryIncrementStatus.Checked)
                        {
                            grdviewIndivitual.DataSource = assendingnewemployess;
                            grdviewIndivitual.DataBind();
                        }
                        else
                        {
                            grdview.DataSource = assendingnewemployess;
                            grdview.DataBind();
                        }
                    }
                }
                else
                {
                    //if (Convert.ToDateTime(txtDate.Text) > DateTime.Now)
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Date can not be greater than current date!')", true);
                    //    return;
                    //}
                    if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Region')", true);
                    }
                    else if (txtDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Date')", true);
                    }
                    else if (drpEntryType.SelectedItem.ToString() == "Select Entry Type")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Entry Type')", true);
                    }

                    else
                    {
                        try
                        {
                            Attendance_BLL _attendancebll = new Attendance_BLL();
                            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, Convert.ToDateTime(txtDate.Text));
                                List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                                foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                                {
                                    HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                    aemployee.EID = aitem.EID;
                                    // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                    aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                    aemployee.DEG_NAME         = aitem.DEG_NAME;
                                    aemployee.DATE_JOINED      = Convert.ToDateTime(aitem.DATE_JOINED);
                                    aemployee.Type             = drpEntryType.SelectedValue.ToString();
                                    aemployee.IncrementDate    = Convert.ToDateTime(txtDate.Text);
                                    aemployee.EffectiveDate    = Convert.ToDateTime(txtbxEffectiveDate.Text);
                                    aemployee.PreviousSalary   = aitem.PreviousSalary;
                                    aemployee.BasicSalary      = aitem.BasicSalary;

                                    if (drpEntryType.SelectedValue.ToString() == "Percentage")
                                    {
                                        decimal calculateSalary = (Convert.ToDecimal(aitem.BasicSalary) * Convert.ToDecimal(txtbxAmountParcentence.Text)) / 100;
                                        aemployee.IncrementAmount     = calculateSalary;
                                        aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                                    }
                                    else
                                    {
                                        decimal calculateSalary = Convert.ToDecimal(txtbxAmountParcentence.Text);
                                        aemployee.IncrementAmount     = calculateSalary;
                                        aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                                    }
                                    newemployess.Add(aemployee);
                                }

                                List <HRM_EMPLOYEES_VIEWER> ascendingnewemployees = newemployess.ToList();

                                if (ascendingnewemployees.Count > 0)
                                {
                                    if (chSalaryIncrementStatus.Checked)
                                    {
                                        grdviewIndivitual.DataSource = ascendingnewemployees;
                                        grdviewIndivitual.DataBind();
                                    }
                                    else
                                    {
                                        grdview.DataSource = ascendingnewemployees;
                                        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.GetEmployeeByRODSSUID(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtDate.Text));
                                List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                                foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                                {
                                    HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                    aemployee.EID = aitem.EID;
                                    // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                    aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                    aemployee.DEG_NAME         = aitem.DEG_NAME;
                                    aemployee.DATE_JOINED      = Convert.ToDateTime(aitem.DATE_JOINED);
                                    aemployee.Type             = drpEntryType.SelectedValue.ToString();
                                    aemployee.IncrementDate    = Convert.ToDateTime(txtDate.Text);
                                    aemployee.EffectiveDate    = Convert.ToDateTime(txtbxEffectiveDate.Text);
                                    aemployee.PreviousSalary   = aitem.PreviousSalary;
                                    aemployee.BasicSalary      = aitem.BasicSalary;
                                    if (drpEntryType.SelectedValue.ToString() == "Percentage")
                                    {
                                        decimal calculateSalary = (Convert.ToDecimal(aitem.BasicSalary) * Convert.ToDecimal(txtbxAmountParcentence.Text)) / 100;
                                        aemployee.IncrementAmount     = calculateSalary;
                                        aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                                    }
                                    else
                                    {
                                        decimal calculateSalary = Convert.ToDecimal(txtbxAmountParcentence.Text);
                                        aemployee.IncrementAmount     = calculateSalary;
                                        aemployee.AfterIncrementSalry = aitem.PreviousSalary + calculateSalary;
                                    }
                                    newemployess.Add(aemployee);
                                }
                                List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.ToList();

                                if (assendingnewemployess.Count > 0)
                                {
                                    if (chSalaryIncrementStatus.Checked)
                                    {
                                        grdviewIndivitual.DataSource = assendingnewemployess;
                                        grdviewIndivitual.DataBind();
                                    }
                                    else
                                    {
                                        grdview.DataSource = assendingnewemployess;
                                        grdview.DataBind();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #5
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Region!')", true);
                }

                else if (ddlOffice1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Office!')", true);
                    return;
                }
                else if (ddlDept1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Department!')", true);
                    return;
                }

                else if (txtFromDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Extra Shift Date!')", true);
                    return;
                }

                else
                {
                    try
                    {
                        Attendance_BLL _attendancebll = new Attendance_BLL();

                        //sub-section wise process

                        if (ddlRegion1.SelectedItem.Text != "--Select--" && ddlOffice1.SelectedItem.Text != "--Select--" && ddlDept1.SelectedItem.Text != "--Select--" && ddlSection.SelectedItem.Text != "--Select--" && ddlSubSections.SelectedItem.Text != "--Select--")
                        {
                            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);
                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;
                                //  aemployee.EMP_ID = Convert.ToInt32(aitem.EMP_ID);
                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                aemployee.DATE_JOINED      = Convert.ToDateTime(txtFromDate.Text);
                                TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                aemployee.Shift_TotalHour = in_time;
                                aemployee.SHIFTCODE       = aitem.SHIFTCODE;
                                newemployess.Add(aemployee);
                            }

                            List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EID).ToList();

                            if (assendingnewemployess.Count > 0)
                            {
                                grdview.DataSource = newemployess;
                                grdview.DataBind();
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                        }


                        //section wise process

                        else if (ddlRegion1.SelectedItem.Text != "--Select--" && ddlOffice1.SelectedItem.Text != "--Select--" && ddlDept1.SelectedItem.Text != "--Select--" && ddlSection.SelectedItem.Text != "--Select--" && ddlSubSections.SelectedItem.Text == "--Select--")
                        {
                            int regionId  = Convert.ToInt32(ddlRegion1.SelectedValue);
                            int officeId  = Convert.ToInt32(ddlOffice1.SelectedValue);
                            int deptId    = Convert.ToInt32(ddlDept1.SelectedValue);
                            int sectionId = Convert.ToInt32(ddlSection.SelectedValue);

                            List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeBySectionId(regionId, officeId, deptId, sectionId, Convert.ToDateTime(txtFromDate.Text));

                            if (employess.Count > 0)
                            {
                                List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                                foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                                {
                                    HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                    aemployee.EID = aitem.EID;
                                    // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                    aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                    aemployee.DEG_NAME         = aitem.DEG_NAME;
                                    aemployee.DATE_JOINED      = Convert.ToDateTime(txtFromDate.Text);
                                    TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                    aemployee.Shift_TotalHour = in_time;
                                    aemployee.SHIFTCODE       = aitem.SHIFTCODE;
                                    newemployess.Add(aemployee);
                                }
                                List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EID).ToList();

                                if (assendingnewemployess.Count > 0)
                                {
                                    grdview.DataSource = assendingnewemployess;
                                    grdview.DataBind();
                                }
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                        }


                        //department wise process

                        else if (ddlRegion1.SelectedItem.Text != "--Select--" && ddlOffice1.SelectedItem.Text != "--Select--" && ddlDept1.SelectedItem.Text != "--Select--" && ddlSection.SelectedItem.Text == "--Select--")
                        {
                            int DeptId = Convert.ToInt32(ddlDept1.SelectedValue);

                            List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByOfficeID(DeptId);

                            List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                            foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                            {
                                HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                                aemployee.EID = aitem.EID;
                                // aemployee.EMP_ID = Convert.ToInt32(aitem.EID);
                                aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                                aemployee.DEG_NAME         = aitem.DEG_NAME;
                                aemployee.DATE_JOINED      = Convert.ToDateTime(txtFromDate.Text);
                                TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                aemployee.Shift_TotalHour = in_time;
                                aemployee.SHIFTCODE       = aitem.SHIFTCODE;
                                newemployess.Add(aemployee);
                            }

                            List <HRM_EMPLOYEES_VIEWER> assendingnewemployes = newemployess.OrderBy(x => x.EID).ToList();

                            if (assendingnewemployes.Count > 0)
                            {
                                grdview.DataSource = assendingnewemployes;
                                grdview.DataBind();
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                        }

                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select information for process!')", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID);
                // LogController<ExtraShiftEmployeewise>.SetLog(ex, EID);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #6
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);
            }
        }