Exemple #1
0
        public bool SearchExistingUnit(CellDeviceModel model)
        {
            // 20190604 - Search Epec/Resident for the phone and equipId
            // Fields: e.equip_phone,e.other_phone,r.phone_1,r.phone_2, r.phone_3
            // Fields: e.equip_id
            EpecLocationModel el = null;

            //1. check the unit first
            el = SearchHomeByUnit(model.UNIT_ID);
            if (el != null)
            {
                return(true);
            }

            //2. search epec for phone
            el = SearchHomeByPhone(model.MDN);
            if (el != null)
            {
                return(true);
            }

            //3 Search resident phone fields
            el = SearchResidentByPhone(model.MDN);
            if (el != null)
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        public CellDeviceModel GetCellDeviceByUnitId(string unitId)
        {
            CellDeviceModel model = null;
            StringBuilder   sql   = new StringBuilder();

            sql.AppendFormat("SELECT * FROM CELL_DEVICE_ACTIVE WHERE UNIT_ID = {0}", unitId);

            try
            {
                var data = _provider.GetData(sql.ToString(), null);
                LogInfo(string.Format("Fetching cell device for unit Id {0}. QUERY: {1}", unitId, sql.ToString()));

                if (data != null)
                {
                    var row = data.Rows[0];

                    model = new CellDeviceModel(row);
                    LogInfo(string.Format("Creating cell device model for unit {0}", unitId));
                }
            }
            catch (Exception e)
            {
                LogError(e);
            }

            return(model);
        }
Exemple #3
0
        public List <CellDeviceModel> GetCellDevices()
        {
            List <CellDeviceModel> model = new List <CellDeviceModel>();
            StringBuilder          sql   = new StringBuilder();

            sql.AppendFormat("SELECT * FROM CELL_DEVICE_ACTIVE WHERE TEST = 'True'");

            try
            {
                var data = _provider.GetData(sql.ToString(), null);
                LogInfo(string.Format("Fetching all cell devices. QUERY: {0}", sql.ToString()));

                if (data != null)
                {
                    foreach (DataRow dr in data.Rows)
                    {
                        var item = new CellDeviceModel(dr);
                        model.Add(item);
                    }

                    LogInfo(string.Format("Fetching all cell device models"));
                }
            }
            catch (Exception e)
            {
                LogError(e);
            }

            return(model);
        }
        public frmUpdatePhone(CellDeviceModel model)
        {
            InitializeComponent();

            this.Load       += FrmUpdatePhone_Load;
            btnCancel.Click += BtnCancel_Click;
            btnSave.Click   += BtnSave_Click;

            _selectedDevice = model;
        }
Exemple #5
0
        private void _frmUpdatePhone_OnPhoneNumberUpdated(bool isCompleted, CellDeviceModel model)
        {
            if (isCompleted)
            {
                MessageBox.Show(string.Format("Successfully updated phone number to {0} for unit {1} ", model.MDN, model.UNIT_ID));

                // clear search
                txtUnitId.Clear();
                txtUnitType.Clear();
                txtIMEI.Clear();
                txtSerialNum.Clear();
                txtUnitId.Focus();

                grdSearchResult.DataSource = null;
            }
        }
        void SetUnitTestMode(CellDeviceModel cellDevice)
        {
            if (cellDevice != null)
            {
                //change the unit to the opposite of currnet status
                var mode = TESTMODE.OFF;
                switch (cellDevice.TEST)
                {
                case true:
                    mode = TESTMODE.OFF;
                    break;

                case false:
                    mode = TESTMODE.ON;
                    var isExisting = HomeService.Instance.SearchExistingUnit(cellDevice);
                    if (isExisting)
                    {
                        return;
                    }
                    break;
                }



                bool isSuccess = false;
                switch (cellDevice.OTHER.ToLower())
                {
                case "mytrex lte":
                    isSuccess = SendToMytrex(mode, cellDevice.UNIT_ID.ToString(), cellDevice.SERIALNO);
                    break;

                case "anelto lte":
                case "anelto otg":
                    isSuccess = SendToAnelto(mode, cellDevice.UNIT_ID.ToString());
                    break;

                default:

                    break;
                }

                if (isSuccess)
                {
                    CellDeviceService.Instance.UpdateCellDeviceStatus(cellDevice.ID, mode == TESTMODE.ON ? true : false);
                }
            }
        }
Exemple #7
0
        public bool UpdateDevicePhone(CellDeviceModel model)
        {
            bool   isUdpated = true;
            string sql       = string.Format("UPDATE CELL_DEVICE_ACTIVE SET MDN = '{0}' WHERE ID = {1}", model.MDN, model.ID);

            try
            {
                _provider.ExecuteNonSPQuery(sql.ToString(), null);
                LogInfo(string.Format("Updating cell device {0} phone number to {1}", model.UNIT_ID, model.MDN));
            }
            catch (Exception e)
            {
                LogError(e);
                isUdpated = false;
            }

            return(isUdpated);
        }
Exemple #8
0
        static void Main(string[] args)
        {
            //AneltoAPI api = new AneltoAPI();
            //var table = FileHelper.ReadCSVFileToTable(@"e:\AneltoUpdate.csv",',', true);
            //Parallel.ForEach(table.AsEnumerable(), row =>
            //{
            //    var model = new AneltoSubscriberUpdateRequest();
            //    model.ani = row[0].ToString();
            //    model.account = row[1].ToString();

            //    var response = api.SubscriberCreateUpdate(model);
            //    Console.WriteLine(response);

            //});

            var cellDevice = new CellDeviceModel();

            //cellDevice.UNIT_ID = 820001;
            cellDevice.MDN = "4172313490";

            var isExisting = HomeService.Instance.SearchExistingUnit(cellDevice);

            Console.WriteLine(isExisting.ToString());
        }