Пример #1
0
        private Collection <SalesItemViewModel> GetDummyRecords(SalesOrderViewModel order)
        {
            var items = new Collection <SalesItemViewModel>();
            int n     = _Model.MaxPreview == 0 ? 5 : _Model.MaxPreview;

            for (int i = 0; i < n; i++)
            {
                Thread.Sleep(10);
                var item = new SalesItemViewModel(
                    order,
                    60932,
                    string.Format("AS100{0:000}", i + 1),
                    67661,
                    "Y",
                    5,
                    (i + 1),
                    "Ea",
                    "USD",
                    100003628
                    );
                item.SerialNumber = "EM1234567";
                items.Add(item);
            }
            order._LoadedAll = true;
            order.RefreshStatus();
            return(items);
        }
Пример #2
0
        internal Collection <SalesItemViewModel> LoadParent(SalesOrderViewModel orderVM)
        {
            Collection <SalesItemViewModel> items = new Collection <SalesItemViewModel>();

            Order order = Order.GetOrderDetails(orderVM.HeaderId, _Model.RntIncidentId, _Model.RntContactId);

            foreach (var item in order.Items)
            {
                var itemVM = new SalesItemViewModel(
                    orderVM,
                    _Model.EbsSrId,
                    "",
                    (decimal)item.INVENTORY_ITEM_ID,
                    "Y",
                    5,
                    (decimal)item.ORDERED_QUANTITY,
                    "Ea",
                    "USD",
                    _Model.EbsOwnerId
                    );
                itemVM.UnitSellingPrice = item.UNIT_SELLING_PRICE;
                itemVM.ItemName         = item.INVENTORY_ITEM;
                itemVM.LineID           = (int)item.LINE_ID;
                itemVM.SerialNumber     = "EM1234567";
                items.Add(itemVM);
            }
            orderVM._LoadedAll = true;
            orderVM.RefreshStatus();
            return(items);
        }
Пример #3
0
        internal Collection <SalesItemViewModel> GetAvailableItems(int limit = 0, SalesOrderViewModel parent = null)
        {
            var    items = new Collection <SalesItemViewModel>();
            String query = @"SELECT sp.PartNumber, sp.Name , sp.Schedules.SalesProductScheduleList.Price.Value 
                FROM SalesProduct sp 
                WHERE sp.Folder.Name = 'EBS Products' 
                AND sp.Schedules.SalesProductScheduleList.Price.Currency.Name = 'USD' 
                AND sp.Schedules.SalesProductScheduleList.Price.Value > 0 
                LIMIT 1000";

            String[] rows = null;
            string   row  = null;

            try
            {
                rows = workspaceAddIn._rnSrv.queryData(query);
            }
            catch (Exception e)
            {
                string logMessage = "Error in getting products from CWSS. Error query: " + query;
                ErrorLog(logMessage, e.Message);
            }
            try
            {
                foreach (string r in rows)
                {
                    row = r;
                    string[] s    = r.Split(',');
                    int      id   = Convert.ToInt32(s[0]);
                    string   name = s[1];
                    decimal  usp  = Math.Round(Convert.ToDecimal(s[2]), 2);
                    var      item = new SalesItemViewModel(
                        parent,
                        _Model.EbsSrId,
                        name,
                        id,
                        "Y",
                        0,
                        1,
                        "Ea",
                        "USD",
                        _Model.EbsOwnerId
                        );
                    item.UnitSellingPrice = usp;
                    item.SerialNumber     = "EM1234567";
                    items.Add(item);
                }
            }
            catch (Exception e)
            {
                string logMessage = "Bad data returned by products query. Data: " + row;
                NoticeLog(logMessage, e.Message);
            }
            return(items);
        }
 private void add_Click(object sender, RoutedEventArgs e)
 {
     var selected = _Model.CurrentParent.SelectedItem;
     if (null == selected) return;
     var item = new SalesItemViewModel(selected);
     if (IsValid())
     {
         _Model.CurrentParent.Items.Add(item);
         selected.Quantity = 1;
     }
 }
Пример #5
0
 public SalesItemViewModel(SalesItemViewModel selected)
 {
     _File                = selected._File;
     _serviceRequestId    = selected._serviceRequestId;
     ItemName             = selected.ItemName;
     InventoryItemId      = selected.InventoryItemId;
     ApprovalRequiredFlag = selected.ApprovalRequiredFlag;
     _UnitSellingPrice    = selected._UnitSellingPrice;
     _Quantity            = selected._Quantity;
     UnitOfMeasure        = selected.UnitOfMeasure;
     Currency             = selected.Currency;
     ResourceId           = selected.ResourceId;
     _Status              = selected._Status;
 }
