Ejemplo n.º 1
0
        public long AcceptEvent(UserEventAdminListViewModel userEventModel)
        {
            var result = 0;

            try
            {
                if (userEventModel.UeCount == 2)
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        result = db.Database.ExecuteSqlCommand("exec proc_as_AcceptNghiPhep @UserID, @UeID",
                                                               new SqlParameter("@UserID", userEventModel.UserID),
                                                               new SqlParameter("@UeID", userEventModel.UeID));
                        scope.Complete();
                    }
                }
                else
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        result = db.Database.ExecuteSqlCommand("exec proc_as_AcceptUpdateAttanceDanceForUser @UserID, @UeType, @UeID",
                                                               new SqlParameter("@UserID", userEventModel.UserID),
                                                               new SqlParameter("@UeType", userEventModel.UeCount),
                                                               new SqlParameter("@UeID", userEventModel.UeID));
                        scope.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Ejemplo n.º 2
0
        public IEnumerable <UserEventAdminListViewModel> UeListAllForAdmin()
        {
            UsersDAL userModel = new UsersDAL();
            var      model     = db.tbl_UserEvent.ToList();
            List <UserEventAdminListViewModel> liHomeView = new List <UserEventAdminListViewModel>();

            foreach (var item in model)
            {
                UserEventAdminListViewModel ueModel = new UserEventAdminListViewModel();
                ueModel.UserID        = item.UserID;
                ueModel.UserFullName  = userModel.GetUser(item.UserID).UserFullName;
                ueModel.UserPhone     = userModel.GetUser(item.UserID).UserPhone;
                ueModel.UeDateExpires = item.UeDateExpires;
                ueModel.UeWillExpires = item.UeWillExpires;
                ueModel.UeNote        = item.UeNote;
                ueModel.Loai          = item.UeCount == (int)Enums.EventType.CongTac ? "Công Tác" : "Nghỉ Phép";
                ueModel.Color         = item.UeCount == 1 ? item.UeOk == true? "success": "default" : item.UeOk == true ? "success" : "danger";
                ueModel.UeOk          = item.UeOk;
                ueModel.UeID          = item.UeID;
                ueModel.UeCount       = item.UeCount;
                liHomeView.Add(ueModel);
                //Edit 0608
            }


            return(liHomeView);
        }
Ejemplo n.º 3
0
        public ActionResult Accept(UserEventAdminListViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }

                userDAL.AcceptEvent(model);
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }