/// <summary> /// Initialize the Calendar Control /// </summary> /// <returns>True if Calendar is properly initialized</returns> public bool InitializeCalendar() { _log.Notice("Inside InitializeCalendar"); p_HighlightedDateText = new string[42]; monthlyQuota = new Dictionary <DateTime, DayQuota>(); currentDateSelected = OldDisplayDate = p_DisplayDate = DateTime.Today; ToaRequestResultCode result = this.getQuotaForMonth(); if (result == ToaRequestResultCode.Failure) { return(false); } // Subscribe to PropertyChanged event this.PropertyChanged += OnPropertyChanged; return(true); }
public void processResponseElement(InboundInterfaceResponseElement inboundResponseElement) { if (inboundResponseElement.report != null) { ReportMessageElement[] reportMessages = inboundResponseElement.report; WorkOrderModel workOrderModel = new WorkOrderModel(); if (null != reportMessages && reportMessages.Length > 0) { _log.Notice("Processing Report Element for WorkOrder"); foreach (ReportMessageElement reportMessage in reportMessages) { workOrderModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating appointment ", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } _log.Notice("Processing of Report Element for WorkOrder is done"); } _dataModels.Add(workOrderModel); } else if (inboundResponseElement.data != null) { CommandResponseElement[] commands = inboundResponseElement.data.commands; _resultCode = Common.ToaRequestResultCode.Success; if (null != commands && commands.Length > 0) { foreach (CommandResponseElement command in commands) { WorkOrderModel workOrderModel = new WorkOrderModel(); ReportMessageElement[] reportMessages = command.appointment.report; if (null != reportMessages && reportMessages.Length > 0) { _log.Notice("Processing Report Element for WorkOrder"); foreach (ReportMessageElement reportMessage in reportMessages) { workOrderModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating appointment:" + command.appointment.appt_number, "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } else { _log.Notice("Appointment created:" + command.appointment.appt_number, "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } _log.Notice("Processing of Report Element for WorkOrder is done"); } workOrderModel.AppointmentNumber = command.appointment.appt_number; _log.Notice("WorkOrder Id:" + command.appointment.appt_number); workOrderModel.TOA_AID = command.appointment.aid; _log.Notice("ETA Direct Activity Id:" + command.appointment.aid); workOrderModel.CustomerNumber = command.appointment.customer_number; workOrderModel.CommandType = ToaEnumsUtil.GetActivityCommandTypeEnum(command.type); workOrderModel.AssignedDate = command.date; workOrderModel.ExternalId = command.external_id; _dataModels.Add(workOrderModel); //Processing Inventories InventoryResponseElement[] inventoriesResponseElement = command.appointment.inventories; if (null != inventoriesResponseElement && inventoriesResponseElement.Length > 0) { List <InventoryModel> inventoryResponseModels = new List <InventoryModel>(); foreach (InventoryResponseElement inventoryResponseElement in inventoriesResponseElement) { ReportMessageElement[] inventoryReportMessages = inventoryResponseElement.report; InventoryModel responseInventoryModel = new InventoryModel(); if (inventoryResponseElement.invid > 0) { responseInventoryModel.InventoryID = inventoryResponseElement.invid; _log.Notice("Inventory ID is:" + inventoryResponseElement.invid); } _log.Notice("Processing Report Element for Inventory"); if (null != inventoryReportMessages) { foreach (ReportMessageElement reportMessage in inventoryReportMessages) { responseInventoryModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating/updating inventory", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } else { _log.Notice("Inventory added/updated", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } } _log.Notice("Processing of Report Element for Inventory is done"); if (null != inventoryResponseElement.properties) { foreach (PropertyElement inventoryProperty in inventoryResponseElement.properties) { switch (inventoryProperty.label) { case "invsn": responseInventoryModel.SerialNumber = inventoryProperty.value; _log.Notice("Inventory Serial Number is:" + inventoryProperty.value); break; case "invtype_label": responseInventoryModel.Type = inventoryProperty.value; _log.Notice("Inventory Type is:" + inventoryProperty.value); break; default: break; } } } //Adding individual inventory to list inventoryResponseModels.Add(responseInventoryModel); } //Adding list to WorkOrder Model workOrderModel.ActivityInventories = inventoryResponseModels; } } } } }
public void processResponseElement(InboundInterfaceResponseElement inboundResponseElement) { if (inboundResponseElement.report != null) { ReportMessageElement[] reportMessages = inboundResponseElement.report; WorkOrderModel workOrderModel = new WorkOrderModel(); if (null != reportMessages && reportMessages.Length > 0) { _log.Notice("Processing Report Element for WorkOrder"); foreach (ReportMessageElement reportMessage in reportMessages) { workOrderModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating appointment ", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } _log.Notice("Processing of Report Element for WorkOrder is done"); } _dataModels.Add(workOrderModel); } else if (inboundResponseElement.data != null) { CommandResponseElement[] commands = inboundResponseElement.data.commands; _resultCode = Common.ToaRequestResultCode.Success; if (null != commands && commands.Length > 0) { foreach (CommandResponseElement command in commands) { WorkOrderModel workOrderModel = new WorkOrderModel(); ReportMessageElement[] reportMessages = command.appointment.report; if (null != reportMessages && reportMessages.Length > 0) { _log.Notice("Processing Report Element for WorkOrder"); foreach (ReportMessageElement reportMessage in reportMessages) { workOrderModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating appointment:" + command.appointment.appt_number, "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } else { _log.Notice("Appointment created:" + command.appointment.appt_number, "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } _log.Notice("Processing of Report Element for WorkOrder is done"); } workOrderModel.AppointmentNumber = command.appointment.appt_number; _log.Notice("WorkOrder Id:" + command.appointment.appt_number); workOrderModel.TOA_AID = command.appointment.aid; _log.Notice("ETA Direct Activity Id:" + command.appointment.aid); workOrderModel.CustomerNumber = command.appointment.customer_number; workOrderModel.CommandType = ToaEnumsUtil.GetActivityCommandTypeEnum(command.type); workOrderModel.AssignedDate = command.date; workOrderModel.ExternalId = command.external_id; _dataModels.Add(workOrderModel); //Processing Inventories InventoryResponseElement[] inventoriesResponseElement = command.appointment.inventories; if (null != inventoriesResponseElement && inventoriesResponseElement.Length > 0) { List<InventoryModel> inventoryResponseModels = new List<InventoryModel>(); foreach (InventoryResponseElement inventoryResponseElement in inventoriesResponseElement) { ReportMessageElement[] inventoryReportMessages = inventoryResponseElement.report; InventoryModel responseInventoryModel = new InventoryModel(); if (inventoryResponseElement.invid > 0) { responseInventoryModel.InventoryID = inventoryResponseElement.invid; _log.Notice("Inventory ID is:" + inventoryResponseElement.invid); } _log.Notice("Processing Report Element for Inventory"); if (null != inventoryReportMessages) { foreach (ReportMessageElement reportMessage in inventoryReportMessages) { responseInventoryModel.AddReportMessage(reportMessage.result, reportMessage.type, reportMessage.code, reportMessage.description); if (!reportMessage.code.Equals(ActivityProperty.TOA_Report_Success_Code)) { _resultCode = Common.ToaRequestResultCode.Failure; _log.Error("Error creating/updating inventory", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } else { _log.Notice("Inventory added/updated", "Result:" + reportMessage.result + ", Type:" + reportMessage.type + ", Code:" + reportMessage.code + ", Description:" + reportMessage.description); } } } _log.Notice("Processing of Report Element for Inventory is done"); if (null != inventoryResponseElement.properties) { foreach (PropertyElement inventoryProperty in inventoryResponseElement.properties) { switch (inventoryProperty.label) { case "invsn": responseInventoryModel.SerialNumber = inventoryProperty.value; _log.Notice("Inventory Serial Number is:" + inventoryProperty.value); break; case "invtype_label": responseInventoryModel.Type = inventoryProperty.value; _log.Notice("Inventory Type is:" + inventoryProperty.value); break; default: break; } } } //Adding individual inventory to list inventoryResponseModels.Add(responseInventoryModel); } //Adding list to WorkOrder Model workOrderModel.ActivityInventories = inventoryResponseModels; } } } } }
public ToaRequestResult() { _dataModels = new List <IToaModel>(); _resultCode = ToaRequestResultCode.Failure; _log = ToaLogService.GetLog(); }
public ToaRequestResult() { _dataModels = new List<IToaModel>(); _resultCode = ToaRequestResultCode.Failure; _log = ToaLogService.GetLog(); }