Exemplo n.º 1
0
        public BatteryItems GetUnassignedBatteryItems(long terminalID)
        {
            //Get unassigned batteries for the specified terminal
            BatteryItems items = null;

            try {
                items = new BatteryItems();
                DataSet ds = fillDataset(USP_BATTERY_UNASSIGNED, TBL_BATTERY_UNASSIGNED, new object[] {});
                if (ds != null)
                {
                    ItemDS itemDS = new ItemDS();
                    itemDS.Merge(ds);
                    for (int i = 0; i < itemDS.BatteryItemTable.Rows.Count; i++)
                    {
                        BatteryItem item = new BatteryItem(itemDS.BatteryItemTable[i]);
                        if (item.TerminalID == terminalID)
                        {
                            items.Add(item);
                        }
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while reading unassigned battery items.", ex))); }
            return(items);
        }
Exemplo n.º 2
0
        public BatteryItem GetBatteryItem(string itemID)
        {
            //Get a new or existing battery item
            BatteryItem item = null;

            try {
                if (itemID.Length == 0)
                {
                    item = new BatteryItem();
                }
                else
                {
                    BatteryItems items = GetBatteryItems();
                    for (int i = 0; i < items.Count; i++)
                    {
                        if (items[i].ItemID == itemID)
                        {
                            item = items[i]; break;
                        }
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while reading battery item.", ex))); }
            return(item);
        }
Exemplo n.º 3
0
        public BatteryItems GetBatteryItems()
        {
            //Update collection of battery items
            BatteryItems items = null;

            try {
                items = new BatteryItems();;
                DataSet ds = fillDataset(USP_BATTERY_VIEW, TBL_BATTERY_VIEW, new object[] {});
                if (ds != null)
                {
                    ItemDS itemDS = new ItemDS();
                    itemDS.Merge(ds);
                    for (int i = 0; i < itemDS.BatteryItemTable.Rows.Count; i++)
                    {
                        BatteryItem item = new BatteryItem(itemDS.BatteryItemTable[i]);
                        item.DriverName  = itemDS.BatteryItemTable[i].IsLastNameNull() ? "" : itemDS.BatteryItemTable[i].LastName.Trim();
                        item.DriverName += !itemDS.BatteryItemTable[i].IsLastNameNull() && !itemDS.BatteryItemTable[i].IsFirstNameNull() ? ", " : "";
                        item.DriverName += itemDS.BatteryItemTable[i].IsFirstNameNull() ? "" : itemDS.BatteryItemTable[i].FirstName.Trim();
                        items.Add(item);
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while reading battery items.", ex))); }
            return(items);
        }
Exemplo n.º 4
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();
                #region Grid control
                this.grdAssignments.DisplayLayout.CaptionAppearance.FontData.SizeInPoints = 8;
                this.grdAssignments.DisplayLayout.Override.AllowUpdate                             = DefaultableBoolean.True;
                this.grdAssignments.DisplayLayout.Bands[0].Override.AllowUpdate                    = DefaultableBoolean.True;
                this.grdAssignments.DisplayLayout.Bands[0].Override.CellClickAction                = CellClickAction.Edit;
                this.grdAssignments.DisplayLayout.Bands[0].Columns["Assign"].CellActivation        = Activation.AllowEdit;
                this.grdAssignments.DisplayLayout.Bands[0].Override.RowFilterMode                  = RowFilterMode.AllRowsInBand;
                this.grdAssignments.DisplayLayout.Bands[0].Columns["AssignedDate"].SortIndicator   = SortIndicator.Descending;
                this.grdAssignments.DisplayLayout.Bands[0].Columns["AssignedDate"].EditorComponent = this.dtGrid;
                this.grdAssignments.DisplayLayout.Bands[0].Columns["AssignedDate"].CellActivation  = Activation.AllowEdit;
                #endregion
                this._chkShowUnassigned.Checked = this.mDriver.IsActive == 1;
                this._chkShowUnassigned.Enabled = this.mDriver.IsActive == 1;

                this.mDriverAssignments = new BatteryItemAssignments();
                for (int i = 0; i < this.mDriver.Assignments.Count; i++)
                {
                    BatteryItemAssignment assignment = new BatteryItemAssignment();
                    assignment.ItemID       = this.mDriver.Assignments[i].ItemID;
                    assignment.DriverID     = this.mDriver.Assignments[i].DriverID;
                    assignment.AssignedDate = this.mDriver.Assignments[i].AssignedDate;
                    assignment.AssignedUser = this.mDriver.Assignments[i].AssignedUser;
                    assignment.Comments     = this.mDriver.Assignments[i].Comments;
                    assignment.RowVersion   = this.mDriver.Assignments[i].RowVersion;
                    this.mDriverAssignments.Add(assignment);
                }

                BatteryItems items = MobileDevicesProxy.GetUnassignedBatteryItems(this.mDriver.TerminalID);
                for (int i = 0; i < items.Count; i++)
                {
                    BatteryItemAssignment assignment = new BatteryItemAssignment();
                    assignment.ItemID     = items[i].ItemID;
                    assignment.Comments   = items[i].Comments;
                    assignment.RowVersion = items[i].RowVersion;
                    this.mDriverAssignments.Add(assignment);
                }
                this.mAssignments.DataSource = this.mDriverAssignments;
                OnShowUnassignedBatteries(null, null);
                this.txtBatteryInput.Focus();
            }
            catch (Exception ex) { App.ReportError(ex, true, Argix.Terminals.LogLevel.Error); }
            finally { this.btnOK.Enabled = false; this.Cursor = Cursors.Default; }
        }
Exemplo n.º 5
0
        public static BatteryItems GetUnassignedBatteryItems(long terminalID)
        {
            BatteryItems batteries = null;

            try {
                _Client   = new MobileDevicesServiceClient();
                batteries = _Client.GetUnassignedBatteryItems(terminalID);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetUnassignedBatterys() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetUnassignedBatterys() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetUnassignedBatterys() communication error.", ce); }
            return(batteries);
        }
Exemplo n.º 6
0
        public static BatteryItems GetBatteryItems()
        {
            BatteryItems items = null;

            try {
                _Client = new MobileDevicesServiceClient();
                items   = _Client.GetBatteryItems();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetBatteryItems() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetBatteryItems() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetBatteryItems() communication error.", ce); }
            return(items);
        }