Example #1
0
 public ActionResult ScheduleAttendees()
 {
     try
     {
         DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
         int userId        = Convert.ToInt32(Session["UserID"]);
         var FilteredUsers =
             db.Users.Where(
                 u => u.IsActive == true && u.UserStatus != 6)
             .Select(x => x.UserID)
             .ToList()
             .
             Except(
                 db.MeetingGuids
                 .Select(x => x.UserId.Value)
                 .ToList()).ToList();
         List <object> UnAuthUsers = new List <object>();
         foreach (int users in FilteredUsers)
         {
             UnAuthUsers.AddRange(
                 db.Users.Where(u => u.UserID == users)
                 .Select(u => new { userid = u.UserID, username = u.FirstName + " " + (u.LastName.Length > 0 ? u.LastName : "") })
                 .ToList());
         }
         ViewBag.UnAuthorizedUsers = new SelectList(UnAuthUsers, "userid", "username");
     }
     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());
 }
        public ActionResult ManageActivities()
        {
            List <DSRCManagementSystem.Models.ManageActivities> objmodel = new List <Models.ManageActivities>();

            try{
                List <ManageActivities> Value = new List <ManageActivities>();
                Value = (from a in db.Activities
                         where (a.IsActive == true)



                         select new ManageActivities()
                {
                    ActivityId = a.ActivityID,
                    ActivityName = a.Activity1,
                    ActivityDescription = a.ActivityDescription,
                }).OrderBy(o => o.ActivityName).ToList();
                foreach (var x in Value)
                {
                    objmodel.Add(x);
                }
            }
            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(objmodel));
        }
Example #3
0
        public ActionResult GetDepartments(int BranchId)
        {
            DSRCManagementSystemEntities1 db           = new DSRCManagementSystemEntities1();
            IEnumerable <SelectListItem>  FilterDepart = new List <SelectListItem>();

            try
            {
                if (BranchId != 0)
                {
                    List <int> validDepart = new List <int>();

                    validDepart = db.Departments.Where(d => d.BranchID == BranchId && d.IsActive == true).Select(d => d.DepartmentId).ToList();

                    FilterDepart = (from lt in db.Departments.Where(o => validDepart.Contains(o.DepartmentId))
                                    select new FilterDepartment()
                    {
                        DepartmentId = lt.DepartmentId,
                        DepartmentName = lt.DepartmentName
                    }).AsEnumerable().Select(m => new SelectListItem()
                    {
                        Value = Convert.ToString(m.DepartmentId), Text = m.DepartmentName
                    });
                }
                return(Json(new SelectList(FilterDepart, "Value", "Text"), JsonRequestBehavior.AllowGet));
            }
            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());
        }
Example #4
0
        public string SaveApplicationSetting(EmailConfigure data)
        {
            try
            {
                DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
                var Host = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "Host Name");
                Host.AppValue = data.Host;

                var Port = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "Port");
                Port.AppValue = data.Port.ToString();

                var UserName = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "UserName");
                UserName.AppValue = data.UserName.Trim();

                var Password = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "Password");
                Password.AppValue = data.Password;

                var From = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "From");
                From.AppValue = data.From.Trim();

                var To = db.Master_ApplicationSettings.FirstOrDefault(o => o.AppKey == "To");
                To.AppValue = data.To.Trim();

                db.SaveChanges();
                return("success");
            }
            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("failed");
            }
        }
        public ActionResult ManageRoll()
        {
            try
            {
                DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();

                var rolldetails = (from u in db.CustomReports
                                   where u.IsActive == true
                                   select new ReportMOD()
                {
                    ReportID = u.ReportID,
                    Name = u.ReportName,
                    Description = u.ReportDescription,
                    sp = u.ReportQuery
                }).ToList();
                return(View(rolldetails));
            }
            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(Json("Failed", JsonRequestBehavior.AllowGet));
            }
        }
Example #6
0
        public ActionResult ShowFeedback()
        {
            var Result = new List <Feedback>();

            try
            {
                Result = (from fb in db.UsersFeedbacks
                          join us in db.Users on fb.UserID equals us.UserID
                          select new Feedback()
                {
                    FeedbackId = fb.Id,
                    UserName = us.FirstName + " " + (us.LastName ?? ""),
                    Feedbacks = fb.Feedback,
                    FeedbackDate = fb.FeedbackDate,
                }).OrderByDescending(x => x.FeedbackDate).ThenByDescending(x => x.FeedbackDate.Month).ThenByDescending(x => x.FeedbackDate.Year).ToList();
                return(View(Result));
            }
            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(Result));
        }
