Ejemplo n.º 1
0
        public void AddDetail(string selectedDetail, int quantity, Material material)
        {
            int detailLength = 0, detailWidth = 0;

            if (selectedDetail == "Pregrada")
            {
                detailLength = Height - LegHeight;
                detailWidth  = Depth;
            }
            else if (selectedDetail == "Polica")
            {
                detailLength = Width;
                detailWidth  = Depth;
            }
            else if (selectedDetail == "Vrata")
            {
                detailLength = Height - LegHeight;
                detailWidth  = Width / quantity;
            }
            else if (selectedDetail == "Sokla")
            {
                detailLength = Width;
                detailWidth  = LegHeight;
            }
            else if (selectedDetail == "Top")
            {
                detailLength = Width;
                detailWidth  = Depth + 20;
            }
            else if (selectedDetail == "Stranica")
            {
                detailLength = Height;
                detailWidth  = Depth;
            }


            Detail detail = new Detail()
            {
                DetailName = selectedDetail,
                Length     = detailLength,
                Width      = detailWidth,
                Material   = material,
                Quantity   = quantity,
            };

            if (DetailList.Contains(detail))
            {
                foreach (var item in DetailList)
                {
                    if (detail.DetailName == item.DetailName)
                    {
                        item.Quantity += detail.Quantity;
                    }
                }
            }
            else
            {
                DetailList.Add(detail);
            }
        }
Ejemplo n.º 2
0
 public void PopulateList()
 {
     try
     {
         DetailList.Clear();
         foreach (var p in _dbservicewms.GetTUSKUIDs(TUID))
         {
             DetailList.Add(new TUSKUIDViewModel
             {
                 BoxID       = p.BoxID,
                 SKUID       = p.SKUID,
                 Qty         = p.Qty,
                 Batch       = p.Batch,
                 ProdDate    = p.ProdDate,
                 ExpDate     = p.ExpDate,
                 Description = p.Description
             });
         }
         foreach (var l in DetailList)
         {
             l.Initialize(_warehouse);
         }
     }
     catch (Exception e)
     {
         _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, e.Message);
         throw new Exception(string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message));
     }
 }
Ejemplo n.º 3
0
        public CheckListTransactionViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList              = new ObservableCollection <GenericViewModel>();
                SelectedMainRow          = new GenericViewModel();
                SelectedDetailRow        = new TblCheckTransactionViewModel();
                DetailListCollectionView = new PagedCollectionView(DetailList);
                DetailListCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("CheckListGroupPerRow.Ename"));
                DetailListCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("CheckListDesignGroupHeader1PerRow.Ename"));
                Client.GetTblCheckListLinkCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCheckTransactionViewModel
                        {
                            Aname            = row.TblCheckListItem1.Aname,
                            Ename            = row.TblCheckListItem1.Ename,
                            Iserial          = row.Iserial,
                            Code             = row.TblCheckListItem1.Code,
                            TblCheckListItem = row.Iserial,
                            TransDate        = DateTime.Now,
                            TblAuthUser      = LoggedUserInfo.Iserial,
                            TblCheckListDesignGroupHeader1 = row.TblCheckListDesignGroupHeader1,
                            TblCheckListDesignGroupHeader2 = row.TblCheckListDesignGroupHeader2,
                            CheckListGroupPerRow           = row.TblCheckListGroup1,
                        };

                        if (row.TblCheckListDesignGroupHeader11 != null)
                        {
                            newrow.CheckListDesignGroupHeader1PerRow.InjectFrom(row.TblCheckListDesignGroupHeader11);
                        }

                        if (row.TblCheckListDesignGroupHeader21 != null)
                        {
                            newrow.CheckListDesignGroupHeader2PerRow.InjectFrom(row.TblCheckListDesignGroupHeader21);
                        }

                        if (LoggedUserInfo.Store != null)
                        {
                            newrow.Store = LoggedUserInfo.Store.code;
                        }
                        if (LoggedUserInfo.Company != null)
                        {
                            newrow.Company = LoggedUserInfo.Company.Code;
                        }
                        DetailList.Add(newrow);
                    }
                    Client.GetTblCheckListTransactionAsync(LoggedUserInfo.Iserial);
                };

                Client.GetTblUserCheckListAsync(LoggedUserInfo.Iserial);
                Client.GetTblUserCheckListCompleted += (s, sv) =>
                {
                    foreach (var variable in sv.Result)
                    {
                        Client.GetTblCheckListLinkAsync(variable.TblCheckListGroup);
                    }
                };

                Client.GetTblCheckListTransactionCompleted += (s, sv) =>
                {
                    foreach (var row in DetailList)
                    {
                        row.UpdatedAllowed = false;
                        row.Checked        = false;
                        row.Notes          = null;
                        row.Approved       = false;
                    }
                    foreach (var row in sv.Result)
                    {
                        var subCheckListRow = DetailList.SingleOrDefault(x =>
                                                                         x.TblCheckListItem == row.TblCheckListItem);
                        if (subCheckListRow != null)
                        {
                            subCheckListRow.Checked = true;
                            subCheckListRow.Notes   = row.Notes;
                            subCheckListRow.Yes     = row.Yes;
                            subCheckListRow.No      = row.No;
                        }
                    }
                };
            }
        }
