/// <summary> /// Send Quotation Update /// New/Update Record in Web Portal /// </summary> /// <returns></returns> public bool SendUpdateQuotation() { bool result = false; try { DataTable table = getTable($"SELECT * FROM quotation WHERE QuotationNo = '{this.ReferenceNo}'"); if (table.Rows.Count > 0) { DataTable parts = getTable($"SELECT * FROM quotationparts WHERE QuotationNo = '{this.ReferenceNo}';"); DataTable services = getTable($"SELECT * FROM quotationservices WHERE QuotationNo = '{this.ReferenceNo}';"); Quotation model = Mapper.DynamicMap <IDataReader, List <Quotation> >(table.CreateDataReader()).First(); model.QuotationParts = AutoMapper.Mapper.DynamicMap <IDataReader, List <QuotationParts> >(parts.CreateDataReader()); model.QuotationServices = AutoMapper.Mapper.DynamicMap <IDataReader, List <QuotationServices> >(services.CreateDataReader()); var json = JsonConvert.SerializeObject(model); this.List = new SimpleModel(); this.List.Code = this.Code; this.List.SiteCode = this.SiteCode; this.List.IsSCMLocation = this.IsSupplyChain; this.List.Name = json; _messageSender = new RestClientMessageSender(); var response = (RestResponseBase)_messageSender.sendRequest <Quotation>(this); if (response.Content != string.Empty) { result = ((response.Content == "true") ? true : false); } /** * Insert / Queue value to tmp_update table to process by auto snyc when request failed */ if (!result && this.FailOver) { queueFailedRequest(this.Module.ToString(), this.ReferenceNo.ToString()); } } else { result = true; } } catch (Exception) { /** * Insert / Queue value to tmp_update table to process by auto snyc when request failed */ if (!result && this.FailOver) { queueFailedRequest(this.Module.ToString(), this.ReferenceNo.ToString()); } } return(result); }
public bool SendUpdateAssignedUnit() { bool result = false; DataTable table = getTable($"SELECT * FROM armyunit WHERE UnitID = {this.ReferenceID}"); if (table.Rows.Count > 0) { PicklistAssignedUnit dtSet = Mapper.DynamicMap <IDataReader, List <PicklistAssignedUnit> >(table.CreateDataReader()).First(); var json = JsonConvert.SerializeObject(dtSet); this.List = new SimpleModel(); this.List.Code = this.Code; this.List.SiteCode = this.SiteCode; this.List.IsSCMLocation = this.IsSupplyChain; this.List.Name = json; _messageSender = new RestClientMessageSender(); var response = (RestResponseBase)_messageSender.sendRequest <PicklistAssignedUnit>(this); if (response.Content != string.Empty) { result = ((response.Content == "true") ? true : false); } /** * Insert / Queue value to tmp_update table to process by auto snyc when request failed */ if (!result && this.FailOver) { queueFailedRequest(this.Module.ToString(), this.ReferenceID.ToString()); } } else { result = true; } return(result); }
/// <summary> /// Send Work Order Update /// New/Update Record in Web Portal /// </summary> /// <returns></returns> public bool SendUpdateWorkorder() { bool result = false; try { DataTable table = getTable($"SELECT * FROM workorder WHERE WONo = '{this.ReferenceNo}'"); if (table.Rows.Count > 0) { DataTable parts = getTable($"SELECT * FROM workorderparts WHERE WONo = '{this.ReferenceNo}';"); DataTable services = getTable($"SELECT * FROM workorderservices WHERE WONo = '{this.ReferenceNo}';"); DataTable labor = getTable($"SELECT * FROM wo_laborers WHERE WONo = '{this.ReferenceNo}';"); DataTable damagedinfo = getTable($"SELECT * FROM workorder_damage_info WHERE WONo = '{this.ReferenceNo}';"); DataTable damagedrepairs = getTable($"SELECT * FROM workorder_repair_info WHERE WONo = '{this.ReferenceNo}';"); DataTable damagedparts = getTable($"SELECT * FROM workorder_damparts WHERE WONo = '{this.ReferenceNo}';"); WorkOrder model = Mapper.DynamicMap <IDataReader, List <WorkOrder> >(table.CreateDataReader()).First(); DataTable deptloc = getTable("SELECT * FROM locdep WHERE NodeID = " + model.LocID + ";"); model.PicklistDepartmentLocation = Mapper.DynamicMap <IDataReader, List <PicklistDepartmentLocation> >(deptloc.CreateDataReader()).First(); model.WorkOrderParts = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderParts> >(parts.CreateDataReader()); model.WorkOrderServices = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderServices> >(services.CreateDataReader()); model.WorkOrderLaborers = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderLaborers> >(labor.CreateDataReader()); model.WorkOrderDamagedInfo = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderDamagedInfo> >(damagedinfo.CreateDataReader()); model.WorkOrderDamagedParts = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderDamagedParts> >(damagedparts.CreateDataReader()); model.WorkOrderRepairInfo = AutoMapper.Mapper.DynamicMap <IDataReader, List <WorkOrderRepairInfo> >(damagedrepairs.CreateDataReader()); var json = JsonConvert.SerializeObject(model); this.List = new SimpleModel(); this.List.Code = this.Code; this.List.SiteCode = this.SiteCode; this.List.IsSCMLocation = this.IsSupplyChain; this.List.Name = json; _messageSender = new RestClientMessageSender(); var response = (RestResponseBase)_messageSender.sendRequest <WorkOrder>(this); if (response.Content != string.Empty) { result = ((response.Content == "true") ? true : false); } /** * Insert / Queue value to tmp_update table to process by auto snyc when request failed */ if (!result && this.FailOver) { queueFailedRequest(this.Module.ToString(), this.ReferenceNo.ToString()); } } else { result = true; } } catch (Exception) { /** * Insert / Queue value to tmp_update table to process by auto snyc when request failed */ if (!result && this.FailOver) { queueFailedRequest(this.Module.ToString(), this.ReferenceNo.ToString()); } } return(result); }