Example #1
0
        public JsonResult UploadAttendance(HttpPostedFileBase ExcelFileAttendence)
        {
            ViewBag.msg = "";
            try
            {
                if (SaveExcelFile(ExcelFileAttendence))
                {
                    objattendanceproperty = new Attendance_Property();
                    objattendanceproperty.tbl_Attendance = ToDataTable(ReadExcelFile(ExcelFileAttendence.FileName));
                    objattendancebll = new Attendance_BLL();
                    var flag = objattendancebll.Insert(objattendanceproperty.tbl_Attendance);
                    if (flag)
                    {
                        ViewBag.msg = "Success";
                    }
                    else
                    {
                        ViewBag.msg = "Contact Administrator";
                    }
                }

                return(Json(new { success = true, msg = ViewBag.msg }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, msg = "Contact Administrator" }, JsonRequestBehavior.AllowGet));
            }
        }
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL        _attendancebll    = new Attendance_BLL();
                List <HRM_ATTENDANCE> lstHRM_ATTENDANCE = new List <HRM_ATTENDANCE>();

                foreach (GridViewRow gvRow in grdview.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();

                    if (rowChkBox.Checked == true)
                    {
                        Label   lblEID            = ((Label)gvRow.FindControl("lblEID"));
                        Label   lblWorkingDay     = ((Label)gvRow.FindControl("lblWorkingDay"));
                        Label   lblAttendanceDate = ((Label)gvRow.FindControl("lblAttendanceDate"));
                        TextBox txtbxInTime       = ((TextBox)gvRow.FindControl("txtbxIntime"));
                        TextBox txtbxOutTIme      = ((TextBox)gvRow.FindControl("txtbxOuttime"));

                        _attendance.EID                       = lblEID.Text;
                        _attendance.Attendance_Date           = Convert.ToDateTime(lblAttendanceDate.Text);
                        _attendance.In_Time                   = TimeSpan.Parse(txtbxInTime.Text);
                        _attendance.Out_Time                  = TimeSpan.Parse(txtbxOutTIme.Text);
                        _attendance.Remarks                   = txtbxremark.Text;
                        _attendance.Attendance_Process_Status = true;
                        _attendance.OCode                     = ((SessionUser)Session["SessionUser"]).OCode;
                        _attendance.Edit_Date                 = DateTime.Now;
                        _attendance.Edit_User                 = ((SessionUser)Session["SessionUser"]).UserId;

                        lstHRM_ATTENDANCE.Add(_attendance);
                    }
                }

                if (lstHRM_ATTENDANCE.Count > 0)
                {
                    var result = _attendancebll.Update_IndividualAttendance(lstHRM_ATTENDANCE);
                    if (result != null)
                    {
                        ClearUI();
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #3
0
        private void CheckIsDeducted()
        {
            try
            {
                //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);
                Attendance_BLL _attendancebll = new Attendance_BLL();
                //List<HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetSalaryDeductionByEID(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtDate.Text));

                DateTime deductionDate = Convert.ToDateTime(txtDate.Text);
                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetSalaryDeductionByEID(deductionDate);

                if (employess.Count > 0)
                {
                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        Label        lblEID   = ((Label)gvRow.FindControl("lblEID"));
                        CheckBox     Checkbox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));
                        DropDownList ddl      = ((DropDownList)gvRow.FindControl("ddlSalaryDeductType"));

                        string eid    = lblEID.Text;
                        var    ispage = employess.FirstOrDefault(x => x.EID == eid && x.SalaryDeductDate == deductionDate);
                        if (ispage != null)
                        {
                            double?mm = ispage.salaryDeductDay;
                            if (mm > 0.5)
                            {
                                ddl.SelectedValue = "Full Day";
                            }
                            else
                            {
                                ddl.SelectedValue = "Half Day";
                            }

                            Checkbox.Checked = true;
                        }
                        else
                        {
                            Checkbox.Checked = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #4
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);
     }
 }
Example #5
0
        public JsonResult GetAttendanceRepotrt(int year, int month)
        {
            int              employeeid = Convert.ToInt32(Session["Emp_ID"].ToString());
            string           from       = year + "-" + month + "-" + 01;
            string           to         = year + "-" + month + "-" + 31;
            EmployeeProperty emp        = new EmployeeProperty();

            emp.Id = employeeid;
            Employee_BLL empbll          = new Employee_BLL(emp);
            int          empattendanceid = empbll.GetEmployeeAttendanceId();

            objattendancebll = new Attendance_BLL();
            DataTable dt          = objattendancebll.SelectEmployeeAttendance(from, to, empattendanceid);
            var       dtserialize = JsonConvert.SerializeObject(dt);

            return(Json(new { data = dtserialize }, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public FileResult DownloadAttendance(int year, int month)
        {
            int              employeeid = Convert.ToInt32(Session["Emp_ID"].ToString());
            string           from       = year + "-" + month + "-" + 01;
            string           to         = year + "-" + month + "-" + 31;
            EmployeeProperty emp        = new EmployeeProperty();

            emp.Id = employeeid;
            Employee_BLL empbll          = new Employee_BLL(emp);
            int          empattendanceid = empbll.GetEmployeeAttendanceId();

            objattendancebll = new Attendance_BLL();
            DataTable dt       = objattendancebll.SelectEmployeeAttendance(from, to, empattendanceid);
            string    fullName = Server.MapPath("~" + "/AttendanceFiles/Attendance Report" + from + to + employeeid);
            bool      flag     = WriteDataTableToExcel(dt, "Attendance Report" + employeeid, fullName);

            if (flag)
            {
                try
                {
                    byte[] fileBytes = System.IO.File.ReadAllBytes(fullName + ".xlsx");
                    string fileName  = Path.GetFileName(fullName + ".xlsx");
                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
                }
                catch (Exception ex)
                {
                    //StringBuilder sb = new StringBuilder();
                    //sb.Append("log something");

                    //File.AppendAllText(filePath + "log.txt", sb.ToString());
                    //sb.Clear();
                    byte[] fileBytes = new byte[1];
                    return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, ""));
                }
            }
            else
            {
                byte[] fileBytes = System.IO.File.ReadAllBytes(fullName);
                string fileName  = Path.GetFileName("");

                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, "abc Else Case"));
            }
        }