Example #7
0
        public ActionResult SendMail()
        {
            EmailConfigure MailObj = new EmailConfigure();

            try{
                DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
                var AppSettings = db.Master_ApplicationSettings.Select(o => o).ToList();
                MailObj.Host            = AppSettings.FirstOrDefault(o => o.AppKey == "Host Name").AppValue;
                MailObj.Port            = Convert.ToInt32(AppSettings.FirstOrDefault(o => o.AppKey == "Port").AppValue);
                MailObj.UserName        = AppSettings.FirstOrDefault(o => o.AppKey == "UserName").AppValue;
                MailObj.Password        = AppSettings.FirstOrDefault(o => o.AppKey == "Password").AppValue;
                MailObj.ConfirmPassword = AppSettings.FirstOrDefault(o => o.AppKey == "Password").AppValue;
                MailObj.From            = AppSettings.FirstOrDefault(o => o.AppKey == "From").AppValue;
                MailObj.To = AppSettings.FirstOrDefault(o => o.AppKey == "To").AppValue;
            }
            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(MailObj));
        }
Example #8
0
        public ActionResult AddNewColumn()
        {
            Template objTemplate = new Template();

            try
            {
                int?ID;
                var pID = Session["projectID"];
                if (pID == null)
                {
                    ID = null;
                }
                else
                {
                    ID = int.Parse(Session["projectID"].ToString());
                }

                ViewBag.GroupID      = new SelectList(objTemplate.getGroupID(ID), "GroupID", "GroupName");
                ViewBag.columnTypeID = new SelectList(objTemplate.getColumnTypeID(), "ColumnTypeID", "ColumnTypeName");
                objTemplate.IsActive = true;
            }
            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(objTemplate));
        }
Example #9
0
        public ActionResult UploadFile()
        {
            try
            {
                string           folderPath  = Server.MapPath("~/CourseTemplate/Course1.xls");
                OleDbConnection  OleDbcon    = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + folderPath + ";Extended Properties=Excel 12.0;");
                OleDbCommand     command     = new OleDbCommand("SELECT * FROM [Sheet1$]", OleDbcon);
                OleDbDataAdapter objAdapter1 = new OleDbDataAdapter(command);
                OleDbcon.Open();
                // Create DbDataReader to Data Worksheet
                DbDataReader dr     = command.ExecuteReader();
                string       constr = @"Data Source=DSRCMCSP16;Initial Catalog=DSRCHRMS1;Integrated Security=True;user id=rebar;password=rebar@123";

                // Bulk Copy to SQL Server
                SqlBulkCopy bulkInsert = new SqlBulkCopy(constr);
                bulkInsert.DestinationTableName = "Trainings";
                bulkInsert.WriteToServer(dr);
            }
            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());
        }
Example #10
0
        public ActionResult ViewGroupedtimeSheet(int ProjectId, DateTime Date)
        {
            DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
            List <Template> templateData     = new List <Template>();
            Template        objtemplate      = new Template();

            try
            {
                int    UserID = int.Parse(Session["UserID"].ToString());
                string Query;
                ModelState.Clear();
                Session["projectID"] = ProjectId;
                var datas = from g in db.Groups
                            join t in db.TimeSheetColumns on g.GroupID equals t.GroupID
                            join ct in db.Master_ColumnTypes on t.ColumnTypeID equals ct.ColumnTypeID
                            where t.ProjectID == ProjectId
                            where t.IsActive != false
                            select new
                {
                    ColumnName        = t.ColumnNames,
                    ColumnDisplayName = t.ColumnDisplayName,
                    ColumnTypeName    = ct.ColumnTypeName,
                    GroupName         = g.GroupName,
                    ColumnId          = t.TimeSheetColumnID
                };

                foreach (var item in datas)
                {
                    objtemplate.columnName        = item.ColumnName;
                    objtemplate.columnTypeName    = item.ColumnTypeName;
                    objtemplate.ColumnDisplayName = item.ColumnDisplayName;
                    objtemplate.ColumnId          = item.ColumnId;
                    objtemplate.groupName         = item.GroupName;
                    templateData.Add(objtemplate);
                }

                Query = "SELECT  ";
                foreach (var item in templateData)
                {
                    Query += "ISNULL(CONVERT(NVARCHAR(100)," + item.columnName + ",103),'')+'$'+";
                }
                Query  = Query.Substring(0, Query.Length - 5);
                Query += " FROM TimesheetData WHERE UserId=" + UserID + " AND ProjectId=" + ProjectId + " AND DateOFSheet='" + Date.ToString("MM-dd-yyyy HH:mm:ss") + "'";

                var           details      = db.SP_GetTimeSheetData(Query).FirstOrDefault();
                List <string> ColumnValues = details.Split(new char[] { '$' }).ToList();
                int           counter      = 0;
                foreach (var item in templateData)
                {
                    item.ColumnValue = ColumnValues[counter++];
                }
            }
            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(templateData));
        }
