예제 #1
0
 //For employees
 protected void chkCtrlEmp_CheckedChanged(object sender, EventArgs e)
 {
     foreach (GridViewRow row in grid_Employee.Rows)
     {
         CheckBox ck       = ((CheckBox)row.FindControl("chkCtrlEmp"));
         EmpView  _EmpView = new EmpView();
         _EmpView.EmpID   = Convert.ToInt32(row.Cells[1].Text);
         _EmpView.EmpName = row.Cells[3].Text;
         if (ck.Checked)
         {
             if (SelectedEmps.Where(aa => aa.EmpID == _EmpView.EmpID).Count() == 0)
             {
                 SelectedEmps.Add(_EmpView);
             }
         }
         else
         {
             if (SelectedEmps.Where(aa => aa.EmpID == _EmpView.EmpID).Count() > 0)
             {
                 var _emp = SelectedEmps.Where(aa => aa.EmpID == _EmpView.EmpID).First();
                 SelectedEmps.Remove(_emp);
             }
         }
     }
 }
예제 #2
0
        void populateEmpview()
        {
            DataTable dt = new DataTable();
            string    cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                string sqlString = "SELECT Emp_ID,First_Name,Last_Name,Email,Mobile_number,DOB FROM Employee_Master_Table";
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter(sqlString, con);

                sda.Fill(dt);
            }
            if (dt.Rows.Count > 0)
            {
                EmpView.DataSource = dt;
                EmpView.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                EmpView.DataSource = dt;
                EmpView.DataBind();
                EmpView.Rows[0].Cells.Clear();
                EmpView.Rows[0].Cells.Add(new TableCell());
                EmpView.Rows[0].Cells[0].ColumnSpan      = dt.Columns.Count;
                EmpView.Rows[0].Cells[0].Text            = "No Data Found";
                EmpView.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
            }
        }
        void populateEmpview()
        {
            DataTable dt = new DataTable();
            string    cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                string sqlString = "SELECT Emp_ID,User_Name,Date,Start_Time,End_Time,Project_Name FROM Time_sheet T JOIN Project_Master_table P on E.Project_ID = P.Project_ID JOIN Employee_Master_Table E on E.Emp_ID =";
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter(sqlString, con);

                sda.Fill(dt);
            }
            if (dt.Rows.Count > 0)
            {
                EmpView.DataSource = dt;
                EmpView.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                EmpView.DataSource = dt;
                EmpView.DataBind();
                EmpView.Rows[0].Cells.Clear();
                EmpView.Rows[0].Cells.Add(new TableCell());
                EmpView.Rows[0].Cells[0].ColumnSpan      = dt.Columns.Count;
                EmpView.Rows[0].Cells[0].Text            = "No Data Found";
                EmpView.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
            }
        }
        void populateProject()
        {
            DataTable dt = new DataTable();
            string    cs = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(cs))
            {
                string sqlString = "SELECT Project_ID,Project_Name,Project_Description FROM Project_Master_table";
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter(sqlString, con);

                sda.Fill(dt);
            }
            if (dt.Rows.Count > 0)
            {
                EmpView.DataSource = dt;
                EmpView.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                EmpView.DataSource = dt;
                EmpView.DataBind();
                EmpView.Rows[0].Cells.Clear();
                EmpView.Rows[0].Cells.Add(new TableCell());
                EmpView.Rows[0].Cells[0].ColumnSpan      = dt.Columns.Count;
                EmpView.Rows[0].Cells[0].Text            = "No Data Found";
                EmpView.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
            }
        }
예제 #5
0
        public ActionResult edit(EmpView empv)
        {
            if (ModelState.IsValid)
            {
                //Update
            }

            return(RedirectToAction("index"));
        }
예제 #6
0
        public ActionResult get(int id)
        {
            EmpModel emp = _dbcomp.GetEmp(id);

            MapperConfiguration config = new MapperConfiguration(m => m.CreateMap <EmpModel, EmpView>());
            var     mapper             = config.CreateMapper();
            EmpView empv = new EmpView();

            mapper.Map(emp, empv);

            return(View("Emp", empv));
        }