Example #7
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL _attendancebll = new Attendance_BLL();

                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.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                    aemployee.DEG_NAME         = aitem.DEG_NAME;
                    aemployee.TOHour           = txtbxOtHour.Text.Trim();
                    aemployee.DATE_JOINED      = Convert.ToDateTime(txtDate.Text);


                    newemployess.Add(aemployee);
                }

                if (newemployess.Count > 0)
                {
                    grdview.DataSource = newemployess;
                    grdview.DataBind();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #8
0
 protected void drpdwnDepartment1SelectedIndexChange(object sender, EventArgs e)
 {
     try
     {
         SECTION_BLL    SectionBll     = new SECTION_BLL();
         Attendance_BLL _attendancebll = new Attendance_BLL();
         string         OCODE          = ((SessionUser)Session["SessionUser"]).OCode;
         int            departmentId   = Convert.ToInt16(ddlDept1.SelectedValue);
         var            row            = SectionBll.GetSectionsByDepartmentIdAndOCode(departmentId, OCODE).ToList();
         if (row.Count > 0)
         {
             ddlSection.DataSource     = row;
             ddlSection.DataTextField  = "SEC_NAME";
             ddlSection.DataValueField = "SEC_ID";
             ddlSection.DataBind();
             ddlSection.Items.Insert(0, new ListItem("--Select--", "0"));
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
     }
 }
        protected void btnAttSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                foreach (GridViewRow gvRow in GridViewEMP_AT.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    HRM_ATTENDANCE obj = new HRM_ATTENDANCE();

                    if (rowChkBox.Checked == true)
                    {
                        Label   lblId           = ((Label)gvRow.FindControl("lblId"));
                        TextBox txtbxExtraOtAdd = ((TextBox)gvRow.FindControl("OTExtraAdd"));
                        Label   lblAttnDate     = ((Label)gvRow.FindControl("lblAttnDate"));
                        //Label lbltotalot = ((Label)gvRow.FindControl("lbltotalot"));
                        //double totalOT = Convert.ToDouble(lbltotalot.Text);

                        DateTime otDate = Convert.ToDateTime(lblAttnDate.Text);

                        obj.ATTE_ID = Convert.ToInt32(lblId.Text);
                        int AttId = Convert.ToInt32(obj.ATTE_ID);

                        if (rdExtraOT.Checked)
                        {
                            obj.OT_ExtraAdd = Convert.ToInt32(txtbxExtraOtAdd.Text);
                            // obj.OT_Total = totalOT + Convert.ToDouble(txtbxExtraOtAdd.Text);
                        }
                        else if (rdExtraOTDeduct.Checked)
                        {
                            obj.OT_Deduction = Convert.ToInt32(txtbxExtraOtAdd.Text);
                            // obj.OT_Total = totalOT - Convert.ToDouble(txtbxExtraOtAdd.Text);
                        }

                        obj.OCode     = ((SessionUser)Session["SessionUser"]).OCode;
                        obj.Edit_Date = DateTime.Now;
                        obj.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;

                        var result = objAtt_BLL.UpdateAttendanceOT(obj, AttId);

                        if (result == 1)
                        {
                            //ot process

                            string OCODE  = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);
                            string userId = Convert.ToString(((SessionUser)Session["SessionUser"]).UserId);

                            objAtt_BLL.UpdateOT_ByShift_EID(otDate, otDate, hdnEmployeeShiftCode.Value, txtEid_AT.Text);

                            //ot process log
                            var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(otDate));
                            var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(otDate));
                            var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                            var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                            var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                            string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                            context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);

                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully.')", true);

                            // load grid
                            DateTime fromdate = Convert.ToDateTime(txtfromDate.Text);
                            DateTime toDate   = Convert.ToDateTime(txtToDate.Text);

                            var row = objAtt_BLL.GetAttendanceByEID(txtEid_AT.Text).Where(x => x.Attendance_Date >= fromdate && x.Attendance_Date <= toDate).ToList();

                            if (row.Count > 0)
                            {
                                GridViewEMP_AT.DataSource = row.ToList();
                                GridViewEMP_AT.DataBind();
                            }
                            else
                            {
                                GridViewEMP_AT.DataSource = null;
                                GridViewEMP_AT.DataBind();
                            }
                            ///
                        }
                    }
                }
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #10
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);
            }
        }
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                UserDAL               userDAl        = new UserDAL();
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                if (ckIndividualPunishment.Checked)   //individual process
                {
                    if (txtbxEID.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter E-ID!')", true);
                        return;
                    }
                    if (txtDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Attendance Date!')", true);
                        return;
                    }
                    HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();

                    _attendance.EID             = txtbxEID.Text;
                    _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                    _attendance.Remarks         = txtbxremark.Text;
                    _attendance.Edit_User       = ((SessionUser)Session["SessionUser"]).UserId;
                    _attendance.Edit_Date       = DateTime.Now;
                    _attendance.OCode           = ((SessionUser)Session["SessionUser"]).OCode;
                    attendances.Add(_attendance);

                    if (attendances.Count > 0)
                    {
                        List <HRM_EMPLOYEES_VIEWER> lstEmpAttendnace = _attendancebll.GetEmployeesByEidForAttendance(txtbxEID.Text, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text)); //check attendance data

                        if (lstEmpAttendnace.Count > 0)
                        {
                            Guid   UserID     = ((SessionUser)Session["SessionUser"]).UserId;
                            string PunishedBy = userDAl.getEIDbyUserGuidID(UserID);

                            int result = _attendancebll.AttendanceAdjustment(attendances, PunishedBy);

                            if (result == 1)
                            {
                                // insert/update leave/holiday attendnace status process by selected eid
                                aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID(attendances, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                ClearUI();
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Punishment Successfull')", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Attendance Data Found!')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                    }
                }

                else
                {
                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        CheckBox       rowChkBox   = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));
                        HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();
                        if (rowChkBox.Checked == true)
                        {
                            Label   lblEID = ((Label)gvRow.FindControl("lblEID"));
                            TextBox txtbx  = ((TextBox)gvRow.FindControl("txtbx"));

                            _attendance.EID             = lblEID.Text;
                            _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                            _attendance.Remarks         = txtbxremark.Text;
                            _attendance.Edit_User       = ((SessionUser)Session["SessionUser"]).UserId;
                            _attendance.Edit_Date       = DateTime.Now;
                            _attendance.OCode           = ((SessionUser)Session["SessionUser"]).OCode;
                            attendances.Add(_attendance);
                        }
                    }


                    if (attendances.Count > 0)
                    {
                        Guid   UserID     = ((SessionUser)Session["SessionUser"]).UserId;
                        string PunishedBy = userDAl.getEIDbyUserGuidID(UserID);
                        int    result     = _attendancebll.AttendanceAdjustment(attendances, PunishedBy);
                        if (result == 1)
                        {
                            // insert/update leave/holiday attendnace status process by selected eid
                            aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID(attendances, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                            ClearUI();
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Punishment Successfull')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL _attendancebll = new Attendance_BLL();

                if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please 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 (ddlSection.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Section!')", true);
                    return;
                }
                else if (ddlSubSections.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Sub-Section!')", true);
                    return;
                }
                else if (txtDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Date')", true);
                }
                else
                {
                    //sub-section wise process

                    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.EID);
                        aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                        aemployee.DEG_NAME         = aitem.DEG_NAME;
                        aemployee.DATE_JOINED      = Convert.ToDateTime(txtDate.Text);


                        newemployess.Add(aemployee);
                    }

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

                    if (ascendingnewemployees.Count > 0)
                    {
                        grdview.DataSource = ascendingnewemployees;
                        grdview.DataBind();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                        grdview.DataSource = null;
                        grdview.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #14
0
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                foreach (GridViewRow gvRow in grdview.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();

                    if (rowChkBox.Checked == true)
                    {
                        Label   lblEID        = ((Label)gvRow.FindControl("lblEID"));
                        Label   lblWorkingDay = ((Label)gvRow.FindControl("lblWorkingDay"));
                        TextBox txtbx         = ((TextBox)gvRow.FindControl("txtbx"));

                        if (drpEntryType.SelectedValue == "In-Time")
                        {
                            _attendance.In_Time  = TimeSpan.Parse(txtbx.Text);
                            _attendance.Out_Time = TimeSpan.Parse(txtbx.Text);
                        }
                        else
                        {
                            _attendance.In_Time  = TimeSpan.Parse(txtbx.Text);
                            _attendance.Out_Time = TimeSpan.Parse(txtbx.Text);
                        }
                        _attendance.EID                       = lblEID.Text;
                        _attendance.Attendance_Date           = Convert.ToDateTime(txtDate.Text);
                        _attendance.Attendance_Day            = Convert.ToDateTime(txtDate.Text).DayOfWeek.ToString();
                        _attendance.Working_Day               = lblWorkingDay.Text;
                        _attendance.Remarks                   = txtbxremark.Text;
                        _attendance.Attendance_Process_Status = true;
                        _attendance.OCode                     = ((SessionUser)Session["SessionUser"]).OCode;
                        _attendance.Edit_Date                 = DateTime.Now;
                        _attendance.Edit_User                 = ((SessionUser)Session["SessionUser"]).UserId;

                        attendances.Add(_attendance);
                    }
                }

                if (attendances.Count > 0)
                {
                    string type   = drpEntryType.SelectedValue.ToString();
                    int    result = _attendancebll.UpdateAttendance(attendances, type);
                    if (result == 1)
                    {
                        ClearUI();
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                TimeSpan time = TimeSpan.Parse("00:00:00");

                Attendance_BLL _attendancebll         = new Attendance_BLL();
                string         eid                    = txtbxEID.Text.Trim();
                DateTime       fromDate               = Convert.ToDateTime(txtDate.Text);
                DateTime       toDate                 = Convert.ToDateTime(txtToDate.Text);
                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeesByEidForAttendance(eid, fromDate, toDate);

                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           = aitem.EMP_ID;
                        aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                        aemployee.DEG_NAME         = aitem.DEG_NAME;
                        aemployee.AttendanceDate   = aitem.AttendanceDate;

                        //aemployee.In_Time = aitem.In_Time;
                        //aemployee.Out_Time = aitem.Out_Time;



                        if (aitem.In_Time != null)
                        {
                            aemployee.In_Time = aitem.In_Time;
                        }
                        else
                        {
                            aemployee.In_Time = null;
                        }

                        if (aitem.Out_Time != null)
                        {
                            aemployee.Out_Time = aitem.Out_Time;
                        }
                        else
                        {
                            aemployee.Out_Time = null;
                        }

                        aemployee.Status = aitem.Status;
                        newemployess.Add(aemployee);
                    }
                    List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EMP_ID).ToList();

                    if (assendingnewemployess.Count > 0)
                    {
                        //TextBox txtbxInTime = ((TextBox)grdview.FindControl("txtbxIntime"));
                        //TextBox txtbxOutTIme = ((TextBox)grdview.FindControl("txtbxOuttime"));

                        //if (txtbxInTime.Text == "00:00:00")
                        //{

                        //    txtbxInTime.ForeColor = System.Drawing.Color.Red;
                        //    txtbxInTime.BackColor = System.Drawing.Color.Wheat;
                        //}

                        grdview.DataSource = assendingnewemployess;
                        grdview.DataBind();
                    }
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Attendance Data Found!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #16
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);
                    return;
                }
                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 (txtDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Working Date')", true);
                    return;
                }
                else if (ddlworkingType.SelectedItem.ToString() == "Select Day Type")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Day Type')", true);
                    return;
                }
                else if (ddlworkingType.SelectedItem.Text == "------ Select One ------")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Working Day!')", 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, 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.Is_Holiday       = aitem.Is_Holiday;
                                aemployee.Working_Day      = ddlworkingType.SelectedValue;
                                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();
                            }
                        }


                        //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(txtDate.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(txtDate.Text);
                                    aemployee.Is_Holiday       = aitem.Is_Holiday;
                                    aemployee.Working_Day      = ddlworkingType.SelectedValue;
                                    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--" && (ddlSubSections.SelectedValue.ToString() == "" || ddlSubSections.SelectedValue.ToString() == "0" || ddlSection.SelectedValue.ToString() == "" || ddlSection.SelectedValue.ToString() == "0"))
                        {
                            int RegionId = Convert.ToInt32(ddlRegion1.SelectedValue);
                            int OfficeId = Convert.ToInt32(ddlOffice1.SelectedValue);
                            int DeptId   = Convert.ToInt32(ddlDept1.SelectedValue);

                            List <HRM_EMPLOYEES_VIEWER> employess    = _attendancebll.GetEmployeeByDepartmentID(RegionId, OfficeId, 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.Working_Day = ddlworkingType.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
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                        }

                        //office wise process

                        else if (ddlRegion1.SelectedItem.Text != "--Select--" && ddlOffice1.SelectedItem.Text != "--Select--" && ddlDept1.SelectedItem.Text == "--Select--")
                        {
                            List <HRM_EMPLOYEES_VIEWER> employess    = _attendancebll.GetEmployeeByOffice(Convert.ToInt32(ddlOffice1.SelectedValue), 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.Working_Day = ddlworkingType.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
                            {
                                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)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #17
0
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                UserDAL               userDAl        = new UserDAL();
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                //string[] plussign = txtbxOtHour.Text.Split('+');
                //string[] Minsign = txtbxOtHour.Text.Split('-');

                //string psign = plussign[0].ToString();
                //string misign = Minsign[0].ToString();


                //string plussign = txtbxOtHour.Text.ToString();
                //string[] values = plussign.Split('+');
                //string psign = values[1].ToString();

                //string Minsign = txtbxOtHour.Text.ToString();
                //string[] values1 = Minsign.Split('-');
                //string misign = values1[1].ToString();


                //string sign = txtbxOtHour.Text.ToString();
                string sign = txtbxOtHour.Text.Substring(0, 1);
                if (sign == "+" || sign == "-")
                {
                    //CheckBox headerChkBox = ((CheckBox)grdview.HeaderRow.FindControl("headerLevelCheckBox"));
                    //if (headerChkBox.Checked == true)
                    //{
                    //    foreach (GridViewRow gvRow in grdview.Rows)
                    //    {

                    //        HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();
                    //        CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    //        Label lblEID = ((Label)gvRow.FindControl("lblEID"));

                    //        TextBox txtbx = ((TextBox)gvRow.FindControl("txtbx"));


                    //        _attendance.EID = lblEID.Text;
                    //        _attendance.Remarks = txtbxremark.Text;
                    //        _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                    //        attendances.Add(_attendance);
                    //    }
                    //}

                    //else
                    //{
                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                        HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();

                        if (rowChkBox.Checked == true)
                        {
                            Label   lblEID = ((Label)gvRow.FindControl("lblEID"));
                            TextBox txtbx  = ((TextBox)gvRow.FindControl("txtbx"));


                            _attendance.EID             = lblEID.Text;
                            _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                            _attendance.Remarks         = txtbxremark.Text;
                            attendances.Add(_attendance);
                        }
                    }

                    //}
                    string OThour    = Convert.ToString(txtbxOtHour.Text.Trim());
                    Guid   UserID    = ((SessionUser)Session["SessionUser"]).UserId;
                    string apprvedBy = userDAl.getEIDbyUserGuidID(UserID);
                    int    result    = _attendancebll.ManualOTUpdate(attendances, apprvedBy, OThour);
                    if (result == 1)
                    {
                        ClearUI();
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully.')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Use + or - Sign Before Number')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #18
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);
            }
        }
