Esempio n. 1
0
        //
        // GET: /Attachments/
        public ActionResult Upload(IEnumerable<HttpPostedFileBase> files)
        {
            string physicalPath = string.Empty;
            // The Name of the Upload component is "files"
            if (files != null)
            {
                using(CGPSI_AbsenceDBEntities cgpsi=new CGPSI_AbsenceDBEntities())
                {
                    foreach (var file in files)
                    {
                        string SHA256=BitConverter.ToString(new SHA256Managed().ComputeHash(file.InputStream)).Replace("-", String.Empty);
                        if(cgpsi.Attachments.Where(t=>t.MD5FileIdentity==SHA256).ToList().Count==0)
                        {
                            cgpsi.Attachments.Add(new Attachment()
                            {
                                FileName=Path.GetFileName(file.FileName),
                                FileSize=file.ContentLength,
                                MimeType=file.ContentType,
                                FileValue= new BinaryReader(file.InputStream).ReadBytes(file.ContentLength),
                                MD5FileIdentity = SHA256
                            });
                            cgpsi.SaveChanges();
                        }
                    }
                }
            }

            // Return an empty string to signify success
            return Json(physicalPath);
        }
Esempio n. 2
0
 //(DateTime start,DateTime end)//(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter)
 public ActionResult Get()
 {
     //string filters = KendoHelper.GenerateFilters(take, page, skip, pageSize, sort, filter);
     var result=new CGPSI_AbsenceDBEntities().SP_GetDataAbsenceOfCurrentMonth().ToList();
     var data = new
     {
         Result = result
             .Select(a => new
             {
                 StartTime = a.StartTime.Value.ToString(@"hh\:mm\:ss"),
                 EndTime = a.EndTime.Value.ToString(@"hh\:mm\:ss"),
                 FirstName = a.FirstName,
                 Department = a.Department,
                 NIK = a.NIK,
                 Dates = a.Dates,
                 TimeIN = (a.TimeIN != null ? a.TimeIN.Value.ToString(@"hh\:mm\:ss") : ""),
                 TimeOUT = (a.TimeOUT != null ? a.TimeOUT.Value.ToString(@"hh\:mm\:ss") : ""),
                 actualDayname = a.DayName,
                 ShiftName = a.ShiftName,
                 AbsenceStatus = a.AbsenceStatus
             }),
         //CResult = new CGPSI_AbsenceDBEntities().ViewAbsenceSummaries.Count()
     };
     return Json(data);
     //return Json(null);
 }
Esempio n. 3
0
 public ActionResult Get(string take, string page, string skip, string pageSize, List<GridSort> sort, GridFilter filter)
 {
     var temp = new CGPSI_AbsenceDBEntities().SP_JOB_TITLES_PagingAndView("", "");
     string filters = KendoHelper.GenerateFilters(take, page, skip, pageSize, sort, filter);
     var data = new
     {
         Result = new CGPSI_AbsenceDBEntities().SP_JOB_TITLES_PagingAndView("", ""), // .MstActivityCategory_getList(filters),
         CResult = new CGPSI_AbsenceDBEntities().JobTitles.Count()
     };
     return Json(data);
     //return Json(null);
 }
Esempio n. 4
0
 /// <summary>
 /// Delete Data
 /// </summary>
 public ActionResult Delete(ViewLeaveRequest data)
 {
     LeaveRequest lr = new LeaveRequest()
     {
         ID_LeaveRequest = data.ID_LeaveRequest,
         ID_Requestor = data.ID_Requestor,
         ID_Approver = data.ID_Approver,
         LeaveCategory = data.ID_LeaveCategory,
         LeaveReason = data.LeaveReason,
         StartDate = data.StartDate,
         EndDate = data.EndDate,
         CreatedBy = 0,
         ModifiedBy = 0,
         ModifiedDate = DateTime.Now,
         CreatedDate = DateTime.Now
     };
     CGPSI_AbsenceDBEntities temp = new CGPSI_AbsenceDBEntities();
     temp.LeaveRequests.Remove(temp.LeaveRequests.Where(t=>t.ID_LeaveRequest==data.ID_LeaveRequest).FirstOrDefault());
     return Json(temp.SaveChanges());
 }
Esempio n. 5
0
 public ActionResult Download(string id)
 {
     CGPSI_AbsenceDBEntities cgpsi=new CGPSI_AbsenceDBEntities();
     var file=cgpsi.Attachments.Where(t=>t.ID_Attachment==int.Parse(id)).FirstOrDefault();
     return File(file.FileValue, file.MimeType, file.FileName);
 }
Esempio n. 6
0
        /// <summary>
        /// Insert/Update New Data
        /// </summary>
        public ActionResult Post(ViewLeaveRequest data)
        {
            LeaveRequest lr = new LeaveRequest()
            {
                ID_LeaveRequest=data.ID_LeaveRequest,
                ID_Requestor=data.ID_Requestor,
                ID_Approver=data.ID_Approver,
                LeaveCategory=data.ID_LeaveCategory,
                LeaveReason=data.LeaveReason,
                StartDate=data.StartDate,
                EndDate=data.EndDate,
                CreatedBy=0,
                ModifiedBy=0,
                ModifiedDate=DateTime.Now,
                CreatedDate=DateTime.Now
            };

            if (data.ID_LeaveRequest==0)
            {
                //Add New Item
                new CGPSI_AbsenceDBEntities().LeaveRequests.Add(lr);
            }
            else
            {
                CGPSI_AbsenceDBEntities temp =new CGPSI_AbsenceDBEntities();
                temp.Entry(lr).CurrentValues.SetValues(lr);
                temp.SaveChanges();
            }
            return Json(true);
        }