public PartEditExtdDescPage(App_WorkTicket workTicket, App_RepairPart part, PartsEditPage.PageMode pageMode,
                                    App_ScheduledAppointment scheduledAppointment)
        {
            _workTicket           = workTicket;
            _part                 = part;
            _pageMode             = pageMode;
            _scheduledAppointment = scheduledAppointment;

            _vm = new PartsEditExtdDescPageViewModel(part, workTicket);

            InitializeComponent();
            labelTitle.FontFamily  = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
            labelItemCode.Text     = _part.PartItemCode;
            labelItemCodeDesc.Text = _part.PartItemCodeDescription;
            if (_part.ItemCodeDesc != null || _part.ItemCodeDesc.Trim().Length == 0)
            {
                CI_Item itm = App.Database.GetItemFromDB(_part.PartItemCode);
                if (itm.ExtendedDescriptionKey != null && itm.ExtendedDescriptionKey > 0)
                {
                    CI_ExtendedDescription itmExtdDsc = App.Database.GetExtendedDescription(itm.ExtendedDescriptionKey);
                }
            }
            else
            {
                entryExtdDesc.Text = _part.PartItemCodeDescription;
            }
        }
        // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END

        public PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit)
        {
            _workTicket = workTicket;
            //_partToEdit = partToEdit;

            //_warehouseList = GetTechnicianWarehouses();
            _warehouseList = new List <string>();
            List <IM_Warehouse> lsItmWhse = GetWarehouses();

            foreach (IM_Warehouse itemWhse in lsItmWhse)
            {
                _warehouseList.Add(string.Format("{0} - {1}", itemWhse.WarehouseCode, itemWhse.WarehouseDesc));
            }

            // dch rkl 01/23/2017 added Unit of Measure List
            _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB();
            _unitOfMeasureList.Add(new CI_UnitOfMeasure()
            {
                UnitOfMeasure = "EACH"
            });
            _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure));

            // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText BEGIN
            _extendedDescriptionKey  = partToEdit.ExtendedDescriptionKey;
            _extendedDescriptionText = "";
            if (partToEdit.ExtendedDescriptionKey > 0)
            {
                CI_ExtendedDescription extdDesc = App.Database.GetExtendedDescription(partToEdit.ExtendedDescriptionKey);
                if (extdDesc.ExtendedDescriptionText != null)
                {
                    _extendedDescriptionText = extdDesc.ExtendedDescriptionText;
                }
            }
            // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END
        }
Beispiel #3
0
        // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END

        #endregion

        public PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit)
        {
            // dch rkl 12/07/2016 catch exception
            try
            {
                _workTicket = workTicket;

                // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse BEGIN
                //_warehouseList = new List<string>();
                //List<IM_ItemWarehouse> lsItmWhse = GetItemWarehouses(partToEdit.ItemCode);
                //foreach (IM_ItemWarehouse itemWhse in lsItmWhse)
                //{
                //    _warehouseList.Add(itemWhse.WarehouseCode);
                //}
                _warehouseList = GetWarehouses();
                foreach (IM_Warehouse whs in _warehouseList)
                {
                    whs.WarehouseDesc = string.Format("{0} - {1}", whs.WarehouseCode, whs.WarehouseDesc);
                }
                // dch rkl 12/01/2016 Get Warehouse List from IM_Warehouse instead of IM_ItemWarehouse END

                // dch rkl 01/23/2017 added Unit of Measure List
                _unitOfMeasureList = App.Database.GetCI_UnitOfMeasureFromDB();
                _unitOfMeasureList.Add(new CI_UnitOfMeasure()
                {
                    UnitOfMeasure = "EACH"
                });
                _unitOfMeasureList.Sort((x, y) => x.UnitOfMeasure.CompareTo(y.UnitOfMeasure));

                // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText BEGIN
                _extendedDescriptionKey  = partToEdit.ExtendedDescriptionKey;
                _extendedDescriptionText = "";
                if (partToEdit.ExtendedDescriptionKey > 0)
                {
                    CI_ExtendedDescription extdDesc = App.Database.GetExtendedDescription(partToEdit.ExtendedDescriptionKey);
                    if (extdDesc.ExtendedDescriptionText != null)
                    {
                        _extendedDescriptionText = extdDesc.ExtendedDescriptionText;
                    }
                }
                // DCH 01/13/2017 Add the ExtendedDescriptionKey and ExtendedDescriptionText END
            }
            catch (Exception ex)
            {
                // dch rkl 12/07/2016 Log Error
                ErrorReporting errorReporting = new ErrorReporting();
                errorReporting.sendException(ex, "TechDashboard.PartsEditPageViewModel(App_WorkTicket workTicket, CI_Item partToEdit");
            }
        }
 protected void SetPageLayout()
 {
     labelItemCode.Content     = _part.PartItemCode;
     labelItemCodeDesc.Content = _part.PartItemCodeDescription;
     if (_part.ItemCodeDesc != null || _part.ItemCodeDesc.Trim().Length == 0)
     {
         CI_Item itm = App.Database.GetItemFromDB(_part.PartItemCode);
         if (itm.ExtendedDescriptionKey != null && itm.ExtendedDescriptionKey > 0)
         {
             CI_ExtendedDescription itmExtdDsc = App.Database.GetExtendedDescription(itm.ExtendedDescriptionKey);
         }
     }
     else
     {
         entryExtdDesc.Text = _part.PartItemCodeDescription;
     }
 }