Ejemplo n.º 4
0
 public void AddToDetailList(InvoiceDetail invoiceDetail)
 {
     DetailList.Add(invoiceDetail);
 }
Ejemplo n.º 5
0
        public CheckListLinkViewModel()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                MainRowList       = new ObservableCollection <GenericViewModel>();
                SelectedMainRow   = new GenericViewModel();
                SelectedDetailRow = new TblCheckListLinkViewModel();

                Client.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericViewModel
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code
                        };
                        MainRowList.Add(newrow);
                    }
                };
                Client.GetGenericAsync("TblCheckListGroup", "%%", "%%", "%%", "Iserial", "ASC");

                var detailservice = new CRUD_ManagerServiceClient();

                detailservice.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new TblCheckListLinkViewModel
                        {
                            Aname            = row.Aname,
                            Ename            = row.Ename,
                            Iserial          = row.Iserial,
                            Code             = row.Code,
                            TblCheckListItem = row.Iserial
                        };
                        DetailList.Add(newrow);
                    }
                };
                detailservice.GetGenericAsync("TblCheckListItem", "%%", "%%", "%%", "Iserial", "ASC");

                var header1Service = new CRUD_ManagerServiceClient();

                header1Service.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericTable
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code,
                        };
                        CheckListDesignGroupHeader1List.Add(newrow);
                    }
                };
                header1Service.GetGenericAsync("TblCheckListDesignGroupHeader1", "%%", "%%", "%%", "Iserial", "ASC");
                var header2 = new CRUD_ManagerServiceClient();
                header2.GetGenericCompleted += (s, sv) =>
                {
                    foreach (var row in sv.Result)
                    {
                        var newrow = new GenericTable
                        {
                            Aname   = row.Aname,
                            Ename   = row.Ename,
                            Iserial = row.Iserial,
                            Code    = row.Code,
                        };
                        CheckListDesignGroupHeader2List.Add(newrow);
                    }
                };
                header2.GetGenericAsync("TblCheckListDesignGroupHeader2", "%%", "%%", "%%", "Iserial", "ASC");

                Client.GetTblCheckListLinkCompleted += (s, sv) =>
                {
                    foreach (var row in DetailList)
                    {
                        row.UpdatedAllowed = false;
                        row.Checked        = false;
                        row.CheckListDesignGroupHeader1PerRow = null;
                        row.CheckListDesignGroupHeader2PerRow = null;
                        row.TblCheckListDesignGroupHeader1    = null;
                        row.TblCheckListDesignGroupHeader2    = null;
                    }
                    foreach (var row in sv.Result)
                    {
                        var subCheckListRow = DetailList.SingleOrDefault(x =>
                                                                         x.Iserial == row.TblCheckListItem);
                        if (subCheckListRow != null)
                        {
                            subCheckListRow.Checked = true;
                            if (row.TblCheckListDesignGroupHeader11 != null)
                            {
                                subCheckListRow.CheckListDesignGroupHeader1PerRow.InjectFrom(row.TblCheckListDesignGroupHeader11);
                            }

                            if (row.TblCheckListDesignGroupHeader21 != null)
                            {
                                subCheckListRow.CheckListDesignGroupHeader2PerRow.InjectFrom(row.TblCheckListDesignGroupHeader21);
                            }
                        }
                    }
                };
            }
        }