Example #11
0
 private List <SelectListItem> GetProjects()
 {
     try
     {
         var ProjectList = new List <SelectListItem>();
         using (DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1())
         {
             int UserID = int.Parse(Session["UserID"].ToString());
             List <DSRCProjects> projects = (from usrproj in db.UserProjects
                                             join
                                             proj in db.Projects on usrproj.ProjectID equals proj.ProjectID
                                             where usrproj.UserID == UserID
                                             select new DSRCProjects
             {
                 ProjectId = usrproj.ProjectID,
                 ProjectName = proj.ProjectName
             }).ToList();
             foreach (var item in projects)
             {
                 ProjectList.Add(new SelectListItem {
                     Text = item.ProjectName, Value = item.ProjectId.ToString()
                 });
             }
         }
         return(ProjectList);
     }
     catch (Exception Ex)
     {
         string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
         string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
         throw Ex;
     }
 }
Example #12
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 #13
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 #14
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 #15
0
        public ActionResult AddLabel(Label model)
        {
            try
            {
                var userId   = (int)Session["UserId"];
                var BranchId = db.Users.Where(r => r.UserID == userId).Select(f => f.BranchId).FirstOrDefault();


                var Name      = model.LabelName.Trim();
                var LabelName = db.Dictionaries.Where(r => r.Name == Name && r.IsActive == true).Select(f => f.Name);
                foreach (var dpt in LabelName)
                {
                    if (dpt != null)
                    {
                        return(Json("Warning", JsonRequestBehavior.AllowGet));
                    }
                }

                {
                    var Assignobj = db.Dictionaries.CreateObject();
                    Assignobj.Name     = Name;
                    Assignobj.IsActive = true;
                    db.Dictionaries.AddObject(Assignobj);
                    db.SaveChanges();
                }
            }
            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(Json("Success1", JsonRequestBehavior.AllowGet));
        }
Example #16
0
        public ActionResult EditDepartment(int ID, string DepartmentName)
        {
            ViewBag.Lbl_branch     = CommonLogic.getLabelName(1).ToString();
            ViewBag.Lbl_department = CommonLogic.getLabelName(2).ToString();
            try{
                ViewBag.EditDepartment = DepartmentName.Replace("-", "\"");
                ViewBag.ID             = ID;

                var ids = db.Departments.Where(x => x.DepartmentId == ID && x.IsActive == true).FirstOrDefault();

                //int i = Convert.ToInt32(ids);

                //List<int> selected = new List<int>();
                //selected.Add(i);

                var BranchName = db.Master_Branches.Select(c => new
                {
                    BranchId   = c.BranchID,
                    BranchName = c.BranchName
                }).ToList();
                ViewBag.BranchNames = new SelectList(BranchName, "BranchId", "BranchName", ids.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());
        }
        public ActionResult AddExpenditure()
        {
            List <DSRCManagementSystem.Models.Expenditure> UserList = new List <DSRCManagementSystem.Models.Expenditure>();

            try
            {
                int ExpenditureId = Convert.ToInt32(Session["ExpenditureID"]);
                ModelState.Clear();
                DSRCManagementSystemEntities1           db      = new DSRCManagementSystemEntities1();
                DSRCManagementSystem.Models.Expenditure objUser = new DSRCManagementSystem.Models.Expenditure();

                UserList = (from u in db.Expenditures.Where(o => o.IsActive != false)
                            select new DSRCManagementSystem.Models.Expenditure()
                {
                    ExpenditureID = u.ExpenseID,
                    ExpenseDescription = u.ExpenseDescription,
                    ExpenseDate = u.ExpenseDate,
                    ExpenseAmount = u.ExpenseAmount,
                    IsActive = u.IsActive,
                    CreatedAt = u.CreatedAt,
                }).OrderByDescending(o => o.ExpenseDate.Value.Year)
                           .ThenByDescending(o => o.ExpenseDate.Value.Month)
                           .ThenByDescending(o => o.ExpenseDate.Value.Day)
                           .ToList();
            }
            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(UserList));
        }
