Пример #1
0
        public ActionResult PendingSignature(int Id)
        {
            EmployeeSignatureViewModel model = new EmployeeSignatureViewModel();
            var UserRoleType = _RolesManagementMethod.GetLoginUserRoleType(SessionProxy.UserId);

            if (UserRoleType == "SuperAdmin")
            {
                model.Id = 0;
                return(PartialView("_partialShowSendSignature", model));
            }
            else
            {
                var data = _EmployeeDocument.getDocumentDetailsById(Id);
                model.Id         = data.Id;
                model.DocumentID = data.Id;
                model.EmployeeID = data.EmployeeID;
                if (data.Id != 0)
                {
                    var detail = _EmployeeDocument.getDocumentDetailsById(data.Id);
                    model.DocumentName = detail.DocumentOriginalPath;
                }
                model.CreateDate = String.Format("{0:ddd,dd MMM yyyy hh:mm tt}", data.CreatedDate);
                model.IpAddress  = data.IpAddress;
                return(PartialView("_partialAddEmployeeSignature", model));
            }
        }
Пример #2
0
        public List <AdminNewsViewModel> modelList()
        {
            List <AdminNewsViewModel> model = new List <AdminNewsViewModel>();
            int  CurrentUser = SessionProxy.UserId;
            int  SuperAdmin  = _RolesManagementMethod.GetSuperAdminId();
            var  details     = _RolesManagementMethod.GetLoginUserRoleType(CurrentUser);
            bool Super       = false;

            if (Convert.ToInt32(CurrentUser) == SuperAdmin)
            {
                Super = true;
            }
            var data = _adminNewsMethod.getActiveList();

            foreach (var item in data)
            {
                AdminNewsViewModel m = new AdminNewsViewModel();
                m.Super = Super;
                m.Id    = item.Id;
                var detail = _db.AspNetUsers.Where(x => x.Id == item.CreatedBy).FirstOrDefault();
                if (detail.SSOID.Contains('W'))
                {
                    m.Emp = true;
                }
                if (detail.SSOID.Contains('C'))
                {
                    m.Cus = true;
                }
                if (_RolesManagementMethod.GetLoginUserRoleType(detail.Id) == "Manager")
                {
                    m.Man = true;
                }
                m.CurrentImage           = detail.image;
                m.Subject                = item.Subject;
                m.Description            = item.Description;
                m.EmployeeAccess         = item.EmployeeAccess;
                m.ManagerAccess          = item.ManagerAccess;
                m.CustomerAccess         = item.CustomerAccess;
                m.SpecificWorker         = item.SpecificWorker;
                m.WorkerID               = item.WorkerID;
                m.SpecificCustomer       = item.SpecificCustomer;
                m.CustomerID             = item.CustomerID;
                m.SpecificManager        = item.SpecificManager;
                m.ManagerID              = item.ManagerID;
                m.NotifyEmployeeViaEmail = item.NotifyEmployeeViaEmail;
                m.AllowCustomer          = item.AllowCustomer;
                var employee = _employeeMethod.getEmployeeById(item.CreatedBy);
                m.CreateUserId = item.CreatedBy;
                m.CreatedBy    = string.Format("{0} {1} - {2}", employee.FirstName, employee.LastName, employee.SSOID);
                m.CreatedDate  = String.Format("{0:dd-MMM-yyy}", item.CreatedDate);
                m.CommentCount = _adminNewsMethod.GetCommentCount(item.Id);
                var listComment = _adminNewsMethod.GetCommentList(item.Id);
                foreach (var itemComment in listComment)
                {
                    NewCommentViewModel modelComment = new NewCommentViewModel();
                    if (itemComment.Comments != null)
                    {
                        //string noHTML = Regex.Replace(itemComment.Comments, @"<[^>]+>| ", "").Trim();
                        modelComment.Comments = itemComment.Comments;
                    }
                    modelComment.Id         = itemComment.Id;
                    modelComment.UserCreate = itemComment.UserIDCreatedBy;
                    modelComment.SuperAdmin = SuperAdmin;
                    var diff = DateTimeSpan.CompareDates((DateTime)itemComment.CreatedDate, DateTime.Now);
                    if (diff.Years != 0)
                    {
                        modelComment.Time = diff.Years + " " + "a year ago";
                    }
                    else
                    {
                        if (diff.Months != 0)
                        {
                            modelComment.Time = diff.Months + " " + "Months ago";
                        }
                        else
                        {
                            if (diff.Days != 0)
                            {
                                modelComment.Time = diff.Days + " " + "Days ago";
                            }
                            else
                            {
                                if (diff.Hours != 0)
                                {
                                    modelComment.Time = diff.Hours + " " + "Hours ago";
                                }
                                else
                                {
                                    if (diff.Minutes > 1)
                                    {
                                        modelComment.Time = diff.Minutes + " " + "Minutes ago";
                                    }
                                    else
                                    {
                                        modelComment.Time = diff.Minutes + " " + "Few Minutes ago";
                                    }
                                }
                            }
                        }
                    }
                    m.NewCommantsList.Add(modelComment);
                }
                model.Add(m);
            }

            return(model.OrderByDescending(x => x.CreatedDate).ToList());
        }