private void UpdateMachineDowntime(int ms_id, string cid, int downtime) { if (ms_id == 0) { return; } if (cid.Trim().Length != 6) { return; } if (downtime == 0) { return; } CtxService service = new CtxService(null, cid); try { service.updateMachineDowntime(ms_id, downtime); } finally { service.Dispose(); } }
private void AutoAddScheduledOrder(schedule record, CtxService service) { if (service == null) { return; } try { int defaultEMPID = service.getDefaultEMPID(); record.MS_Next_Main_Date = DateTime.Now.AddDays(record.MS_Frequency).ToShortDateString() + " " + DateTime.Now.AddDays(record.MS_Frequency).ToShortTimeString(); record.MS_Main_Comp_Date = ""; record.MS_WOCreate_Timestamp = DateTime.Now.AddDays(record.MS_Frequency).ToShortDateString() + " " + DateTime.Now.AddDays(record.MS_Frequency).ToShortTimeString(); record.MS_WOClosed_Timestamp = ""; record.EMP_ID = (record.EMP_ID != 0) ? record.EMP_ID : defaultEMPID; int result = service.Add(record); if (result == 0) { throw new Exception("Error editing scheduled maintenance record."); } else { service.clearCache(); } } finally { service.Dispose(); } }
private PageInput getFlagboardDropdown(string CID) { PageInput fbInput = new PageInput("select", "Flagboards", "MFB_Id", "MFB_Id", ""); try { CtxService service = new CtxService(null, CID); List <Models.pageInputs> fbs = service.getFlagBoardsInput(); if (fbs == null || fbs.Count == 0) { fbInput.errorFlag = true; fbInput.errorMessage = "ERROR: No FlagBoards found in database."; return(fbInput); } foreach (var item in fbs) { fbInput.input.options.Add(new InputObject.option { text = "FB " + item.value, value = item.key }); fbdict.Add(item.key, item.value); } fbInput.input.options.Add(new InputObject.option { text = "ALL", value = "0" }); Session["MFB_Array"] = fbdict; } catch (Exception ex) { fbInput.errorFlag = true; fbInput.errorMessage = "ERROR CREATING FB SELECT LIST: " + ex.Message; } return(fbInput); }