Exemplo n.º 1
0
        public ActionResult Index()
        {
            AnnouncementEntity   objAnnouncment = AnnouncementServices.GetAnnouncement();
            List <HolidayEntity> objHolidayList = HolidayServices.GetAllHoliday();

            ViewBag.HolidayList = objHolidayList;
            string AnnouncmentText = objAnnouncment.AnnouncementText;

            AnnouncmentText = AnnouncmentText == null ? string.Empty : AnnouncmentText;
            string AnnouncmentHtml = "";

            if (AnnouncmentText.Trim() != "")
            {
                try
                {
                    string[] AnnouncmentList = AnnouncmentText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

                    foreach (string item in AnnouncmentList)
                    {
                        AnnouncmentHtml += "<li class=\"news-item\"><small>" + item + "</small></li>";
                    }
                }
                catch { }
            }
            else
            {
                AnnouncmentHtml = "<li class=\"news-item\"><small>No new Announcments.</small></li>";
            }
            ViewBag.AnnouncementMessage = AnnouncmentHtml;
            return(View());
        }
Exemplo n.º 2
0
        public string GetColor(DateTime mettingTime, int documentID)
        {
            if (documentID <= 0)
            {
                if (HolidayServices.GetBusinessDays(mettingTime, DateTime.Now) > 3)
                {
                    return("text-out-term");
                }
                else
                {
                    return("");
                }
            }
            else
            {
                Document document = DocumentServices.GetById(documentID);

                if (HolidayServices.GetBusinessDays(mettingTime, document.ReleaseDate) > 3)
                {
                    return("text-out-term");
                }
                else
                {
                    return("");
                }
            }
        }
 public ActionResult DeleteHoliday()
 {
     try
     {
         if (Request.Form["hdnHolidayIds"] != null)
         {
             string        UnParse    = Request.Form["hdnHolidayIds"].ToString();
             List <int>    StatusList = new List <int>();
             List <string> tempstr    = new List <string>();
             tempstr = UnParse.Split(',').ToList();
             foreach (string item in tempstr)
             {
                 string data;
                 data = item.Trim('(');
                 data = data.Trim(')');
                 StatusList.Add(int.Parse(data));
             }
             foreach (var item in StatusList)
             {
                 HolidayServices.DeleteHoliday(item);
             }
             TempData[HRMWeb.Helpers.AlertStyles.Success] = "Holiday Successfully Deleted.";
         }
     }
     catch { }
     return(RedirectToAction("Index", "Holiday"));
 }
Exemplo n.º 4
0
 protected override void UpdateObject()
 {
     item             = (Holiday)ViewState["CurrentObject"];
     item.HolidayName = TenNgayNghi.Text.Trim();
     item.FromDate    = TuNgay.Text.ToDateTime();
     item.ToDate      = DenNgay.Text.ToDateTime();
     HolidayServices.Update(item);
 }
Exemplo n.º 5
0
 protected override void CreateNewObject()
 {
     item             = new Holiday();
     item.HolidayName = TenNgayNghi.Text.Trim();
     item.FromDate    = TuNgay.Text.ToDateTime();
     item.ToDate      = DenNgay.Text.ToDateTime();
     HolidayServices.Create(item);
 }