예제 #7
0
        public ActionResult getedit(int id)
        {
            EmpModel emp = _dbcomp.GetEmp(id);

            MapperConfiguration config = new MapperConfiguration(m => m.CreateMap <EmpModel, EmpView>());
            var     mapper             = config.CreateMapper();
            EmpView empv = new EmpView();

            mapper.Map(emp, empv);

            ViewBag.genderlist = new SelectList(empv.genderList, "id", "type", 2);

            return(View("Empedit", empv));
        }
예제 #8
0
        public ActionResult add(EmpView empv)
        {
            if (ModelState.IsValid)
            {
                //Save

                MapperConfiguration config = new MapperConfiguration(m => m.CreateMap <EmpView, EmpModel>());
                var      mapper            = config.CreateMapper();
                EmpModel emp = new EmpModel();
                mapper.Map(empv, emp);

                _dbcomp.AddEmp(emp);
            }
            else
            {
                var res = new ViewResult()
                {
                    ViewName = "Error"
                };
                StringBuilder ss = new StringBuilder();
                foreach (var modelError in ModelState)
                {
                    string propertyName = modelError.Key;
                    if (modelError.Value.Errors.Count > 0)
                    {
                        foreach (var err in modelError.Value.Errors)
                        {
                            ss.Append("\n" + err.ErrorMessage);
                        }
                    }
                }
                res.TempData["error"] = ss.ToString();

                return(res);
            }

            return(RedirectToAction("index"));
        }
예제 #9
0
        internal static bool IsValidDailyOT(IEnumerable <ViewDailyOTEntry> TempattOts, EmpView emp)
        {
            bool check = false;

            foreach (var item in TempattOts)
            {
                if (item.DutyCode == "D")
                {
                    if (emp.CalculateNOT == true)
                    {
                        if (emp.PerDayOTStartLimitHour > 0)
                        {
                            //int ClaimOT = (int)(item.ApprovedOTMin / 60);
                            int ClaimOT = (int)(item.ApprovedOTMin);
                            if (ClaimOT >= emp.PerDayOTStartLimitHour && ClaimOT <= emp.PerDayOTEndLimitHour)
                            {
                            }
                            else
                            {
                                check = true;
                            }
                        }
                    }
                }
                else if (item.DutyCode == "R")
                {
                    if (emp.CalculateRestOT == true)
                    {
                        if (emp.PerDayROTStartLimitHour > 0)
                        {
                            int ClaimOT = (int)(item.ApprovedOTMin / 60);
                            if (ClaimOT >= emp.PerDayROTStartLimitHour && ClaimOT <= emp.PerDayROTEndLimitHour)
                            {
                            }
                            else
                            {
                                check = true;
                            }
                        }
                    }
                }
                else if (item.DutyCode == "G")
                {
                    if (emp.CalculateGZOT == true)
                    {
                        if (emp.PerDayGOTStartLimitHour > 0)
                        {
                            int ClaimOT = (int)(item.ApprovedOTMin / 60);
                            if (ClaimOT >= emp.PerDayGOTStartLimitHour && ClaimOT <= emp.PerDayGOTEndLimitHour)
                            {
                            }
                            else
                            {
                                check = true;
                            }
                        }
                    }
                }
            }
            return(check);
        }
예제 #10
0
        public VMAttMnDataPer processPermanentMonthlyAttSingle(DateTime startDate, DateTime endDate, EmpView _Emp, List <AttData> _EmpAttData)
        {
            //Get Attendance data of employee according to selected month
            _attMonth = new VMAttMnDataPer();
            try
            {
                EmpAttData = _EmpAttData;
            }
            catch (Exception ex)
            {
            }
            string EmpMonth = _Emp.EmpID + endDate.Date.Month.ToString();

            //Check for already processed data
            _attMonth.StartDate = startDate;
            _attMonth.EndDate   = endDate;
            TDays       = 0;
            WorkDays    = 0;
            PresentDays = 0;
            AbsentDays  = 0;
            LeaveDays   = 0;
            RestDays    = 0;
            GZDays      = 0;
            EarlyIn     = 0;
            EarlyOut    = 0;
            LateIn      = 0;
            LateOut     = 0;
            WorkTime    = 0;
            NOT         = 0;
            GOT         = 0;
            TDays       = Convert.ToByte((endDate - startDate).Days + 1);
            CalculateMonthlyAttendanceSheet(EmpAttData);
            _attMonth.Period   = endDate.Date.Month.ToString() + endDate.Date.Year.ToString();
            _attMonth.EmpMonth = EmpMonth;
            _attMonth.EmpID    = _Emp.EmpID;
            _attMonth.EmpNo    = _Emp.EmpNo;
            _attMonth.EmpName  = _Emp.EmpName;
            return(_attMonth);
        }