Example #18
0
 public ActionResult DeleteGroup(int DPName)
 {
     try{
         var Check = db.Users.Where(o => o.DepartmentGroup == DPName && o.IsActive == true).Select(o => o.UserID);
         foreach (int x in Check)
         {
             if (x != 0)
             {
                 return(Json("Warning", JsonRequestBehavior.AllowGet));
             }
         }
         {
             var data = db.DepartmentGroups.Where(o => o.GroupID == DPName).Select(o => o).FirstOrDefault();
             data.IsActive = false;
             db.SaveChanges();
         }
     }
     catch (Exception Ex)
     {
         string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
         string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
     }
     Session["Tab"] = "one";
     return(Json("Success", JsonRequestBehavior.AllowGet));
 }
Example #19
0
        public ActionResult Viewmail(string myParams)
        {
            var Result = new Feedback();

            try
            {
                var FeedbackID = Convert.ToInt32(myParams);


                Result = (from fb in db.UsersFeedbacks
                          join us in db.Users.Where(x => x.IsActive == true) on fb.UserID equals us.UserID
                          where fb.Id == FeedbackID
                          select new Feedback()
                {
                    //FeedbackId = fb.Id,http://localhost:5555/user/login
                    UserID = us.UserID,
                    UserName = us.FirstName + " " + (us.LastName ?? ""),
                    Feedbacks = fb.Feedback,
                    FeedbackDate = fb.FeedbackDate,
                }).FirstOrDefault();


                Session["ProfileId"] = Result.UserID;

                return(View(Result));
            }
            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(Result));
        }
Example #20
0
        public ActionResult EmployeeTimeSheet(EmployeeTimeSheet model)
        {
            var selectedtimeSheetData = new List <SelectedTimeSheet>();

            try
            {
                //int uid = int.Parse(Session["UserID"].ToString());
                int pid = Convert.ToInt32(model.ProjectName);
                using (DSRCManagementSystemEntities1 dbHrms = new DSRCManagementSystemEntities1())
                {
                    selectedtimeSheetData = (from data in dbHrms.TimesheetDatas
                                             join
                                             userdata in dbHrms.Users on data.UserID equals userdata.UserID
                                             join
                                             projectdata in dbHrms.Projects on data.ProjectID equals projectdata.ProjectID
                                             where data.UserID == model.EmployeeId && data.ProjectID == pid && EntityFunctions.TruncateTime(data.DateOFSheet) >= model.StartDate && EntityFunctions.TruncateTime(data.DateOFSheet) <= model.EndDate
                                             select new SelectedTimeSheet()
                    {
                        EmployeeName = ((userdata.FirstName) + " " + (userdata.LastName ?? "")).Trim(),
                        ProjectName = projectdata.ProjectName,
                        Date = data.DateOFSheet,
                        ProjectId = data.ProjectID,
                        UserId = data.UserID
                    }).ToList();
                    return(Json(selectedtimeSheetData, JsonRequestBehavior.AllowGet));
                }
            }
            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(Json(selectedtimeSheetData, JsonRequestBehavior.AllowGet));
        }
