public void WorkShift_Save(string RowID, string MineCode, string Dept, string PreWorkTime, string PreWorkContent, string PreWorkShift, string PreWorkPersonName, string NextWorkTime, string WorkShiftCategory, string NextWorkContent, string NextWorkShift, string NextWorkPersonName, string Remark, string Insert) { WorkShiftModel model = new WorkShiftModel() { RowID = int.Parse(RowID), MineCode = MineCode, Dept = Dept, PreWorkTime = PreWorkTime, PreWorkContent = PreWorkContent, PreWorkShift = PreWorkShift, PreWorkPersonName = PreWorkPersonName, NextWorkTime = NextWorkTime, NextWorkContent = NextWorkContent, NextWorkShift = NextWorkShift, NextWorkPersonName = NextWorkPersonName, Remark = Remark, WorkShiftCategory = int.Parse(WorkShiftCategory) }; if (Insert == "1") { if (bll.WorkShift_Insert(model)) { Response.Write("交接班记录保存成功!"); } else { Response.Write("交接班记录保存失败!"); } } else { if (bll.WorkShift_Update(model)) { Response.Write("交接班记录保存成功!"); } else { Response.Write("交接班记录保存失败!"); } } Response.End(); }
public void GetUnitList() { try { string returnMessage; UnitList = new ObservableCollection <UnitVM>(); _currentFilteredDate = SelectedDate; _currentFilteredWorkShift = SelectedWorkShift; _currentFilterTime = VerifyShiftTime(); List <UnitForceMapModel> unitList = UnitForceMapBusiness.GetUnitForceMapList(SelectedRegion, SelectedDate, SelectedWorkShift, CurrentFilterTime, (int)SelectedFilterType, out returnMessage); foreach (var u in unitList) { var unitVM = new UnitVM(u, "Red"); UnitList.Add(unitVM); } SelectedUnit = null; FilterUnitCount = unitList.Count.ToString(); CurrentActiveFilter = SelectedDate.ToString("dd/MM/yyyy") + " das " + SelectedWorkShift.InicialTime.Hours.ToString().PadLeft(2, '0') + " às " + SelectedWorkShift.FinalTime.Hours.ToString().PadLeft(2, '0') + " (" + (SelectedFilterType == FilterTypeEnum.ALL ? "Todas AMs" : string.Empty) + (SelectedFilterType == FilterTypeEnum.OUT_SERVICE ? "AMs fora de serviço" : string.Empty) + (SelectedFilterType == FilterTypeEnum.IN_SERVICE ? "AMs em serviço" : string.Empty) + (string.IsNullOrEmpty(SelectedRegion) ? string.Empty : " da região " + SelectedRegion) + ")"; } catch (Exception ex) { ShowMessage(ex.Message); } }
public bool IsForwardShiftTime(List <WorkShiftModel> availableWorkShiftList, out string messageInfo) { bool isForward = true; WorkShiftModel workShiftSelected = availableWorkShiftList.Where(ws => ws.Label == this.WorkshiftLabel).FirstOrDefault(); if (!this.ShiftDate.HasValue) { throw new NullReferenceException(); } if (this.ShiftDate.Value.Date.CompareTo(DateTime.Now.Date) < 0) { isForward = false; } if (this.ShiftDate.Value.Date.CompareTo(DateTime.Now.Date) == 0) { if (!workShiftSelected.IsPreviousTo(DateTime.Now.Hour, DateTime.Now.Minute)) { isForward = false; } } messageInfo = isForward ? null : GetMessage( String.Format("{0} {1}", colNames[ImportableWorkScheduleUnitModel.SHIFT_DATE_COL_NUM], colNames[ImportableWorkScheduleUnitModel.WORKSHIF_LABEL_COL_NUM]), String.Format("{0} {1}", (this.ShiftDate.HasValue ? this.ShiftDate.Value.ToString("dd/MM/yyyy") : this.ShiftDateCellValue), this.WorkshiftLabel)); return(isForward); }
public UnitCrewMemberVM(CrewMemberTypeEnum crewMemberType, UnitForceMapModel currentUnit, WorkShiftModel.ShiftTime currentShiftTime) { this._crewMemberType = crewMemberType; this._currentUnitId = currentUnit.UnitId; this._shiftTime = currentShiftTime; this._shiftDate = currentUnit.ShiftDate; this._workShift = currentUnit.CurrentWorkShift; }
public void VerifyShiftChange() { WorkShiftModel VerifyWorkShift = UnitForceMapBusiness.GetCurrentWorkShift(WorkShiftList); if (VerifyWorkShift.ToString() != CurrentWorkShift.ToString()) { CurrentWorkShift = VerifyWorkShift; } _currentFilterTime = VerifyShiftTime(); }