Пример #6
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            var selected = _Model.CurrentParent.SelectedItem;

            if (null == selected)
            {
                return;
            }
            var item = new SalesItemViewModel(selected);

            if (IsValid())
            {
                _Model.CurrentParent.Items.Add(item);
                selected.Quantity = 1;
            }
        }
Пример #7
0
 internal bool Import(SalesItemViewModel repairOrder)
 {
     return(true);
 }
 public SalesItemViewModel(SalesItemViewModel selected)
 {
     _File = selected._File;
     _serviceRequestId = selected._serviceRequestId;
     ItemName = selected.ItemName;
     InventoryItemId = selected.InventoryItemId;
     ApprovalRequiredFlag = selected.ApprovalRequiredFlag;
     _UnitSellingPrice = selected._UnitSellingPrice;
     _Quantity = selected._Quantity;
     UnitOfMeasure = selected.UnitOfMeasure;
     Currency = selected.Currency;
     ResourceId = selected.ResourceId;
     _Status = selected._Status;
 }
Пример #9
0
 internal Collection<SalesItemViewModel> GetAvailableItems(int limit = 0, SalesOrderViewModel parent = null)
 {
     var items = new Collection<SalesItemViewModel>();
     String query = @"SELECT sp.PartNumber, sp.Name , sp.Schedules.SalesProductScheduleList.Price.Value 
         FROM SalesProduct sp 
         WHERE sp.Folder.Name = 'EBS Products' 
         AND sp.Schedules.SalesProductScheduleList.Price.Currency.Name = 'USD' 
         AND sp.Schedules.SalesProductScheduleList.Price.Value > 0 
         LIMIT 1000";
     String[] rows = null;
     string row = null;
     try
     {
         rows = workspaceAddIn._rnSrv.queryData(query);
     }
     catch (Exception e)
     {
         string logMessage = "Error in getting products from CWSS. Error query: " + query;
         ErrorLog(logMessage, e.Message);                
     }
     try
     {
         foreach (string r in rows)
         {
             row = r;
             string[] s = r.Split(',');
             int id = Convert.ToInt32(s[0]);
             string name = s[1];
             decimal usp = Math.Round(Convert.ToDecimal(s[2]), 2);
             var item = new SalesItemViewModel(
                     parent,
                     _Model.EbsSrId,
                     name,
                     id,
                     "Y",
                     0,
                     1,
                     "Ea",
                     "USD",
                     _Model.EbsOwnerId
                 );
             item.UnitSellingPrice = usp;
             item.SerialNumber = "EM1234567";
             items.Add(item);
         }
     }
     catch (Exception e)
     {
         string logMessage = "Bad data returned by products query. Data: " + row;
         NoticeLog(logMessage, e.Message);
     }
     return items;
 }
Пример #10
0
 private Collection<SalesItemViewModel> GetDummyRecords(SalesOrderViewModel order)
 {
     var items = new Collection<SalesItemViewModel>();
     int n = _Model.MaxPreview == 0 ? 5 : _Model.MaxPreview;
     for (int i = 0; i < n; i++)
     {
         Thread.Sleep(10);
         var item = new SalesItemViewModel(
                 order,
                 60932,
                 string.Format("AS100{0:000}", i + 1),
                 67661,
                 "Y",
                 5,
                 (i + 1),
                 "Ea",
                 "USD",
                 100003628
             );
         item.SerialNumber = "EM1234567";
         items.Add(item);
     }
     order._LoadedAll = true;
     order.RefreshStatus();
     return items;
 }
Пример #11
0
 internal bool Import(SalesItemViewModel repairOrder)
 {
     return true;
 }
Пример #12
0
        internal Collection<SalesItemViewModel> LoadParent(SalesOrderViewModel orderVM)
        {
            Collection<SalesItemViewModel> items = new Collection<SalesItemViewModel>();

            Order order = Order.GetOrderDetails(orderVM.HeaderId, _Model.RntIncidentId, _Model.RntContactId);
            foreach (var item in order.Items)
            {
                var itemVM = new SalesItemViewModel(
                        orderVM,
                        _Model.EbsSrId,
                        "",
                        (decimal) item.INVENTORY_ITEM_ID,
                        "Y",
                        5,
                        (decimal) item.ORDERED_QUANTITY,
                        "Ea",
                        "USD",
                        _Model.EbsOwnerId
                    );
                itemVM.UnitSellingPrice = item.UNIT_SELLING_PRICE;
                itemVM.ItemName = item.INVENTORY_ITEM;
                itemVM.LineID = (int) item.LINE_ID;
                itemVM.SerialNumber = "EM1234567";
                items.Add(itemVM);
            }
            orderVM._LoadedAll = true;
            orderVM.RefreshStatus();
            return items;
        }