Example #21
0
 public ActionResult SendMail(EmailConfigure data)
 {
     try
     {
         DateTime    indianTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
         MailMessage mail       = new MailMessage();
         mail.To.Add(data.To);
         mail.From       = new MailAddress(data.From);
         mail.Subject    = "Test Mail";
         mail.Body       = "Test Mail on" + " " + indianTime + " " + "<br/><br/>This email has been automatically generated.</br>Please do not reply to this email address as all responses are directed to an unattended mailbox. <br/> You will not receive a response</p><br/><br/><p style=font-size:15px>Thanks,<br/>DSRC Management Portal</p>";
         mail.IsBodyHtml = true;
         SmtpClient smtp = new SmtpClient();
         smtp.Host = data.Host;
         smtp.Port = data.Port;
         smtp.UseDefaultCredentials = false;
         smtp.Credentials           = new System.Net.NetworkCredential
                                          (data.UserName, data.Password);
         smtp.EnableSsl = false;
         smtp.Send(mail);
         return(Json("success", JsonRequestBehavior.AllowGet));
     }
     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(Json("failed", JsonRequestBehavior.AllowGet));
     }
 }
Example #22
0
        public ActionResult ViewTimeSheetValues(string Value)
        {
            bool?type             = null;
            var  json_serializer  = new JavaScriptSerializer();
            SelectedTimeSheet val = json_serializer.Deserialize <SelectedTimeSheet>(Value);

            try
            {
                DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
                type = (from t in db.TimesheetTypes where t.ProjectID == val.ProjectId select t.IsGrouped).SingleOrDefault();
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }
            if (type.Value)
            {
                return(RedirectToAction("ViewGroupedtimeSheet", new { ProjectId = val.ProjectId, Date = val.Date }));
            }
            else
            {
                return(RedirectToAction("ViewNonGroupedtimeSheet", new { ProjectId = val.ProjectId, Date = val.Date }));
            }
        }
        public ActionResult ChangeColor(string ColorId)
        {
            int ID = 0;
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();

            try
            {
                if (ColorId == "")
                {
                    ID = 1;
                }
                else
                {
                    ID = Convert.ToInt32(ColorId);
                }
                var Themecolor = objdb.Master_ApplicationSettings.Where(x => x.AppID == 6).Select(o => o).FirstOrDefault();
                if (Themecolor != null)
                {
                    Themecolor.AppValue = objdb.Master_ThemeColors.Where(x => x.ColorId == ID).Select(o => o.ColorName).FirstOrDefault();
                    objdb.SaveChanges();
                    Session["Theme"] = Themecolor.AppValue;
                }
            }
            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(Json(ID, JsonRequestBehavior.AllowGet));
        }