Exemplo n.º 6
0
 protected override void ShowObjectInformation()
 {
     item = HolidayServices.GetById(IntId);
     ViewState["CurrentObject"] = item;
     TenNgayNghi.Text           = item.HolidayName;
     TuNgay.Text  = item.FromDate.ToDateString();
     DenNgay.Text = item.ToDate.ToDateString();
 }
        public ActionResult Create(HolidayModel model)
        {
            ViewBag.LeaveDuration = LeaveServices.GetAllLeaveDuration();
            if (ModelState.IsValid)
            {
                DateTime      StartDate;
                DateTime      EndDate;
                HolidayEntity ob = new HolidayEntity();
                if (model.StartDate == null)
                {
                    TempData[HRMWeb.Helpers.AlertStyles.Warning] = "Please Input Start Date";
                    return(View(model));
                }
                if (model.EndDate == null)
                {
                    TempData[HRMWeb.Helpers.AlertStyles.Warning] = "Please Input End Date";
                    return(View(model));
                }
                StartDate = model.StartDate;
                EndDate   = model.EndDate;

                if (StartDate > EndDate)
                {
                    TempData[HRMWeb.Helpers.AlertStyles.Warning] = "Start Date can not exceed End Date";
                    return(View(model));
                }

                ob.HolidayId       = 0;
                ob.HolidayName     = model.HolidayName;
                ob.LeaveDurationId = model.LeaveDurationId == 0 ? (int)LeaveServices.Leave_Duration.FullDay : model.LeaveDurationId;
                ob.StartDate       = model.StartDate;
                ob.EndDate         = model.EndDate;
                ob.UpdatedBy       = HRMHelper.CurrentUser.UserId;
                ob.CreatedBy       = HRMHelper.CurrentUser.UserId;
                int x = HolidayServices.InsertUpdateHoliday(ob);
                if (x > 0)
                {
                    ob.HolidayId = x;
                    TempData[HRMWeb.Helpers.AlertStyles.Success] = "Holiday Saved Successfully";
                    model = new HolidayModel();
                }
                else
                {
                    TempData[HRMWeb.Helpers.AlertStyles.Danger] = "Save Fails";
                }
            }
            return(View(model));
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Authenticator.CheckRole(UserRole.ChuyenVienVPUBNDTinh))
            {
                RequestDetail.BindData(RequestServices.LaySoLieuThongKe(MaNguoiTheoDoi: Sessions.UserID).WrapInList());

                NoDocumentOnTime = MettingServices.GetList()
                                   ?.Where(item => item.StaffID == Sessions.UserID)
                                   ?.Where(item => (item.DocumentID <= 0 && HolidayServices.GetBusinessDays(item.Time, DateTime.Now) <= 3)).Count() ?? 0;

                NoDocumentLate = MettingServices.GetList()
                                 ?.Where(item => item.StaffID == Sessions.UserID)
                                 ?.Where(item => (item.DocumentID <= 0 && HolidayServices.GetBusinessDays(item.Time, DateTime.Now) > 3)).Count() ?? 0;

                DocumentOnTime = MettingServices.GetList()
                                 ?.Where(item => item.StaffID == Sessions.UserID)
                                 ?.Where(item => (item.DocumentID > 0 && HolidayServices.GetBusinessDays(item.Time, item.Document.ReleaseDate) <= 3)).Count() ?? 0;

                DocumentLate = MettingServices.GetList()
                               ?.Where(item => item.StaffID == Sessions.UserID)
                               ?.Where(item => (item.DocumentID > 0 && HolidayServices.GetBusinessDays(item.Time, item.Document.ReleaseDate) > 3)).Count() ?? 0;
            }
            else if (Authenticator.CheckRole(UserRole.LanhDaoUBNDTinh, UserRole.LanhDaoVPUBNDTinh))
            {
                RequestDetail.BindData(RequestServices.LaySoLieuThongKe(MaLanhDao: Sessions.UserID).WrapInList());

                NoDocumentOnTime = MettingServices.GetList()
                                   ?.Where(item => item.PresidentID == Sessions.UserID)
                                   ?.Where(item => (item.DocumentID <= 0 && HolidayServices.GetBusinessDays(item.Time, DateTime.Now) <= 3)).Count() ?? 0;

                NoDocumentLate = MettingServices.GetList()
                                 ?.Where(item => item.PresidentID == Sessions.UserID)
                                 ?.Where(item => (item.DocumentID <= 0 && HolidayServices.GetBusinessDays(item.Time, DateTime.Now) > 3)).Count() ?? 0;

                DocumentOnTime = MettingServices.GetList()
                                 ?.Where(item => item.PresidentID == Sessions.UserID)
                                 ?.Where(item => (item.DocumentID > 0 && HolidayServices.GetBusinessDays(item.Time, item.Document.ReleaseDate) <= 3)).Count() ?? 0;

                DocumentLate = MettingServices.GetList()
                               ?.Where(item => item.PresidentID == Sessions.UserID)
                               ?.Where(item => (item.DocumentID > 0 && HolidayServices.GetBusinessDays(item.Time, item.Document.ReleaseDate) > 3)).Count() ?? 0;
            }
            else if (Sessions.AgencyID > 0)
            {
                RequestDetail.BindData(RequestServices.LaySoLieuThongKe(MaDonVi: Sessions.AgencyID).WrapInList());
            }
        }
        public ActionResult EditHoliday(int?Id)
        {
            ViewBag.LeaveDuration = LeaveServices.GetAllLeaveDuration();
            int           HolidayId = Id == null ? 0 : (int)Id;
            HolidayEntity ob        = HolidayServices.GetHolidayById(HolidayId);
            HolidayModel  model     = new HolidayModel();

            if (ob != null)
            {
                model.HolidayId       = ob.HolidayId;
                model.HolidayName     = ob.HolidayName;
                model.StartDate       = ob.StartDate;
                model.EndDate         = ob.EndDate;
                model.LeaveDurationId = ob.LeaveDurationId;
            }
            else
            {
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Exemplo n.º 10
0
 protected override void DeleteAction(string id)
 {
     HolidayServices.Delete(id.ToInteger());
 }
Exemplo n.º 11
0
 protected override void GetDataList()
 {
     BaseCollection = HolidayServices.GetList(txtSearchText.Text);
 }
Exemplo n.º 12
0
 public static string GetApply(string str)
 {
     return(HolidayServices.GetApply(str));
 }
Exemplo n.º 13
0
 public static string DateIsFull(string star, string end, string id, string appid)
 {
     return(HolidayServices.DateIsFull(star, end, id, appid));
 }
Exemplo n.º 14
0
 public static string GetRes(string date)
 {
     return(HolidayServices.GetRes(date));
 }
        public ActionResult Index()
        {
            List <HolidayEntity> model = HolidayServices.GetAllHoliday();

            return(View(model));
        }