Exemplo n.º 1
0
        private void OnTabSelected(object sender, TabControlEventArgs e)
        {
            //Event handler for change in tab selection
            this.Cursor = Cursors.WaitCursor;
            try {
                if (this.mIssue == null)
                {
                    return;
                }
                switch (e.TabPage.Name)
                {
                case "tabDetail":
                    break;

                case "tabOSD":
                    EnterpriseDS osdscans = EnterpriseFactory.GetOSDScans(this.mIssue.PROID);
                    this.oSDScanTableBindingSource.DataSource = osdscans;
                    break;

                case "tabPOD":
                    EnterpriseDS podscans = EnterpriseFactory.GetPODScans(this.mIssue.PROID);
                    this.pODScanTableBindingSource.DataSource = podscans;
                    break;
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }
Exemplo n.º 2
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Set initial service states
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mOutboundAgentServiceDS.Merge(EnterpriseFactory.GetOutboundAgentServices(this.mAgentID));

                //Set control services
                this.txtDescription.MaxLength = 40;
                this.txtDescription.Text      = this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].Description;
                this.txtMnemonic.MaxLength    = 3;
                this.txtMnemonic.Text         = this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].Mnemonic;
                if (!this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].IsAgentServiceIDNull())
                {
                    this.cboNativeServiceType.SelectedValue = this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].AgentServiceID;
                }
                else
                if (this.cboNativeServiceType.Items.Count > 0)
                {
                    this.cboNativeServiceType.SelectedIndex = 0;
                }
                this.cboNativeServiceType.Enabled = (this.cboNativeServiceType.Items.Count > 0);
                this.chkIsPickup.Checked          = this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].IsPickup;
                this.chkStatus.Checked            = this.mOutboundServiceTypeDS.OutboundServiceTypeTable[0].IsActive;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 3
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 != "")
         {
             if (e.Row.IsAddRow)
             {
                 //Add new entry
                 bool created = EnterpriseFactory.CreateClient(clid, format, path, key, client, scanner, userid);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
             else
             {
                 //Update existing
                 bool updated = EnterpriseFactory.UpdateClient(clid, format, path, key, client, scanner, userid);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Exemplo n.º 4
0
 private void OnFormLoad(object sender, EventArgs e)
 {
     //Event handler for form load event
     this.Cursor = Cursors.WaitCursor;
     try {
         this.mToolTip            = new System.Windows.Forms.ToolTip();
         this.mToolTip.ShowAlways = true;
         this.mToolTip.SetToolTip(this.cboIssueType, "Select an issue type.");
         //if(this.ctlCompLoc.CompanyItemsCount > 0) this.ctlCompLoc.CompanySelectedIndex = 0;
         this.cboIssueCategory.DataSource    = this.mIssueCategorys;
         this.cboIssueCategory.DisplayMember = "IssueCategoryTable.Category";
         this.cboIssueCategory.ValueMember   = "IssueCategoryTable.Category";
         this.mIssueCategorys.Merge(CRGFactory.IssueCategorys);
         this.cboIssueType.DataSource        = this.mIssueTypes;
         this.cboIssueType.DisplayMember     = "IssueTypeTable.Type";
         this.cboIssueType.ValueMember       = "IssueTypeTable.ID";
         this.cboIssueCategory.SelectedIndex = 0;
         OnIssueCategorySelected(this.cboIssueCategory, EventArgs.Empty);
         this.ctlContact.DataSource = this.mContacts;
         this.mContacts.Merge(EnterpriseFactory.GetContacts());
         this.txtTitle.Text = this.mIssue.Subject;
     }
     catch (Exception ex) { reportError(ex); }
     finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
 }
Exemplo n.º 5
0
        private void calcFSC(DriverCompDS.DriverRouteTableRow dayComp, RouteRatings ratings)
        {
            //Calculate FSC if required
            try {
                //1. FSC applies only if miles rates are present in the rating
                if (ratings.MileBaseRate > 0 || ratings.MileRate > 0)
                {
                    dayComp.FSCMiles = dayComp.Miles;
                }

                //2. Copy rates (for reference)
                dayComp.FuelCost = FinanceFactory.GetFuelCost(this.EndDate, this.mAgentNumber);
                dayComp.FSCGal   = EnterpriseFactory.GetDriverEquipmentMPG(dayComp.EquipmentTypeID);
                if (dayComp.FSCGal <= 0.0M)
                {
                    throw new ApplicationException("FSCGal (" + dayComp.FSCGal.ToString() + "MPG) is invalid.");
                }
                dayComp.FSCBaseRate = this.mTerminalConfig.FSBase;

                //3. Calculate FSC
                dayComp.FSC = dayComp.FSCMiles / dayComp.FSCGal * (dayComp.FuelCost - dayComp.FSCBaseRate);
                if (dayComp.FSC < 0)
                {
                    dayComp.FSC = 0.0M;
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while calculating FSC.", ex); }
        }
Exemplo n.º 6
0
        private void configApplication()
        {
            try {
                //Create event log and database trace listeners, and log application as started
                try {
                    ArgixTrace.AddListener(new DBTraceListener((LogLevel)App.Config.TraceLevel, App.Mediator, App.USP_TRACE, App.EventLogName));
                }
                catch {
                    ArgixTrace.AddListener(new DBTraceListener(LogLevel.Debug, App.Mediator, App.USP_TRACE, App.EventLogName));
                    ArgixTrace.WriteLine(new TraceMessage("Log level not found; setting log levels to Debug.", App.EventLogName, LogLevel.Warning, "Log Level"));
                }
                ArgixTrace.WriteLine(new TraceMessage(App.Version, App.EventLogName, LogLevel.Information, "App Started"));

                //Create business objects with configuration values
                App.Mediator.DataStatusUpdate += new DataStatusHandler(OnDataStatusUpdate);
                EnterpriseFactory.Mediator     = App.Mediator;
                EnterpriseFactory.RefreshCache();
                FinanceFactory.Mediator = App.Mediator;
                FinanceFactory.RefreshCache();
                DriverRatingFactory.Mediator = App.Mediator;
                this.stbMain.SetTerminalPanel(EnterpriseFactory.LocalTerminal.TerminalID.ToString(), EnterpriseFactory.LocalTerminal.Description);
                bool createError = App.Config.ReadOnly;
            }
            catch (Exception ex) { throw new ApplicationException("Configuration Failure", ex); }
        }
Exemplo n.º 7
0
        public static StationAssignments GetStationAssignments(Workstation workstation)
        {
            //Return a collection of current freight assignments for the specified workstation
            StationAssignments assignments = null;

            try {
                if (workstation == null)
                {
                    throw new ApplicationException("Workstation is null.");
                }

                assignments = new StationAssignments();
                StationAssignmentDS dsAssignments = new StationAssignmentDS();
                dsAssignments.Merge(Mediator.FillDataset(USP_FREIGHTCLIENTSHIPPER, TBL_FREIGHTCLIENTSHIPPER, new object[] { workstation.WorkStationID }));
                foreach (StationAssignmentDS.FreightClientShipperTableRow row in dsAssignments.FreightClientShipperTable)
                {
                    Client         client   = EnterpriseFactory.CreateClient(row.ClientNumber, row.ClientDivision, row.Client, row.ClientAddressLine1, row.ClientAddressLine2, row.ClientAddressCity, row.ClientAddressState, row.ClientAddressZip);
                    Shipper        shipper  = EnterpriseFactory.CreateShipper(row.FreightType, row.ShipperNumber, row.Shipper, row.ShipperAddressLine1, row.ShipperAddressLine2, row.ShipperAddressCity, row.ShipperAddressState, row.ShipperAddressZip, row.ShipperUserData);
                    InboundFreight shipment = FreightFactory.CreateInboundFreight(row.TerminalID, row.FreightID, row.FreightType, row.TDSNumber, row.VendorKey, row.TrailerNumber, row.PickupDate, row.PickupNumber, row.CubeRatio, client, shipper);
                    SortProfile    profile  = CreateSortProfile(shipment, row.SortTypeID, row.SortType, row.LabelID, row.ExcLocation);
                    assignments.Add(new StationAssignment("", workstation, shipment, profile));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while getting station assignments (freight-client-shipper).", ex); }
            return(assignments);
        }
Exemplo n.º 8
0
        private void OnRefresh(object sender, EventArgs e)
        {
            //Refresh view
            this.mISDClientDS.Clear();
            DataSet ds = EnterpriseFactory.GetClients();

            this.mISDClientDS.Merge(ds);
        }
Exemplo n.º 9
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Set initial service states
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mPaymentServicesDS.Merge(EnterpriseFactory.GetAvailablePaymentServices(this.mEntityID));

                //Set control services
                if (this.mPaymentServiceID == 0)
                {
                    //User selects vendor for a new association
                    if (this.mAssociationDS.CompanyPaymentServiceTable[0].PaymentServiceID == 0)
                    {
                        if (this.cboPaymentServices.Items.Count > 0)
                        {
                            this.cboPaymentServices.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        this.cboPaymentServices.SelectedValue = this.mAssociationDS.CompanyPaymentServiceTable[0].PaymentServiceID;
                    }
                    this.cboPaymentServices.Enabled = (this.cboPaymentServices.Items.Count > 0);
                }
                else
                {
                    //Vendor cannot be changed on association updates
                    this.mPaymentServicesDS.Clear();
                    this.mPaymentServicesDS.SelectionListTable.AddSelectionListTableRow(this.mAssociationDS.CompanyPaymentServiceTable[0].PaymentServiceID.ToString(), "Payment Service");
                    this.cboPaymentServices.Enabled = false;
                }
                this.txtComments.MaxLength = 30;
                if (!this.mAssociationDS.CompanyPaymentServiceTable[0].IsCommentsNull())
                {
                    this.txtComments.Text = this.mAssociationDS.CompanyPaymentServiceTable[0].Comments;
                }

                this.chkStatus.Checked = this.mAssociationDS.CompanyPaymentServiceTable[0].IsActive;
                if (!mParentIsActive)
                {
                    //If parent is inactive: 1. Status MUST be inactive for new
                    //					     2. Status cannot be changed for new or existing
                    if (this.mPaymentServiceID == 0)
                    {
                        this.chkStatus.Checked = false;
                    }
                    this.chkStatus.Enabled = false;
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 10
0
 private void OnAfterContactCreated(object source, ContactEventArgs e)
 {
     //Event handler for new contact created
     this.Cursor = Cursors.WaitCursor;
     try {
         //Persist the new contact
         int id = EnterpriseFactory.CreateContact(e.Contact);
         this.mContacts.Clear();
         this.mContacts.Merge(EnterpriseFactory.GetContacts());
         this.ctlContact.SelectedValue = id;
     }
     catch (Exception ex) { reportError(ex); }
     finally { this.Cursor = Cursors.Default; }
 }
Exemplo n.º 11
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Set initial service states
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mTerminalsDS.Merge(EnterpriseFactory.GetEntTerminals());

                //Set control services
                this.txtNameFirst.MaxLength = 30;
                this.txtNameFirst.Text      = "";
                if (!this.mDriverDS.DriverDetailTable[0].IsFirstNameNull())
                {
                    this.txtNameFirst.Text = this.mDriverDS.DriverDetailTable[0].FirstName.Trim();
                }
                this.txtNameLast.MaxLength = 40;
                this.txtNameLast.Text      = "";
                if (!this.mDriverDS.DriverDetailTable[0].IsLastNameNull())
                {
                    this.txtNameLast.Text = this.mDriverDS.DriverDetailTable[0].LastName.Trim();
                }
                this.mskPhone.InputMask = "###-###-####";
                if (!this.mDriverDS.DriverDetailTable[0].IsPhoneNull())
                {
                    this.mskPhone.Value = this.mDriverDS.DriverDetailTable[0].Phone;
                }
                if (this.mDriverDS.DriverDetailTable[0].TerminalID != 0)
                {
                    this.cboTerminal.SelectedValue = this.mDriverDS.DriverDetailTable[0].TerminalID;
                }
                else
                if (this.cboTerminal.Items.Count > 0)
                {
                    this.cboTerminal.SelectedIndex = 0;
                }
                this.cboTerminal.Enabled = (this.cboTerminal.Items.Count > 0);
                this.chkStatus.Checked   = this.mDriverDS.DriverDetailTable[0].IsActive;

                //Reset
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 12
0
 private void OnFormLoad(object sender, System.EventArgs e)
 {
     //Event handler for form load event
     this.Cursor = Cursors.WaitCursor;
     try {
         this.cboSortCenter.DisplayMember = "TerminalTable.Description";
         this.cboSortCenter.ValueMember   = "TerminalTable.ID";
         this.cboSortCenter.DataSource    = EnterpriseFactory.GetTerminals(global::Argix.Properties.ArgixSettings.Default.IsShipperSchedule);
         if (this.cboSortCenter.Items.Count > 0)
         {
             this.cboSortCenter.SelectedIndex = 0;
         }
         this.calDate.MinDate = System.DateTime.Today;
         OnValidateForm(null, null);
     }
     catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
     finally { this.Cursor = Cursors.Default; }
 }
Exemplo n.º 13
0
        public void RefreshCache()
        {
            //Refresh cached data
            try {
                //Validate operator state
                if (!this.mOperatorWorking)
                {
                    throw new ApplicationException("Station Operator not started for work; call StartWork() before RefreshCache().");
                }

                //Refresh all factory caches
                SortedItem.ErrorLabelTemplate = SortFactory.CreateOBLabelTemplate(this.mErrorLabelNumber, this.Station.PrinterType);
                EnterpriseFactory.RefreshCache();
                FreightFactory.RefreshCache();
                SortFactory.RefreshCache();
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing the factory caches.", ex); }
        }
Exemplo n.º 14
0
 private void showDeliveryInfo(bool showCartons)
 {
     //Clear and validate
     this.grdDelivery.SelectedObject = null;
     if (this.mIssue != null)
     {
         //Display delivery info
         EnterpriseDS delivery = EnterpriseFactory.GetDelivery(this.mIssue.CompanyID, this.mIssue.StoreNumber, this.mIssue.OFD1FromDate, this.mIssue.OFD1ToDate, this.mIssue.PROID);
         if (delivery.DeliveryTable.Rows.Count > 0)
         {
             this.grdDelivery.SelectedObject = new DeliveryInfo(delivery.DeliveryTable[0]);
         }
         if (showCartons)
         {
             EnterpriseDS osdscans = EnterpriseFactory.GetOSDScans(this.mIssue.PROID);
             this.oSDScanTableBindingSource.DataSource = osdscans;
             EnterpriseDS podscans = EnterpriseFactory.GetPODScans(this.mIssue.PROID);
             this.pODScanTableBindingSource.DataSource = podscans;
         }
     }
 }
Exemplo n.º 15
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)
         {
             string clid    = e.Rows[0].Cells["CLID"].Value.ToString();
             string format  = e.Rows[0].Cells["ExportFormat"].Value.ToString();
             string path    = e.Rows[0].Cells["ExportPath"].Value.ToString();
             string key     = e.Rows[0].Cells["CounterKey"].Value.ToString();
             string client  = e.Rows[0].Cells["Client"].Value.ToString();
             string scanner = e.Rows[0].Cells["Scanner"].Value.ToString();
             string userid  = e.Rows[0].Cells["UserID"].Value.ToString();
             bool   deleted = EnterpriseFactory.DeleteClient(clid, format, path, key, client, scanner, userid);
             OnRefresh(this.btnRefresh, EventArgs.Empty);
         }
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
Exemplo n.º 16
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Show early
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mLaneTypesDS.Merge(EnterpriseFactory.GetTerminalLaneTypes());
                this.mTerminalsDS.Merge(EnterpriseFactory.GetEntTerminals());

                //Set control services
                this.txtNumber.MaxLength = 10;
                this.txtNumber.Text      = "";
                if (!this.mLaneDS.TerminalLaneTable[0].IsLaneNumberNull())
                {
                    this.txtNumber.Text = this.mLaneDS.TerminalLaneTable[0].LaneNumber.Trim();
                }
                if (!this.mLaneDS.TerminalLaneTable[0].IsLaneTypeNull())
                {
                    this.cboLaneTypes.SelectedValue = this.mLaneDS.TerminalLaneTable[0].LaneType;
                }
                else
                if (this.cboLaneTypes.Items.Count > 0)
                {
                    this.cboLaneTypes.SelectedIndex = 0;
                }
                this.cboLaneTypes.Enabled     = (this.cboLaneTypes.Items.Count > 0);
                this.txtDescription.MaxLength = 40;
                this.txtDescription.Text      = "";
                if (!this.mLaneDS.TerminalLaneTable[0].IsDescriptionNull())
                {
                    this.txtDescription.Text = this.mLaneDS.TerminalLaneTable[0].Description.Trim();
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 17
0
        protected override void DetermineAssignment(string[] inputs, SortedItem sortedItem)
        {
            //Override the default implementation to determine the correct assignment
            //dynamically; if station has only one assignment, default implementation is OK
            try {
                if (Self.Assignments.Count == 1)
                {
                    //One assignment: use base implementation
                    base.DetermineAssignment(inputs, sortedItem);
                }
                else
                {
                    //Multiple assignments: determine assignment by associating the assignment
                    //with the client who has a store with the input SAN number
                    //Create a default SAN label (for the purpose of extracting the SAN number only)
                    //and determine the SAN number from the inputs
                    InboundLabel label = FreightFactory.DefaultSanInboundLabel.Copy();
                    label.ClearData();
                    try { label.DetermineInputs(inputs); }
                    catch (Exception ex) { sortedItem.ThrowException(new InboundLabelException(ex)); }
                    string sanNumber = label.GetElementValue("SAN").Substring(0, 6);
                    sanNumber += Helper.CheckDigitMod11(sanNumber);

                    //Determine the client for this SAN number and associate with an assignment
                    Client            client     = EnterpriseFactory.CreateClientForStoreSAN(Self.Assignments.Item(0).InboundFreight.Client.Division, sanNumber);
                    StationAssignment assignment = Self.Assignments.Item(client);
                    if (assignment == null)
                    {
                        sortedItem.ThrowException(new ClientForSanException());
                    }

                    //Associate freight and sort information
                    sortedItem.Freight     = assignment.InboundFreight;
                    sortedItem.SortProfile = assignment.SortProfile;
                }
            }
            catch (InboundLabelException ex) { throw ex; }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while determining freight assignment for multiple SAN freight assignments.", ex); }
        }
Exemplo n.º 18
0
        private void OnToolbarItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            //Toolbar handler - forward to main menu handler
            long id = 0;

            Issue.Action     action     = null;
            Issue.Attachment attachment = null;
            try {
                //Get the current action
                id     = Convert.ToInt64(this.lsvActions.SelectedItems[0].Name);
                action = this.mIssue.Item(id);
                switch (e.ClickedItem.Name)
                {
                case "btnNew":  this.ctxActionsNew.PerformClick(); break;

                case "btnPrint": this.ctxActionsPrint.PerformClick();  break;

                case "btnRefresh": this.ctxRefresh.PerformClick(); break;

                case "btnOpen":
                    //Open the selected attachment
                    attachment = action.Item(this.lsvAttachments.SelectedItems[0].Text);
                    attachment.Open();
                    break;

                case "btnAttach":
                    //Save an attachment to the selected action
                    OpenFileDialog dlgOpen = new OpenFileDialog();
                    dlgOpen.AddExtension = true;
                    dlgOpen.Filter       = "All Files (*.*) | *.*";
                    dlgOpen.FilterIndex  = 0;
                    dlgOpen.Title        = "Select Attachment to Save...";
                    dlgOpen.FileName     = "";
                    if (dlgOpen.ShowDialog(this) == DialogResult.OK)
                    {
                        attachment          = action.Item(0);
                        attachment.Filename = dlgOpen.FileName;
                        attachment.Save();
                        OnActionSelected(null, EventArgs.Empty);
                    }
                    break;

                case "btnSend":
                    if (this.lsvActions.SelectedItems.Count > 0)
                    {
                        //Create new mail item
                        if (OutlookApp == null)
                        {
                            return;
                        }
                        Outlook.MailItem item = (Outlook.MailItem)OutlookApp.CreateItem(Outlook.OlItemType.olMailItem);
                        item.Subject = this._Issue.Subject;
                        item.Body    = action.Comment;
                        item.To      = EnterpriseFactory.GetContact(this._Issue.ContactID).Email;
                        item.Display(false);
                    }
                    break;
                }
            }
            catch (Exception ex) { reportError(new ControlException("Unexpected error in IssueInspector.", ex)); }
        }
Exemplo n.º 19
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Show early
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mTypesDS.Merge(EnterpriseFactory.GetAddressTypes());
                this.mCountriesDS.Merge(EnterpriseFactory.GetCountries());
                this.mStatesDS.Merge(EnterpriseFactory.GetStates());

                //Load details
                if (this.mAddressDS.AddressViewTable[0].AddressType != "")
                {
                    this.cboTypes.SelectedValue = this.mAddressDS.AddressViewTable[0].AddressType;
                }
                else
                if (this.cboTypes.Items.Count > 0)
                {
                    this.cboTypes.SelectedIndex = 0;
                }
                this.cboTypes.Enabled   = false;
                this.txtLine1.MaxLength = 40;
                this.txtLine1.Text      = this.mAddressDS.AddressViewTable[0].AddressLine1;
                this.txtLine2.MaxLength = 40;
                this.txtLine2.Text      = "";
                if (!this.mAddressDS.AddressViewTable[0].IsAddressLine2Null())
                {
                    this.txtLine2.Text = this.mAddressDS.AddressViewTable[0].AddressLine2;
                }
                this.txtCity.MaxLength = 40;
                this.txtCity.Text      = this.mAddressDS.AddressViewTable[0].City;
                if (!this.mAddressDS.AddressViewTable[0].IsStateOrProvinceNull())
                {
                    this.cboStates.SelectedValue = this.mAddressDS.AddressViewTable[0].StateOrProvince;
                }
                else
                if (this.cboStates.Items.Count > 0)
                {
                    this.cboStates.SelectedIndex = 0;
                }
                this.cboStates.Enabled = (this.cboStates.Items.Count > 0);
                this.txtZip.MaxLength  = 15;
                this.txtZip.Text       = "";
                if (!this.mAddressDS.AddressViewTable[0].IsPostalCodeNull())
                {
                    this.txtZip.Text = this.mAddressDS.AddressViewTable[0].PostalCode;
                }
                if (!this.mAddressDS.AddressViewTable[0].IsCountryIDNull())
                {
                    this.cboCountries.SelectedValue = this.mAddressDS.AddressViewTable[0].CountryID;
                }
                else
                if (this.cboCountries.Items.Count > 0)
                {
                    this.cboCountries.SelectedIndex = 0;
                }
                this.cboCountries.Enabled = (this.cboCountries.Items.Count > 0);
                this.chkStatus.Checked    = this.mAddressDS.AddressViewTable[0].IsActive;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 20
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Set inital services
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mTypesDS.Merge(TransportationFactory.GetVehicleTypes());
                this.mStatesDS.Merge(EnterpriseFactory.GetStates());
                this.mDriversDS.Merge(TransportationFactory.GetDrivers());

                //Set control services
                this.txtVehicle.MaxLength = 30;
                this.txtVehicle.Text      = "";
                if (!this.mVehicleDS.VehicleDetailTable[0].IsDescriptionNull())
                {
                    this.txtVehicle.Text = this.mVehicleDS.VehicleDetailTable[0].Description;
                }
                if (this.mVehicleDS.VehicleDetailTable[0].VehicleType != "")
                {
                    this.cboTypes.SelectedValue = this.mVehicleDS.VehicleDetailTable[0].VehicleType;
                }
                else
                if (this.cboTypes.Items.Count > 0)
                {
                    this.cboTypes.SelectedIndex = 0;
                }
                this.cboTypes.Enabled     = (this.cboTypes.Items.Count > 0);
                this.txtLicense.MaxLength = 8;
                this.txtLicense.Text      = "";
                if (!this.mVehicleDS.VehicleDetailTable[0].IsLicPlateNumberNull())
                {
                    this.txtLicense.Text = this.mVehicleDS.VehicleDetailTable[0].LicPlateNumber;
                }
                if (!this.mVehicleDS.VehicleDetailTable[0].IsStateNull())
                {
                    this.cboStates.SelectedValue = this.mVehicleDS.VehicleDetailTable[0].State;
                }
                else
                if (this.cboStates.Items.Count > 0)
                {
                    this.cboStates.SelectedIndex = 0;
                }
                this.cboStates.Enabled = (this.cboStates.Items.Count > 0);
                if (!this.mVehicleDS.VehicleDetailTable[0].IsDriverIDNull())
                {
                    this.cboDrivers.SelectedValue = this.mVehicleDS.VehicleDetailTable[0].DriverID;
                }
                else
                if (this.cboDrivers.Items.Count > 0)
                {
                    this.cboDrivers.SelectedIndex = 0;
                }
                this.cboDrivers.Enabled = (this.cboDrivers.Items.Count > 0);
                this.chkStatus.Checked  = this.mVehicleDS.VehicleDetailTable[0].IsActive;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 21
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Show early
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mScaleTypesDS.Merge(EnterpriseFactory.GetWorkstationScaleTypes());
                this.mPrinterTypesDS.Merge(EnterpriseFactory.GetWorkstationPrinterTypes());
                this.mScalePortsDS.Merge(EnterpriseFactory.GetWorkstationPorts());
                this.mPrinterPortsDS.Merge(EnterpriseFactory.GetWorkstationPorts());

                //Set control services
                this.txtName.MaxLength   = 20;
                this.txtName.Text        = this.mWorkstationDS.TerminalWorkstationTable[0].Name.Trim();
                this.txtNumber.MaxLength = 10;
                this.txtNumber.Text      = "";
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsNumberNull())
                {
                    this.txtNumber.Text = this.mWorkstationDS.TerminalWorkstationTable[0].Number.Trim();
                }
                this.txtLocationDescription.MaxLength = 40;
                this.txtLocationDescription.Text      = "";
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsDescriptionNull())
                {
                    this.txtLocationDescription.Text = this.mWorkstationDS.TerminalWorkstationTable[0].Description.Trim();
                }
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsScaleTypeNull())
                {
                    this.cboScaleTypes.SelectedValue = this.mWorkstationDS.TerminalWorkstationTable[0].ScaleType;
                }
                else
                if (this.cboScaleTypes.Items.Count > 0)
                {
                    this.cboScaleTypes.SelectedIndex = 0;
                }
                this.cboScaleTypes.Enabled = (this.cboScaleTypes.Items.Count > 0);
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsScalePortNull())
                {
                    this.cboScalePort.SelectedValue = this.mWorkstationDS.TerminalWorkstationTable[0].ScalePort;
                }
                else
                if (this.cboScalePort.Items.Count > 0)
                {
                    this.cboScalePort.SelectedIndex = 0;
                }
                this.cboScalePort.Enabled = (this.cboScalePort.Items.Count > 0);
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsPrinterTypeNull())
                {
                    this.cboPrinterTypes.SelectedValue = this.mWorkstationDS.TerminalWorkstationTable[0].PrinterType;
                }
                else
                if (this.cboPrinterTypes.Items.Count > 0)
                {
                    this.cboPrinterTypes.SelectedIndex = 0;
                }
                this.cboPrinterTypes.Enabled = (this.cboPrinterTypes.Items.Count > 0);
                if (!this.mWorkstationDS.TerminalWorkstationTable[0].IsPrinterPortNull())
                {
                    this.cboPrinterPort.SelectedValue = this.mWorkstationDS.TerminalWorkstationTable[0].PrinterPort;
                }
                else
                if (this.cboPrinterPort.Items.Count > 0)
                {
                    this.cboPrinterPort.SelectedIndex = 0;
                }
                this.cboPrinterPort.Enabled = (this.cboPrinterPort.Items.Count > 0);
                this.chkTrace.Checked       = this.mWorkstationDS.TerminalWorkstationTable[0].IsTraceNull() ? false : this.mWorkstationDS.TerminalWorkstationTable[0].Trace;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 22
0
        private void OnFormLoad(object sender, System.EventArgs e)
        {
            //Initialize controls - set default values
            this.Cursor = Cursors.WaitCursor;
            try {
                //Load early
                this.Visible = true;
                Application.DoEvents();

                //Get selection lists
                this.mCountriesDS.Merge(EnterpriseFactory.GetCountries());
                this.mStatesDS.Merge(EnterpriseFactory.GetStates());

                //Set control services
                this.txtNumber.MaxLength = 8;
                this.txtNumber.Text      = this.mCarriersDS.CarrierDetailTable[0].Number;
                this.txtNumber.Enabled   = (this.mCarrierID == 0);
                this.txtName.MaxLength   = 30;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsCarrierNameNull())
                {
                    this.txtName.Text = this.mCarriersDS.CarrierDetailTable[0].CarrierName;
                }

                this.txtLine1.MaxLength = 40;
                this.txtLine1.Text      = this.mCarriersDS.CarrierDetailTable[0].AddressLine1;
                this.txtLine2.MaxLength = 40;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsAddressLine2Null())
                {
                    this.txtLine2.Text = this.mCarriersDS.CarrierDetailTable[0].AddressLine2;
                }
                this.txtCity.MaxLength = 40;
                //if(!this.mCarriersDS.CarrierDetailTable[0].IsCityNull())
                this.txtCity.Text = this.mCarriersDS.CarrierDetailTable[0].City;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsStateOrProvinceNull())
                {
                    this.cboStates.SelectedValue = this.mCarriersDS.CarrierDetailTable[0].StateOrProvince;
                }
                else
                if (this.cboStates.Items.Count > 0)
                {
                    this.cboStates.SelectedIndex = 0;
                }
                this.cboStates.Enabled = (this.cboStates.Items.Count > 0);
                this.txtZip.MaxLength  = 15;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsPostalCodeNull())
                {
                    this.txtZip.Text = this.mCarriersDS.CarrierDetailTable[0].PostalCode;
                }
                if (this.mCarriersDS.CarrierDetailTable[0].CountryID > 0)
                {
                    this.cboCountries.SelectedValue = this.mCarriersDS.CarrierDetailTable[0].CountryID;
                }
                else
                if (this.cboCountries.Items.Count > 0)
                {
                    this.cboCountries.SelectedIndex = 0;
                }
                this.cboCountries.Enabled = (this.cboCountries.Items.Count > 0);

                this.txtContact.MaxLength = 30;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsContactNameNull())
                {
                    this.txtContact.Text = this.mCarriersDS.CarrierDetailTable[0].ContactName;
                }
                this.mskPhone.InputMask = "###-###-####";
                if (!this.mCarriersDS.CarrierDetailTable[0].IsPhoneNull())
                {
                    this.mskPhone.Value = this.mCarriersDS.CarrierDetailTable[0].Phone;
                }
                this.txtExt.MaxLength = 4;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsExtensionNull())
                {
                    this.txtExt.Text = this.mCarriersDS.CarrierDetailTable[0].Extension;
                }
                this.mskFax.InputMask = "###-###-####";
                if (!this.mCarriersDS.CarrierDetailTable[0].IsFaxNull())
                {
                    this.mskFax.Value = this.mCarriersDS.CarrierDetailTable[0].Fax;
                }
                this.txteMail.MaxLength = 50;
                if (!this.mCarriersDS.CarrierDetailTable[0].IsEmailNull())
                {
                    this.txteMail.Text = this.mCarriersDS.CarrierDetailTable[0].Email;
                }

                this.chkCtlDrivers.Checked  = this.mCarriersDS.CarrierDetailTable[0].ControlDrivers;
                this.chkCtlTrailers.Checked = this.mCarriersDS.CarrierDetailTable[0].ControlTrailers;
                this.chkStatus.Checked      = this.mCarriersDS.CarrierDetailTable[0].IsActive;
            }
            catch (Exception ex) { reportError(ex); }
            finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 23