Example #24
0
 public ActionResult GetProjectMembers(int id)
 {
     try
     {
         var EmployeeList = new List <SelectListItem>();
         using (DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1())
         {
             var Employees = (from a in db.UserProjects
                              where a.ProjectID == id
                              join b in db.Users
                              on a.UserID equals b.UserID
                              select new
             {
                 EmployeeId = b.UserID,
                 EmployeeName = (b.FirstName + " " + (b.LastName ?? "")).Trim()
             }).ToList();
             foreach (var item in Employees)
             {
                 EmployeeList.Add(new SelectListItem {
                     Text = item.EmployeeName, Value = item.EmployeeId.ToString()
                 });
             }
         }
         return(Json(EmployeeList, JsonRequestBehavior.AllowGet));
     }
     catch (Exception Ex)
     {
         string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
         string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
         ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
         throw Ex;
     }
 }
 public ActionResult ReportsPermission(List <int> From, List <int> To)
 {
     try
     {
         DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
         var deleteuser = db.ReportsPermissions.Where(x => x.IsAuthorized == true).Select(o => o).ToList();
         foreach (var deluser in deleteuser)
         {
             db.ReportsPermissions.DeleteObject(deluser);
         }
         db.SaveChanges();
         for (int j = 0; j < To.Count(); j++)
         {
             DSRCManagementSystem.ReportsPermission objaccess = new DSRCManagementSystem.ReportsPermission();
             objaccess.UserId       = To[j];
             objaccess.IsAuthorized = true;
             db.AddToReportsPermissions(objaccess);
             db.SaveChanges();
         }
         return(Json("Authorize", JsonRequestBehavior.AllowGet));
     }
     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(Json("Failed", JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult SearchedProjectsDetails(int?UserId, string ProjectId)
        {
            List <Projects> showProjectDetails = new List <Projects>();

            try{
                if (ProjectId == "")
                {
                    return(View());
                }
                List <int> projectList     = new List <int>();
                string[]   singleProjectId = ProjectId.Split(',');
                for (int i = 0; i < singleProjectId.Count(); i++)
                {
                    projectList.Add(Convert.ToInt32(singleProjectId[i]));
                }

                showProjectDetails = (from p in db.Projects.Where(x => projectList.Contains(x.ProjectID))
                                      join pt in db.Master_ProjectTypes on p.ProjectTypeID equals pt.ProjectTypeID
                                      select new DSRCManagementSystem.Models.Projects
                {
                    ProjectCode = p.ProjectCode,
                    ProjectName = p.ProjectName,
                    ProjectType = pt.ProjectTypeName,
                    RAGStatus = p.RAGStatus,
                }).OrderBy(x => x.RAGStatus).ToList();
            }
            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(showProjectDetails));
        }
        public ActionResult ManageActivities(ManageActivities model)
        {
            try{
                var ActivityName        = model.ActivityName.Trim();
                var ActivityDescription = model.ActivityDescription.Trim();

                var temp = db.Activities.Where(r => r.Activity1 == ActivityName && r.IsActive == true).Select(f => f.Activity1);

                foreach (var check in temp)
                {
                    if (check == ActivityName)
                    {
                        return(Json("Warning", JsonRequestBehavior.AllowGet));
                    }
                }

                {
                    var Assignobj = db.Activities.CreateObject();
                    Assignobj.Activity1           = ActivityName;
                    Assignobj.ActivityDescription = ActivityDescription;
                    db.Activities.AddObject(Assignobj);
                    db.SaveChanges();
                }
            }
            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(Json("Success", JsonRequestBehavior.AllowGet));
        }
Example #28
0
        public ActionResult ViewLabels()
        {
            //List<DSRCManagementSystem.Models.Label> objmodel = new List<Models.Label>();
            List <DSRCManagementSystem.Models.Label> LabelValue = new List <DSRCManagementSystem.Models.Label>();

            try
            {
                LabelValue = (from p in db.Dictionaries
                              select new DSRCManagementSystem.Models.Label()
                {
                    id = p.Id,
                    LabelName = p.Name,
                    PreviousName = p.Previous_Name,
                }).OrderBy(o => o.LabelName).ToList();
                //foreach (var x in LabelValue)
                //{

                //    objmodel.Add(x);
                //}
            }
            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(LabelValue));
        }
        public ActionResult EditComponent(int Floor, int Id, string Component, string Model, int AssignedTo, int Quantity, string Ip, string InUse)
        {
            ViewBag.InUse = new SelectList(new[] { new { Text = "Yes", Value = 0 }, new { Text = "No", Value = 1 } }, "Value", "Text", 0);


            var record = db.Assets.FirstOrDefault(x => (x.AssetID == Id));

            try
            {
                if (record != null)
                {
                    record.LocationID    = Floor;
                    record.Name_Model_No = Component;
                    record.ModelNo       = Model;
                    record.Quantity      = Quantity;
                    record.ComputerName  = AssignedTo;
                    record.ConnectedTo   = Ip;
                    record.InUse         = InUse == "Yes" ? true : false;
                    db.SaveChanges();
                }
                var query = db.locations.ToList();
                ViewBag.Detail1 = new SelectList(query, "locationid", "LocationName");
                var ComputerNameList = db.computermanagements.Where(z => z.ISDelete == false && z.ComputerStatusNew == "Active").ToList();
                ViewBag.ManagementIdList = new SelectList(ComputerNameList, "managementid", "ComputerName");
            }
            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(record));
        }
Example #30
0
        public ActionResult Add(DSRCManagementSystem.Models.Category objmodel)
        {
            DSRCManagementSystemEntities1 objdb = new DSRCManagementSystemEntities1();

            DSRCManagementSystem.Category obj = new DSRCManagementSystem.Category();
            try
            {
                obj.CategoryName = objmodel.CategoryName.Trim();
                obj.IsActive     = true;
                objdb.AddToCategories(obj);
                if (!objdb.Categories.Any(cobj => cobj.IsActive == true && cobj.CategoryName.Trim() == obj.CategoryName.Trim()))
                {
                    objdb.SaveChanges();
                }
                else
                {
                    return(Json(new { Result = "Already", URL = @Url.Action("AlertPopUp", "Popup") }, JsonRequestBehavior.AllowGet));
                }
            }

            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(Json(new { Result = "Success", URL = @Url.Action("AlertPopUp", "Popup") }, JsonRequestBehavior.AllowGet));
        }