Пример #1
0
        public override bool Export(string exportFile, ISDClient isdClient, Pickup pickup, ISDExportDataset sortedItems)
        {
            //Exports sorted items dataset to a file specified by the database
            bool         exported = false;
            StreamWriter writer   = null;

            try {
                //Validate file is unique
                if (File.Exists(exportFile))
                {
                    throw new Exception("Export file " + exportFile + " already exists. ");
                }

                //Create the new file and save sorted items for this pickup to disk
                writer = new StreamWriter(new FileStream(exportFile, FileMode.Create, FileAccess.ReadWrite));
                writer.BaseStream.Seek(0, SeekOrigin.Begin);
                for (int j = 0; j < sortedItems.SortedItemTable.Rows.Count; j++)
                {
                    writer.WriteLine(formatSortedItemRecord((ISDExportDataset.SortedItemTableRow)sortedItems.SortedItemTable.Rows[j]));
                }
                writer.Flush();
                exported = true;
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            finally { if (writer != null)
                      {
                          writer.Close();
                      }
            }
            return(exported);
        }
Пример #2
0
        public bool DeleteISDClient(int terminalID, ISDClient client)
        {
            //
            bool deleted = false;

            try {
                deleted = new TsortGateway(terminalID).DeleteISDClient(client);
            }
            catch (Exception ex) { throw new FaultException <ISDExportFault>(new ISDExportFault(ex.Message), "Service Error"); }
            return(deleted);
        }
Пример #3
0
        public bool DeleteISDClient(ISDClient client)
        {
            //
            bool deleted = false;

            try {
                deleted = new DataService().ExecuteNonQuery(SQL_CONNID, USP_ISDE_CONFIG_DELETE,
                                                            new object[] {
                    client.CLID, client.ExportFormat, client.ExportPath,
                    client.CounterKey, client.Client, client.Scanner, client.UserID
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(deleted);
        }
Пример #4
0
        public static bool DeleteISDClient(ISDClient isdClient)
        {
            //
            bool deleted = false;
            ISDExportServiceClient client = new ISDExportServiceClient();

            try {
                deleted = client.DeleteISDClient(int.Parse(Program.TerminalCode), isdClient);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <AgentLineHaulFault> afe) { client.Abort(); throw new ApplicationException(afe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(deleted);
        }
Пример #5
0
 private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
 {
     //Event handler for data entry row updated
     try {
         //There is no selected row when updating- at a cell level
         string clid    = e.Row.Cells["CLID"].Value.ToString();
         string format  = e.Row.Cells["ExportFormat"].Value.ToString();
         string path    = e.Row.Cells["ExportPath"].Value.ToString();
         string key     = e.Row.Cells["CounterKey"].Value.ToString();
         string client  = e.Row.Cells["Client"].Value.ToString();
         string scanner = e.Row.Cells["Scanner"].Value.ToString();
         string userid  = e.Row.Cells["UserID"].Value.ToString();
         if (clid != "" && format != "" && path != "" && key != "" && client != "")
         {
             ISDClient isdClient = new ISDClient();
             isdClient.CLID         = clid;
             isdClient.ExportFormat = format;
             isdClient.ExportPath   = path;
             isdClient.CounterKey   = key;
             isdClient.Client       = client;
             isdClient.Scanner      = scanner;
             isdClient.UserID       = userid;
             if (e.Row.IsAddRow)
             {
                 //Add new entry
                 bool created = AgentLineHaulGateway.CreateISDClient(isdClient);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
             else
             {
                 //Update existing
                 bool updated = AgentLineHaulGateway.UpdateISDClient(isdClient);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Пример #6
0
        public ISDClients GetClients(string clientNumber)
        {
            ISDClients clients = null;

            try {
                clients = new ISDClients();
                DataSet ds = fillDataset(USP_EXPORTFILECONFIG, TBL_EXPORTFILECONFIG, new object[] { clientNumber });
                if (ds != null)
                {
                    ISDClientDS _clients = new ISDClientDS();
                    _clients.Merge(ds);
                    for (int i = 0; i < _clients.ClientTable.Rows.Count; i++)
                    {
                        ISDClient client = new ISDClient(_clients.ClientTable[i]);
                        clients.Add(client);
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("", ex); }
            return(clients);
        }
Пример #7
0
 private void OnGridBeforeRowsDeleted(object sender, BeforeRowsDeletedEventArgs e)
 {
     //Event hanlder for rows deleting
     try {
         //Cannot delete 'Default' entries or the new row entry
         e.DisplayPromptMsg = true;
         if (!e.Cancel)
         {
             ISDClient isdClient = new ISDClient();
             isdClient.CLID         = e.Rows[0].Cells["CLID"].Value.ToString();
             isdClient.ExportFormat = e.Rows[0].Cells["ExportFormat"].Value.ToString();
             isdClient.ExportPath   = e.Rows[0].Cells["ExportPath"].Value.ToString();
             isdClient.CounterKey   = e.Rows[0].Cells["CounterKey"].Value.ToString();
             isdClient.Client       = e.Rows[0].Cells["Client"].Value.ToString();
             isdClient.Scanner      = e.Rows[0].Cells["Scanner"].Value.ToString();
             isdClient.UserID       = e.Rows[0].Cells["UserID"].Value.ToString();
             bool deleted = AgentLineHaulGateway.DeleteISDClient(isdClient);
             OnRefresh(this.btnRefresh, EventArgs.Empty);
         }
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Пример #8
0
 public abstract bool Export(string exportFile, ISDClient isdClient, Pickup pickup, ISDExportDataset sortedItems);