Example #1
0
        //[DSRCAuthorize(Roles = "Vice President, Project Manager,Assistant Manager-Recruitment, Tech Lead,Business Development Manager,Vice President - Marketing,Coo/Executive Vice President,Manager - Engineer,Head - Quality")]
        public ActionResult MembersTimeEntry(TeamEntryData model)
        {
            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();

            try
            {
                int userId = Convert.ToInt32(Session["UserID"]);
                model.MemberList = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                model.IsTeamData = model.MemberId == "0";
                model.BranchID   = (int)db.Users.FirstOrDefault(o => o.UserID == userId).BranchId;

                //if (model.DateFrom != null)
                //{
                DateTime FromDate = DateTime.ParseExact(model.DateFrom, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                if (model.IsTeamData)
                {
                    model.EmployeeData = TimeEntryHelper.GetTeamMemberData(teamMembers: model.MemberList, Date: FromDate, IsAscending: model.IsSorting.Equals("true"), BranchId: model.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: model.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));
        }
Example #2
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));
        }
Example #3
0
        public ActionResult TeamTimeEntry(FormCollection form)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();
            ProjectMapping ObjPM = new ProjectMapping();
            TeamEntryData  obj   = new TeamEntryData();

            try
            {
                var curmonth = DateTime.Now.Month;
                var month    = objdb.Master_TeamMonths.Where(o => o.Id < curmonth).ToList();
                var userId   = (int)Session["UserId"];
                int BranchID = (int)objdb.Users.FirstOrDefault(o => o.UserID == userId).BranchId;
                ViewBag.Months            = new SelectList(month, "Id", "Months", (curmonth - 1));
                ViewBag.Projects          = new SelectList(LoadProjects(), "ProjectID", "ProjectName");
                ObjPM.Members             = GetMembers(obj);
                obj.ProjectMembersDetails = GetMembers(obj);
                obj.MemberList            = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                obj.IsTeamData            = true;
                obj.DateFrom     = DateTime.Today.AddDays(-1).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                obj.DateTo       = DateTime.Today.AddDays(-1).ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
                obj.EmployeeData = TimeEntryHelper.GetTeamMemberData(teamMembers: obj.MemberList, Date: DateTime.Today.AddDays(-1), 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(obj));
        }
Example #4
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));
        }
Example #5
0
        // [DSRCAuthorize(Roles = "Vice President, Project Manager, Tech Lead,Head - Quality")]
        public ActionResult TeamTimeEntry(ProjectMapping ObjPM, TeamEntryData teamobj, FormCollection form)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();
            ViewMembers   obj1 = new ViewMembers();
            TeamEntryData obj  = new TeamEntryData();

            try
            {
                int    userId    = (int)(Session["UserID"]);
                int    BranchID  = (int)objdb.Users.FirstOrDefault(o => o.UserID == userId).BranchId;
                string projectID = (form["ProjectList"] == "") ? "0" : form["ProjectList"].ToString();
                int    PId       = Convert.ToInt32(projectID);
                ViewBag.Projects = new SelectList(LoadProjects(), "ProjectID", "ProjectName", projectID);

                //if (Convert.ToInt32(teamobj.MemberId) == 0 || teamobj.MemberId==null)
                if (teamobj.MemberId == null || teamobj.MemberId == "0")
                {
                    obj.ProjectMembersDetails = GetMembers(teamobj, PId);
                    obj.MemberList            = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                    obj.IsTeamData            = true;
                    obj.MemberId = "0";
                }
                else
                {
                    obj.ProjectMembersDetails = null;


                    obj.MemberList = TimeEntryHelper.GetTeamMemberList(UserId: userId);
                    obj.IsTeamData = obj.MemberId == "0";
                }
                if (Convert.ToString(form["DateFrom"]) != null)
                {
                    DateTime FDate = DateTime.ParseExact(Convert.ToString(form["DateFrom"]), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    if (obj.IsTeamData)
                    {
                        //obj.EmployeeData = TimeEntryHelper.GetTeamMemberData(teamMembers: obj.MemberList, Date: FDate, IsAscending:true, BranchId: BranchID);

                        obj.EmployeeData = TimeEntryHelper.GetTeamMemberData(teamMembers: obj.ProjectMembersDetails as List <TeamMember>, Date: FDate, IsAscending: true, BranchId: BranchID);
                    }
                    else
                    {
                        DateTime ToDate = DateTime.ParseExact(form["DateTo"], "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        obj.EmployeeData = null;
                        obj.EmployeeData = TimeEntryHelper.GetSingleMemberData(EmpId: teamobj.MemberId, FromDate: FDate, ToDate: ToDate, IsAscending: true, BranchId: BranchID);
                        if (ToDate == FDate)
                        {
                            int count = Convert.ToInt32((ToDate - FDate).TotalDays + 1);
                            ViewData["totaldays"] = count;
                        }
                        else
                        {
                            int count = Convert.ToInt32((ToDate - FDate).TotalDays + 1);
                            ViewData["totaldays"] = count;
                        }
                    }
                }

                var    holidaysCount = 0;
                double businessDays  = 0;
                using (var dbhrms = new DSRCManagementSystemEntities1())
                {
                    var FromDate = Convert.ToDateTime(obj.DateFrom);
                    var ToDate   = Convert.ToDateTime(obj.DateTo);
                    foreach (var item in dbhrms.Master_holiday.Where(holiday => holiday.Date >= FromDate && holiday.Date <= ToDate))
                    {
                        if (item.Date != null)
                        {
                            var tempDate = ((DateTime)item.Date);
                            if (tempDate.DayOfWeek != DayOfWeek.Saturday && tempDate.DayOfWeek != DayOfWeek.Sunday)
                            {
                                holidaysCount++;
                            }
                        }
                    }
                    businessDays = 1 + ((ToDate - FromDate).TotalDays * 5 - (FromDate.DayOfWeek - ToDate.DayOfWeek) * 2) / 7 - holidaysCount;
                }
                ViewBag.businessDays = businessDays;
            }
            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(obj));
        }