Esempio n. 1
0
        public ActionResult NonTechTeamTimeEntry()
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();
            TeamEntryData model = new TeamEntryData();

            try
            {
                int userId   = Convert.ToInt32(Session["UserID"]);
                int BranchId = (int)objdb.Users.FirstOrDefault(o => o.UserID == userId).BranchId;
                model.MemberList   = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                model.IsTeamData   = true;
                model.DateFrom     = DateTime.Today.AddDays(-1).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                model.DateTo       = DateTime.Today.AddDays(-1).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                model.EmployeeData = TimeEntryHelper.GetTeamMemberData1(teamMembers: model.MemberList, Date: DateTime.Today.AddDays(-1), BranchId: BranchId);
                MonthList();
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult NonTechTeamTimeEntry(TeamEntryData model, FormCollection form)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();

            try
            {
                MonthList();
                int userId   = Convert.ToInt32(Session["UserID"]);
                int BranchId = (int)objdb.Users.FirstOrDefault(o => o.UserID == userId).BranchId;
                model.MemberList = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                model.IsTeamData = model.MemberId == "0";
                DateTime FromDate = DateTime.ParseExact(model.DateFrom, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                if (model.ListMonth == null)
                {
                    if (model.IsTeamData)
                    {
                        model.EmployeeData = TimeEntryHelper.GetTeamMemberData1(teamMembers: model.MemberList, Date: FromDate, BranchId: BranchId);
                    }
                    else
                    {
                        DateTime ToDate = DateTime.ParseExact(model.DateTo, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        model.EmployeeData = TimeEntryHelper.GetSingleMemberData(EmpId: model.MemberId, FromDate: FromDate, ToDate: ToDate, IsAscending: true, BranchId: BranchId);
                    }
                }
                else
                {
                    DateTime time  = new DateTime(2015, Convert.ToInt32(model.ListMonth), 1);
                    var      dtfrm = FirstDayOfMonthFromDateTime(time).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                    var      dtTo  = LastDayOfMonthFromDateTime(time).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                    DateTime FrmDt = DateTime.ParseExact(dtfrm, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    DateTime ToDt  = DateTime.ParseExact(dtTo, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    model.EmployeeData = TimeEntryHelper.GetSingleMemberData(EmpId: model.MemberId, FromDate: FrmDt, ToDate: ToDt, IsAscending: true, BranchId: BranchId);
                }
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }

            return(View(model));
        }