Example #19
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 #20
0
        protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                string   OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                DateTime EDIT_DATE = DateTime.Now;
                Guid     userId    = ((SessionUser)Session["SessionUser"]).UserId;

                Attendance_BLL _attendancebll = new Attendance_BLL();

                List <HRM_AttendanceReason_Individual> lstHRM_AttendanceReason_Individual = new List <HRM_AttendanceReason_Individual>();

                if (chkIndividualShift.Checked)   //individual process
                {
                    for (int i = 0; i < Convert.ToInt16(hdfTotalDay.Value); i++)
                    {
                        if (txtbxEID.Text == "")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter E-ID!')", true);
                            return;
                        }
                        if (txtFromDate.Text == "")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Attendance Date!')", true);
                            return;
                        }

                        HRM_AttendanceReason_Individual _attendance = new HRM_AttendanceReason_Individual();

                        string   shiftCode = hdShiftCode.Value;
                        string   EID       = txtbxEID.Text;
                        DateTime fromdate  = Convert.ToDateTime(txtFromDate.Text);

                        var getAttendancedata = aAttendance_BLL.GetAttendanceByEID_Date(OCODE, EID, Convert.ToDateTime(txtFromDate.Text));

                        List <HRM_AttendanceReason_Individual> a_HRM_AttendanceReason_Individual = aAttendance_BLL.GetHRM_AttendanceReason_Individual(EID, fromdate.AddDays(i));

                        if (a_HRM_AttendanceReason_Individual.Count == 0)  //insert
                        {
                            _attendance.EID        = txtbxEID.Text;
                            _attendance.ReasonDate = fromdate.AddDays(i);
                            _attendance.Remarks    = txtbxremark.Text;
                            _attendance.Status     = "true";
                            _attendance.ShiftCode  = shiftCode;
                            _attendance.OCode      = ((SessionUser)Session["SessionUser"]).OCode;
                            _attendance.Edit_Date  = DateTime.Now;
                            _attendance.Edit_User  = ((SessionUser)Session["SessionUser"]).UserId;

                            TimeSpan start_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                            _attendance.InTime = start_time;

                            TimeSpan end_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttOutTime.Hour, txtAttOutTime.Minute, txtAttOutTime.Second));
                            _attendance.OutTime = end_time;

                            TimeSpan lateAllowed = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtLateAllowed.Hour, txtLateAllowed.Minute, txtLateAllowed.Second));
                            _attendance.LateAllowed = lateAllowed;

                            TimeSpan totalHour, hour1, hour2;

                            if (start_time > end_time)
                            {
                                hour1     = TimeSpan.Parse("23:59:59");
                                hour2     = Calculations.timeDiff(start_time, hour1);
                                totalHour = hour2 + end_time;
                                _attendance.Shift_TotalHour = totalHour;
                            }
                            else
                            {
                                totalHour = Calculations.timeDiff(start_time, end_time);
                                _attendance.Shift_TotalHour = totalHour;
                            }

                            lstHRM_AttendanceReason_Individual.Add(_attendance);

                            _context.HRM_AttendanceReason_Individual.AddObject(_attendance);
                            try
                            {
                                _context.SaveChanges();

                                if (getAttendancedata.Count > 0)
                                {
                                    aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text)); // update attendnace status by date

                                    // insert/update leave/holiday attendnace status process by selected eid
                                    aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID1(lstHRM_AttendanceReason_Individual, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text));

                                    //ot process

                                    List <string> ShiftCodes = aAttendance_BLL.GetAllShiftCode(OCODE).ToList();

                                    foreach (string ashiftcode in ShiftCodes)
                                    {
                                        aAttendance_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text), ashiftcode);
                                    }

                                    //ot process log
                                    var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtFromDate.Text));
                                    var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtFromDate.Text));
                                    var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                                    var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                    var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                    string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                    _context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);
                                    //
                                }

                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                            catch (Exception ex)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                            }
                            //ClearUI();
                        }
                        else   //update
                        {
                            DateTime iDate = fromdate.AddDays(i);
                            foreach (var AttendanceReason in _context.HRM_AttendanceReason_Individual.Where(x => x.EID == EID && x.ReasonDate == iDate))
                            {
                                //AttendanceReason.ReasonDate = Convert.ToDateTime(txtFromDate.Text);
                                AttendanceReason.Remarks   = txtbxremark.Text;
                                AttendanceReason.Status    = "true";
                                AttendanceReason.ShiftCode = shiftCode;
                                AttendanceReason.OCode     = ((SessionUser)Session["SessionUser"]).OCode;
                                AttendanceReason.Edit_Date = DateTime.Now;
                                AttendanceReason.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;

                                TimeSpan start_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                AttendanceReason.InTime = start_time;

                                TimeSpan end_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttOutTime.Hour, txtAttOutTime.Minute, txtAttOutTime.Second));
                                AttendanceReason.OutTime = end_time;

                                TimeSpan lateAllowed = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtLateAllowed.Hour, txtLateAllowed.Minute, txtLateAllowed.Second));
                                _attendance.LateAllowed = lateAllowed;

                                TimeSpan totalHour, hour1, hour2;

                                if (start_time > end_time)
                                {
                                    hour1     = TimeSpan.Parse("23:59:59");
                                    hour2     = Calculations.timeDiff(start_time, hour1);
                                    totalHour = hour2 + end_time;
                                    AttendanceReason.Shift_TotalHour = totalHour;
                                }
                                else
                                {
                                    totalHour = Calculations.timeDiff(start_time, end_time);
                                    AttendanceReason.Shift_TotalHour = totalHour;
                                }
                                lstHRM_AttendanceReason_Individual.Add(_attendance);
                            }
                            try
                            {
                                _context.SaveChanges();

                                if (getAttendancedata.Count > 0)
                                {
                                    aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text)); // update attendnace status by date

                                    // insert/update leave/holiday attendnace status process by selected eid
                                    aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID1(lstHRM_AttendanceReason_Individual, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text));

                                    //ot process

                                    List <string> ShiftCodes = aAttendance_BLL.GetAllShiftCode(OCODE).ToList();

                                    foreach (string ashiftcode in ShiftCodes)
                                    {
                                        aAttendance_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text), ashiftcode);
                                    }

                                    //ot process log
                                    var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtFromDate.Text));
                                    var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtFromDate.Text));
                                    var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                                    var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                    var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                    string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                    _context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);

                                    //
                                }

                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);
                                grdview.DataSource = null;
                                grdview.DataBind();
                            }
                            catch (Exception ex)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                            }
                        }
                    }
                    ClearUI();
                }

                else // dept/section/subsection wise process
                {
                    if (grdview.Rows.Count < 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                        return;
                    }



                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        for (int i = 0; i < Convert.ToInt16(hdfTotalDay.Value); i++)
                        {
                            CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                            HRM_AttendanceReason_Individual _attendance = new HRM_AttendanceReason_Individual();
                            Label    lblEID       = ((Label)gvRow.FindControl("lblEID"));
                            Label    lblShiftCode = ((Label)gvRow.FindControl("lblShiftCode"));
                            string   shiftCode    = lblShiftCode.Text;
                            string   EID          = lblEID.Text;
                            DateTime fromdate     = Convert.ToDateTime(txtFromDate.Text);

                            List <HRM_AttendanceReason_Individual> a_HRM_AttendanceReason_Individual = aAttendance_BLL.GetHRM_AttendanceReason_Individual(EID, fromdate.AddDays(i));

                            //var getAttendancedata = aAttendance_BLL.GetAttendanceByEID_Date(OCODE, EID, fromdate);

                            if (rowChkBox.Checked == true)
                            {
                                if (a_HRM_AttendanceReason_Individual.Count == 0)  //insert
                                {
                                    _attendance.EID        = lblEID.Text;
                                    _attendance.ReasonDate = fromdate.AddDays(i);
                                    _attendance.Remarks    = txtbxremark.Text;
                                    _attendance.Status     = "true";
                                    _attendance.ShiftCode  = shiftCode;
                                    _attendance.OCode      = ((SessionUser)Session["SessionUser"]).OCode;
                                    _attendance.Edit_Date  = DateTime.Now;
                                    _attendance.Edit_User  = ((SessionUser)Session["SessionUser"]).UserId;

                                    TimeSpan start_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                    _attendance.InTime = start_time;

                                    TimeSpan end_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttOutTime.Hour, txtAttOutTime.Minute, txtAttOutTime.Second));
                                    _attendance.OutTime = end_time;

                                    TimeSpan lateAllowed = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtLateAllowed.Hour, txtLateAllowed.Minute, txtLateAllowed.Second));
                                    _attendance.LateAllowed = lateAllowed;

                                    TimeSpan totalHour, hour1, hour2;

                                    if (start_time > end_time)
                                    {
                                        hour1     = TimeSpan.Parse("23:59:59");
                                        hour2     = Calculations.timeDiff(start_time, hour1);
                                        totalHour = hour2 + end_time;
                                        _attendance.Shift_TotalHour = totalHour;
                                    }
                                    else
                                    {
                                        totalHour = Calculations.timeDiff(start_time, end_time);
                                        _attendance.Shift_TotalHour = totalHour;
                                    }

                                    lstHRM_AttendanceReason_Individual.Add(_attendance);

                                    _context.HRM_AttendanceReason_Individual.AddObject(_attendance); //insert
                                    try
                                    {
                                        _context.SaveChanges();

                                        //if (getAttendancedata.Count > 0)
                                        //{
                                        //aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text)); // update attendnace status by date

                                        // insert/update leave/holiday attendnace status process by selected eid
                                        //aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID1(lstHRM_AttendanceReason_Individual, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text));

                                        //ot process

                                        //List<string> ShiftCodes = aAttendance_BLL.GetAllShiftCode(OCODE).ToList();

                                        //foreach (string ashiftcode in ShiftCodes)
                                        //{
                                        //    aAttendance_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text), ashiftcode);
                                        //}

                                        ////ot process log
                                        //var ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtFromDate.Text));
                                        //var ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtFromDate.Text));
                                        //var ParamempID3 = new SqlParameter("@Edit_User", userId);
                                        //var ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                        //var ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                        //string SP_SQL = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                        //_context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);

                                        //
                                        //}

                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);
                                        grdview.DataSource = null;
                                        grdview.DataBind();
                                    }
                                    catch (Exception ex)
                                    {
                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                                    }
                                }
                                else  //update
                                {
                                    DateTime iDate = fromdate.AddDays(i);

                                    foreach (var AttendanceReason in _context.HRM_AttendanceReason_Individual.Where(x => x.EID == EID && x.ReasonDate == iDate))
                                    {
                                        AttendanceReason.Remarks   = txtbxremark.Text;
                                        AttendanceReason.Status    = "true";
                                        AttendanceReason.ShiftCode = shiftCode;
                                        AttendanceReason.OCode     = ((SessionUser)Session["SessionUser"]).OCode;
                                        AttendanceReason.Edit_Date = DateTime.Now;
                                        AttendanceReason.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;

                                        TimeSpan start_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                                        AttendanceReason.InTime = start_time;

                                        TimeSpan end_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttOutTime.Hour, txtAttOutTime.Minute, txtAttOutTime.Second));
                                        AttendanceReason.OutTime = end_time;

                                        TimeSpan lateAllowed = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtLateAllowed.Hour, txtLateAllowed.Minute, txtLateAllowed.Second));
                                        _attendance.LateAllowed = lateAllowed;

                                        TimeSpan totalHour, hour1, hour2;

                                        if (start_time > end_time)
                                        {
                                            hour1     = TimeSpan.Parse("23:59:59");
                                            hour2     = Calculations.timeDiff(start_time, hour1);
                                            totalHour = hour2 + end_time;
                                            AttendanceReason.Shift_TotalHour = totalHour;
                                        }
                                        else
                                        {
                                            totalHour = Calculations.timeDiff(start_time, end_time);
                                            AttendanceReason.Shift_TotalHour = totalHour;
                                        }

                                        lstHRM_AttendanceReason_Individual.Add(AttendanceReason);
                                    }
                                    try
                                    {
                                        _context.SaveChanges();   //update

                                        //if (getAttendancedata.Count > 0)
                                        //{
                                        //aAttendance_RPT_Bll.UpdateAll_AttStatus_ByDate(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text)); // update attendnace status by date

                                        // insert/update leave/holiday attendnace status process by selected eid
                                        //aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID1(lstHRM_AttendanceReason_Individual, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text));

                                        //ot process

                                        //List<string> ShiftCodes = aAttendance_BLL.GetAllShiftCode(OCODE).ToList();

                                        //foreach (string ashiftcode in ShiftCodes)
                                        //{
                                        //    aAttendance_BLL.UpdateOT_ByDateandShift(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtFromDate.Text), ashiftcode);
                                        //}

                                        ////ot process log
                                        //var ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(txtFromDate.Text));
                                        //var ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(txtFromDate.Text));
                                        //var ParamempID3 = new SqlParameter("@Edit_User", userId);
                                        //var ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                                        //var ParamempID5 = new SqlParameter("@OCODE", OCODE);
                                        //string SP_SQL = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                                        //_context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);

                                        //
                                        //}

                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Processed Successfully')", true);
                                        grdview.DataSource = null;
                                        grdview.DataBind();
                                    }
                                    catch (Exception ex)
                                    {
                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                                    }
                                }
                            }
                        }
                    }



                    ClearUI();
                }
            }
            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);
            }
        }
        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);
            }
        }
        protected void btnShow_Click(object sender, EventArgs e)
        {
            try
            {
                if (chSalaryIncrementStatus.Checked)   // individual process
                {
                    Attendance_BLL _attendancebll         = new Attendance_BLL();
                    string         eid                    = txtbxEID.Text.Trim();
                    List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeesByE_id(eid, Convert.ToDateTime(txtbxEffectiveDate.Text));

                    if (employess.Count > 0)
                    {
                        if (chSalaryIncrementStatus.Checked)
                        {
                            grdviewIndivitual.DataSource = employess;
                            grdviewIndivitual.DataBind();
                        }
                        else
                        {
                            grdview.DataSource = employess;
                            grdview.DataBind();
                        }
                    }
                }
                else    //dept/section/subsection wise process
                {
                    if (ddlRegion1.SelectedItem.ToString() == "--Select--")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Region!')", true);
                        return;
                    }
                    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 (txtbxEffectiveDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Effective Date!')", true);
                        return;
                    }
                    else
                    {
                        try
                        {
                            Attendance_BLL _attendancebll = new Attendance_BLL();
                            if (ddlSubSections.SelectedValue.ToString() == "" || ddlSubSections.SelectedValue.ToString() == "0" || ddlSection.SelectedValue.ToString() == "" || ddlSection.SelectedValue.ToString() == "0")
                            {
                                int RegionId = Convert.ToInt32(ddlRegion1.SelectedValue);
                                int OfficeId = Convert.ToInt32(ddlOffice1.SelectedValue);
                                int DeptId   = Convert.ToInt32(ddlDept1.SelectedValue);

                                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeeByDepartment(RegionId, OfficeId, DeptId, Convert.ToDateTime(txtbxEffectiveDate.Text));

                                if (employess.Count > 0)
                                {
                                    if (chSalaryIncrementStatus.Checked)
                                    {
                                        grdviewIndivitual.DataSource = employess;
                                        grdviewIndivitual.DataBind();
                                    }
                                    else
                                    {
                                        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.GetEmployeeBySubsectionWise(ResionId, OfficeId, DeptId, sction, subsction, Convert.ToDateTime(txtbxEffectiveDate.Text));

                                if (employess.Count > 0)
                                {
                                    if (chSalaryIncrementStatus.Checked)
                                    {
                                        grdviewIndivitual.DataSource = employess;
                                        grdviewIndivitual.DataBind();
                                    }
                                    else
                                    {
                                        grdview.DataSource = employess;
                                        grdview.DataBind();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
                        }
                    }
                }
                btnConfirm.Visible = true;
            }
            catch (Exception ex)
            {
                string EID = Convert.ToString(((SessionUser)Session["SessionUser"]).EID);
                //LogController<SalaryIncrementList>.SetLog(ex, EID);
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }