public static EnterpriseDataset TrackCartonsForStoreByPickupDate(string clientID, string store, DateTime fromDate, DateTime toDate, string vendorID) { // EnterpriseDataset cartons = new EnterpriseDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = null; if (store.Trim().Length > 0) { ds = client.TrackCartonsForStoreByPickupDate(clientID, store, fromDate, toDate, vendorID); } client.Close(); if (ds != null && ds.Tables["CartonDetailForStoreTable"] != null && ds.Tables["CartonDetailForStoreTable"].Rows.Count > 0) { cartons.Merge(ds, true, MissingSchemaAction.Ignore); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(cartons); }
private void OnTrack(object sender, EventArgs e) { // this.Cursor = Cursors.WaitCursor; try { this.mTLs.Clear(); this.mCartons.Clear(); this.mDetail = new EnterpriseDataset(); if (!this.DesignMode) { //DataSet ds = Argix.Enterprise.EnterpriseGateway.TrackCartonsForStoreByDeliveryDate(this.cboClient.SelectedValue.ToString(),this.mskStoreNumber.Text,this.dtpFrom.Value,this.dtpTo.Value,null); if (this.cboDateType.Text == "Delivery") { this.mDetail.Merge(Argix.Enterprise.EnterpriseGateway.TrackCartonsForStoreByDeliveryDate(this.cboClient.SelectedValue.ToString(), this.mskStoreNumber.Text, this.dtpFrom.Value, this.dtpTo.Value, null)); } else { this.mDetail.Merge(Argix.Enterprise.EnterpriseGateway.TrackCartonsForStoreByPickupDate(this.cboClient.SelectedValue.ToString(), this.mskStoreNumber.Text, this.dtpFrom.Value, this.dtpTo.Value, null)); } EnterpriseDataset summary = new EnterpriseDataset(); summary.Merge(this.mDetail.CartonDetailForStoreTable.DefaultView.ToTable(true, new string[] { "TL" })); foreach (EnterpriseDataset.CartonDetailForStoreTableRow row in summary.CartonDetailForStoreTable.Rows) { row.CartonCount = this.mDetail.CartonDetailForStoreTable.Select("TL='" + row.TL + "'").Length; row.Weight = int.Parse(this.mDetail.CartonDetailForStoreTable.Compute("Sum(weight)", "TL='" + row.TL + "'").ToString()); object minDate = this.mDetail.CartonDetailForStoreTable.Compute("Min(PodDate)", "TL='" + row.TL + "' AND (IsNull(PodDate,#01/01/1900#) <> #01/01/1900#)"); EnterpriseDataset.CartonDetailForStoreTableRow row0 = (EnterpriseDataset.CartonDetailForStoreTableRow)(this.mDetail.CartonDetailForStoreTable.Select("TL='" + row.TL + "'"))[0]; if (minDate != System.DBNull.Value) { row.PodDate = DateTime.Parse(minDate.ToString()); } else { if (!row0.IsOFD1Null()) { row.OFD1 = row0.OFD1; } } row.Zone = row0.Zone; row.Store = row0.Store; row.CBOL = row0.IsCBOLNull() ? "" : row0.CBOL; row.AG = !row0.IsAGNull() ? row0.AG : ""; row.AgName = row0.Trf == "N" ? row0.AgName : row0.AgName + " (Transfer)"; row.AcceptChanges(); } this.mTLs.Merge(summary); } } catch (Exception ex) { App.ReportError(new ApplicationException(ex.Message)); } finally { this.Cursor = Cursors.Default; } }
public static EnterpriseDataset GetClients(string vendorID) { // EnterpriseDataset clients = new EnterpriseDataset(); CRMServiceClient client = new CRMServiceClient(); try { DataSet ds = client.GetClients(vendorID); client.Close(); if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0) { clients.Merge(ds); } } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(clients); }
public Argix.Enterprise.Terminals GetTerminals() { //Returns a list of terminals Argix.Enterprise.Terminals terminals = null; try { terminals = new Argix.Enterprise.Terminals(); DataSet ds = new TLViewerGateway().GetTerminals(); if (ds != null) { EnterpriseDataset tDS = new EnterpriseDataset(); tDS.Merge(ds); for (int i = 0; i < tDS.TerminalTable.Rows.Count; i++) { Argix.Enterprise.Terminal terminal = new Argix.Enterprise.Terminal(tDS.TerminalTable[i]); terminals.Add(terminal); } } } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(terminals); }