Пример #1
0
 //Interface
 public dlgDeviceItem(DeviceItem item)
 {
     //Constructor
     try {
         //Required designer support
         InitializeComponent();
         this.mItem = item;
         this.Text  = (this.mItem.ItemID != "") ? this.mItem.Terminal.Trim() + " Device (" + this.mItem.ItemID + ")" : this.mItem.Terminal.Trim() + " Device (New)";
     }
     catch (Exception ex) { throw new ApplicationException("Failed to create new Device Item dialog", ex); }
 }
Пример #2
0
        public bool AssignDeviceItem(DeviceItem item, int driverID, string installationType, string installationNumber)
        {
            //Assign this device item to the specified driver
            bool result = false;

            try {
                result = executeNonQuery(USP_DEVICE_ASSIGN, new object[] { item.ItemID, driverID, installationType, installationNumber, item.LastUpdated, item.UserID, item.RowVersion });
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while assigning device to driver.", ex))); }
            return(result);
        }
Пример #3
0
        public bool UnassignDeviceItem(DeviceItem item)
        {
            //Unassign this device item from its driver
            bool result = false;

            try {
                result = executeNonQuery(USP_DEVICE_UNASSIGN, new object[] { item.ItemID, item.LastUpdated, item.UserID, item.RowVersion });
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while unassigning device from driver.", ex))); }
            return(result);
        }
Пример #4
0
 //Interface
 public dlgDeviceAssignment(DeviceItem item)
 {
     //Constructor
     try {
         //Required designer support
         InitializeComponent();
         this.Text  = "Assign Device to Driver";
         this.mItem = item;
     }
     catch (Exception ex) { throw new ApplicationException("Failed to create new Device Assignment dialog", ex); }
 }
Пример #5
0
        public static bool UnassignDeviceItem(DeviceItem item)
        {
            bool ret = false;

            try {
                _Client = new MobileDevicesServiceClient();
                ret     = _Client.UnassignDeviceItem(item);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("UnassignFromDriver() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("UnassignFromDriver() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("UnassignFromDriver() communication error.", ce); }
            return(ret);
        }
Пример #6
0
        public static bool AssignDeviceItem(DeviceItem item, int driverID, string installationType, string installationNumber)
        {
            bool ret = false;

            try {
                _Client = new MobileDevicesServiceClient();
                ret     = _Client.AssignDeviceItem(item, driverID, installationType, installationNumber);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("AssignToDriver() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("AssignToDriver() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("AssignToDriver() communication error.", ce); }
            return(ret);
        }
Пример #7
0
        public static DeviceItem GetDeviceItem(string itemID)
        {
            DeviceItem item = null;

            try {
                _Client = new MobileDevicesServiceClient();
                item    = _Client.GetDeviceItem(itemID);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetDeviceItem() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetDeviceItem() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetDeviceItem() communication error.", ce); }
            return(item);
        }
Пример #8
0
        public bool SaveDeviceItem(DeviceItem item)
        {
            //Create/update a mobile device
            bool result = false;

            try {
                if (item.ItemID.Length == 0)
                {
                    executeNonQueryWithReturn(USP_DEVICE_CREATE,
                                              new object[] { "",
                                                             item.TypeID,
                                                             item.TerminalID,
                                                             item.IsActive,
                                                             item.Comments,
                                                             item.LastUpdated,
                                                             item.UserID,
                                                             item.RowVersion,
                                                             null,
                                                             item.DeviceID,
                                                             item.ModelNumber,
                                                             item.FirmWareVersion,
                                                             item.SoftWareVersion,
                                                             item.ServiceExpiration.ToString(),
                                                             item.AccountID, null });
                    result = true;
                }
                else
                {
                    result = executeNonQuery(USP_DEVICE_UPDATE,
                                             new object[] { item.ItemID,
                                                            item.TerminalID,
                                                            item.IsActive,
                                                            item.Comments,
                                                            item.LastUpdated,
                                                            item.UserID,
                                                            item.RowVersion,
                                                            item.PriorItemID,
                                                            item.DeviceID,
                                                            item.ModelNumber,
                                                            item.FirmWareVersion,
                                                            item.SoftWareVersion,
                                                            item.ServiceExpiration.ToString(),
                                                            item.AccountID,
                                                            item.PriorAccountID });
                }
            }
            catch (Exception ex) { throw new FaultException <TerminalsFault>(new TerminalsFault(new ApplicationException("Unexpected error while saving device item.", ex))); }
            return(result);
        }
Пример #9
0
        private void OnPriorComponentTypeChanged(object sender, System.EventArgs e)
        {
            //Event handler for change in prior comonent type
            try {
                //Create filtered subset for the selected component type
                //Add a blank entry since a selection is not required
                //Add the current entry to keep current selection
                this.mPriorDevices.Clear();
                DeviceItem di = new DeviceItem();
                di.DeviceID = "";
                di.ItemID   = "";
                this.mPriorDevices.Add(di);
                if ((this.cboPriorComponentType.SelectedValue.ToString() == this.mItem.TypeID) && this.mItem.PriorItemID != null)
                {
                    di          = new DeviceItem();
                    di.ItemID   = this.mItem.PriorItemID;
                    di.DeviceID = this.mItem.PriorDeviceID;
                    this.mPriorDevices.Add(di);
                }

                string typeID = this.cboPriorComponentType.SelectedValue != null?this.cboPriorComponentType.SelectedValue.ToString() : "";

                DeviceItems priorDeviceItems = MobileDevicesProxy.GetPriorDeviceItems();
                for (int i = 0; i < priorDeviceItems.Count; i++)
                {
                    if (typeID.Length == 0 || priorDeviceItems[i].TypeID == typeID)
                    {
                        this.mPriorDevices.Add(priorDeviceItems[i]);
                    }
                }

                //Sort and select
                this.mPriorDevices.Sort = "DeviceID";
                if (this.mItem.PriorItemID != null)
                {
                    this.cboPriorDeviceID.SelectedValue = this.mItem.PriorItemID;
                }
                else
                {
                    this.cboPriorDeviceID.SelectedIndex = 0;
                }
                this.cboPriorDeviceID.Enabled = (this.mItem.ItemID != "");
            }
            catch (Exception ex) { App.ReportError(ex, false, Argix.Terminals.LogLevel.Warning); }
            finally { this.OnValidateForm(null, null); }
        }