예제 #11
0
        public AttMnDataPer processPermanentMonthlyAttSingle(DateTime startDate, DateTime endDate, EmpView _Emp, List <AttData> _EmpAttData)
        {
            //Get Attendance data of employee according to selected month
            _attMonth = new AttMnDataPer();
            try
            {
                EmpAttData = _EmpAttData;
            }
            catch (Exception ex)
            {
            }
            string EmpMonth = _Emp.EmpID + endDate.Date.Month.ToString();

            //Check for already processed data
            _attMonth.StartDate        = startDate;
            _attMonth.EndDate          = endDate;
            _attMonth.PreDays          = 0;
            _attMonth.WorkDays         = 0;
            _attMonth.AbDays           = 0;
            _attMonth.LeaveDays        = 0;
            _attMonth.OfficialDutyDays = 0;
            _attMonth.ExpectedWrkTime  = 0;
            _attMonth.GZDays           = 0;
            _attMonth.RestDays         = 0;
            _attMonth.TEarlyIn         = 0;
            _attMonth.TEarlyOut        = 0;
            _attMonth.TGZOT            = 0;
            _attMonth.TLateIn          = 0;
            _attMonth.TLateOut         = 0;
            _attMonth.TNOT             = 0;
            _attMonth.TotalDays        = 0;
            _attMonth.TWorkTime        = 0;
            _attMonth.OT1  = 0;
            _attMonth.OT2  = 0;
            _attMonth.OT3  = 0;
            _attMonth.OT4  = 0;
            _attMonth.OT5  = 0;
            _attMonth.OT6  = 0;
            _attMonth.OT7  = 0;
            _attMonth.OT8  = 0;
            _attMonth.OT9  = 0;
            _attMonth.OT10 = 0;
            _attMonth.OT11 = 0;
            _attMonth.OT12 = 0;
            _attMonth.OT13 = 0;
            _attMonth.OT14 = 0;
            _attMonth.OT15 = 0;
            _attMonth.OT16 = 0;
            _attMonth.OT17 = 0;
            _attMonth.OT18 = 0;
            _attMonth.OT19 = 0;
            _attMonth.OT20 = 0;
            _attMonth.OT21 = 0;
            _attMonth.OT22 = 0;
            _attMonth.OT23 = 0;
            _attMonth.OT24 = 0;
            _attMonth.OT25 = 0;
            _attMonth.OT26 = 0;
            _attMonth.OT27 = 0;
            _attMonth.OT28 = 0;
            _attMonth.OT29 = 0;
            _attMonth.OT30 = 0;
            _attMonth.OT31 = 0;
            TDays          = 0;
            WorkDays       = 0;
            PresentDays    = 0;
            AbsentDays     = 0;
            LeaveDays      = 0;
            RestDays       = 0;
            GZDays         = 0;
            EarlyIn        = 0;
            EarlyOut       = 0;
            LateIn         = 0;
            LateOut        = 0;
            WorkTime       = 0;
            NOT            = 0;
            GOT            = 0;
            TDays          = Convert.ToByte((endDate - startDate).Days + 1);
            CalculateMonthlyAttendanceSheet(EmpAttData);
            _attMonth.Period   = endDate.Date.Month.ToString() + endDate.Date.Year.ToString();
            _attMonth.EmpMonth = EmpMonth;
            _attMonth.EmpID    = _Emp.EmpID;
            _attMonth.EmpNo    = _Emp.EmpNo;
            _attMonth.EmpName  = _Emp.EmpName;
            return(_attMonth);
        }
예제 #12
0
        public ActionResult addnew()
        {
            EmpView empv = new EmpView();

            return(View("Empedit", empv));
        }