public async Task<bool> LoadTotalTimeSheet(RevealProjectSvc.SigmacueDTO param) { bool retValue = false; try { if (param != null) { Login.MasterPage.Loading(true, this); btnSubmit.IsEnabled = true; _approve = param; var daily = await (new Lib.ServiceModel.ProjectModel()).GetDailytimesheetByID(_approve.DataID); if (daily != null && daily.Count > 0) { if (daily[0].StatusLUID == WinAppLibrary.Utilities.DailyTimesheetStatus.GF_Rejected) await LoadTotalTimeSheet_Reject(_approve); else await LoadTotalTimeSheet_Submit(_approve); } else { _status = WinAppLibrary.Utilities.TrackTimeSheetStatus.Submit; this.TimeSheetTotal.SetOperationType(_status, _workdate, "Submitted by"); } Login.MasterPage.Loading(false, this); } } catch (Exception e) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(e, "TimeSheetTotal LoadTotalTimeSheet"); } return retValue; }
async Task<bool> LoadTotalTimeSheet_Submit(RevealProjectSvc.SigmacueDTO param) { bool retValue = false; this.TimeSheetTotal.Visibility = Visibility.Visible; gvInputTimeProgress.Visibility = Visibility.Collapsed; this.BottomAppBar.IsEnabled = false; _status = WinAppLibrary.Utilities.TrackTimeSheetStatus.Approve; var result = await (new Lib.ServiceModel.ProjectModel()).GetTimesheetByWorkdateDailyTimeSheet(0, 0, param.DataID, param.SentDate, Login.UserAccount.CurProjectID, Login.UserAccount.CurModuleID); result = result.OrderBy(x => x.DepartStructureID) .GroupBy(g => new { g.DepartStructureID, g.PersonnelID, g.EmployeeFullName }) .Select(y => new RevealProjectSvc.TimesheetDTO { DepartStructureID = y.Key.DepartStructureID, EmployeeFullName = y.Key.EmployeeFullName, PersonnelID = y.Key.PersonnelID, StraightTime = y.Sum(z => z.StraightTime), DoubleTime = y.Sum(z => z.DoubleTime), TimeAndHalf = y.Sum(z => z.TimeAndHalf) }).ToList(); this.TimeSheetTotal.BindTimeSheetTotal(result); this.TimeSheetTotal.SetOperationType(_status, _approve.SentDate, string.Format("Submitted by {0}", _approve.SentBy)); _bounded = result.Count > 0 ? true : false; retValue = true; return retValue; }
async Task<bool> LoadTotalTimeSheet_Reject(RevealProjectSvc.SigmacueDTO param) { bool retValue = false; this.TimeSheetTotal.Visibility = Visibility.Collapsed; this.gvInputTimeProgress.Visibility = Visibility.Visible; this.BottomAppBar.IsEnabled = true; _status = WinAppLibrary.Utilities.TrackTimeSheetStatus.Reject; _timeprogrsses.Clear(); var result = await (new Lib.ServiceModel.ProjectModel()).GetTimesheetAndProgressByWorkdateDepartStructure(param.SentDate, 0, param.DataID, Login.UserAccount.CurProjectID, Login.UserAccount.CurModuleID, 0); foreach (var ts in result) { TimesheetAndProgress child = new TimesheetAndProgress(); child.DataID = ts.DataID; child.Updated = ts.Updated; child.progresseslist = ts.progresseslist.ToObservableCollection(); child.TimesheetList = ts.TimesheetList.ToObservableCollection(); _timeprogrsses.Add(child); } return retValue; }
public void DeleteProgress(int groupId, RevealProjectSvc.MTODTO progress) { var timeprogress = _timesheetprogress.Where(x => x.DataID == groupId).FirstOrDefault(); if (timeprogress != null) { var curItem = timeprogress.progresseslist.Where(x => x.DTOStatus != (int)WinAppLibrary.Utilities.RowStatus.New && x.ProgressID != progress.ProgressID).FirstOrDefault(); if (timeprogress.DataID > 0 && curItem == null) throw new Exception("Progress can't be removed all before updating them to server. \n If you wanna remove all items please select 'Delete All'"); else { bool result = timeprogress.progresseslist.Remove(progress); //This is because DTO can not be possibly not same generically as a child of enormerous verctor even though it has same date. if (!result) { var child = timeprogress.progresseslist.Where(x => x.ProgressID == progress.ProgressID).FirstOrDefault(); if (child != null) result = timeprogress.progresseslist.Remove(child); } if (timeprogress.DataID > 0 && result && progress.DTOStatus != (int)WinAppLibrary.Utilities.RowStatus.Update) { progress.DTOStatus = (int)WinAppLibrary.Utilities.RowStatus.Delete; _del_progress.Add(progress); } } } }
public bool IsContainInComponents(int groupId, RevealProjectSvc.MTODTO item) { bool retValue = false; var timeprogress = _timesheetprogress.Where(x => x.DataID == groupId).FirstOrDefault(); if (timeprogress != null) { retValue = timeprogress.progresseslist.Contains(item); } return retValue; }
private Dictionary<string, string> GetDrawingInfo(RevealProjectSvc.DrawingDTO drawing) { Dictionary<string, string> infolist = new Dictionary<string, string>(); infolist.Add("DrawingName", drawing.DrawingName == null ? "" : drawing.DrawingName); infolist.Add("CWA", drawing.CWPName == null ? "" : drawing.CWPName); infolist.Add("Title", drawing.Description == null ? "" : drawing.Description); infolist.Add("TypeDesc", drawing.TypeDesc == null ? "" : drawing.TypeDesc); return infolist; //This was dismissed because of faster binding to Drawing Info Panel //ObservableCollection<DataGroup> groupedlist = new ObservableCollection<DataGroup>(); //var group = new DataGroup("DrawingName", "DrawingName", ""); //groupedlist.Add(group); //groupedlist[0].Items.Add(new DataItem(drawing.DrawingID + "DrawingName", drawing.DrawingName, "", "", groupedlist[0]) { }); //group = new DataGroup("CWA", "CWA", ""); //groupedlist.Add(group); //groupedlist[1].Items.Add(new DataItem(drawing.CWPID + "CWA", drawing.CWPName, "", "", groupedlist[1]) { }); //group = new DataGroup("Title", "Title", ""); //groupedlist.Add(group); //groupedlist[2].Items.Add(new DataItem(drawing.Description + "Title", drawing.Description, "", "", groupedlist[2]) { }); //group = new DataGroup("TypeDesc", "Type Description", ""); //groupedlist.Add(group); //groupedlist[3].Items.Add(new DataItem(drawing.TypeDesc, drawing.TypeDesc, "", "", groupedlist[3]) { }); }
public async Task<RevealProjectSvc.DocumentmarkupDTO> SaveDocumentmarkupWithSharePoint(int projectId, RevealProjectSvc.DocumentmarkupDTO documentmarkup) { RevealProjectSvc.ProjectServiceClient project = ServiceHelper.GetServiceClient<RevealProjectSvc.ProjectServiceClient>(ServiceHelper.ProjectService); var retValue = await project.SaveDocumentmarkupWithSharePointAsync(Helper.DBInstance, projectId, documentmarkup); return retValue; }