0
        private void OnMenuClick(object sender, System.EventArgs e)
        {
            //Event handler for menu selection
            Issue issue = null;

            try {
                ToolStripDropDownItem menu = (ToolStripDropDownItem)sender;
                switch (menu.Text)
                {
                case MNU_NEW:
                    issue = CRGFactory.GetIssue(0);
                    dlgIssue dlg = new dlgIssue(issue);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        if (issue.Save())
                        {
                            for (int i = 0; i < this.grdIssues.Rows.Count; i++)
                            {
                                int id = Convert.ToInt32(this.grdIssues.Rows[i].Cells["ID"].Value);
                                if (id == issue.ID)
                                {
                                    this.grdIssues.Rows[i].Selected = true;
                                    this.grdIssues.DisplayLayout.Bands[0].Columns["LastActionCreated"].SortIndicator = SortIndicator.Descending;
                                    OnGridSelectionChanged(this.grdIssues, null);
                                    break;
                                }
                            }
                        }
                    }
                    break;

                case MNU_OPEN:      break;

                case MNU_SAVE:      break;

                case MNU_SAVEAS:

                    SaveFileDialog dlgSave = new SaveFileDialog();
                    dlgSave.AddExtension    = true;
                    dlgSave.Filter          = "Export Files (*.xml) | *.xml | Excel Files (*.xls) | *.xls";
                    dlgSave.FilterIndex     = 0;
                    dlgSave.Title           = "Save Issues As...";
                    dlgSave.FileName        = "";
                    dlgSave.OverwritePrompt = true;
                    if (dlgSave.ShowDialog(this) == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        Application.DoEvents();
                        if (dlgSave.FileName.EndsWith("xls"))
                        {
                            new Argix.ExcelFormat().Transform(this.mIssues, dlgSave.FileName);
                        }
                        else
                        {
                            this.mIssues.WriteXml(dlgSave.FileName, XmlWriteMode.WriteSchema);
                        }
                    }
                    break;

                case MNU_SETUP: UltraGridPrinter.PageSettings(); break;

                case MNU_PRINT: UltraGridPrinter.Print(this.grdIssues, this.grdIssues.Text, true); break;

                case MNU_PREVIEW: UltraGridPrinter.PrintPreview(this.grdIssues, this.grdIssues.Text); break;

                case MNU_REFRESH:
                    this.Cursor = Cursors.WaitCursor;
                    this.mGridSvcIssues.CaptureState("ID");
                    switch (this.cboView.Text)
                    {
                    case "Search Results": break;

                    case "Issue History":
                        this.mIssueHistory.Clear();
                        this.mIssueHistory.Merge(CRGFactory.IssueHistory(this.mIssueH));
                        break;

                    case "Draft Issues":    break;

                    default:
                        DataSet ds = CRGFactory.GetIssues();
                        lock (this.mIssues) {
                            this.mIssues.Clear();
                            this.mIssues.Merge(ds);
                        }
                        postIssueUpdates();
                        break;
                    }
                    this.mGridSvcIssues.RestoreState();
                    break;

                case MNU_REFRESHCACHE: EnterpriseFactory.RefreshCache(); CRGFactory.RefreshCache(); break;

                case MNU_AUTOREFRESHON:
                    this.mnuCtxAutoRefreshOn.Checked = !this.mnuCtxAutoRefreshOn.Checked;
                    if (this.mnuCtxAutoRefreshOn.Checked)
                    {
                        StartAuto();
                    }
                    else
                    {
                        StopAuto();
                    }
                    break;

                case MNU_CONTACTS:
                    winContacts winC = new winContacts();
                    winC.Font = this.Font;
                    winC.ShowDialog();
                    break;

                case MNU_PROPERTIES: break;
                }
            }
            catch (Exception ex) { reportError(ex); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }