예제 #1
0
        public ScreenSet(int UserId)
        {
            this.UserId = UserId;

            lDataContext = new CommonFunction().JSDataContext();

            this.applyCommand = new DelegateCommand(OnApplyCommandExecuted);

            Boolean isSelected;
            Boolean isDefault;

            IQueryable <DataSource.UserScreen> lUser = lDataContext.UserScreens.Where(p => p.UserId == UserId);

            foreach (DataSource.Screen l in lDataContext.Screens.Where(p => p.ParentId != null && p.Usable == true).OrderBy(p => p.ScreenId))
            {
                isSelected = false;
                isDefault  = false;

                if (lUser.Where(p => p.ScreenId == l.ScreenId).Count() > 0)
                {
                    isSelected = true;
                }

                var lDefault = lUser.SingleOrDefault(p => p.ScreenId == l.ScreenId && p.Default == true);
                if (lDefault != null)
                {
                    isDefault = true;
                }

                this.Add(new JSScreen {
                    UserId = UserId, IsDefault = isDefault, IsSelected = isSelected, ScreenAvailable = l
                });
            }
        }
예제 #2
0
        private void myRadDataForm_DeletingItem(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Window lWindows = Models.CommonFunction.GetApplicationWindow();

            if (MessageBox.Show(lWindows, "Are you sure you want to delete?", "Delete",
                                MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
            {
                e.Cancel = true;
            }
            else
            {
                SunSeven.Models.HSEmployee lItem = myRadDataForm.CurrentItem as SunSeven.Models.HSEmployee;

                DataSource.JSDataContext lDataContext;

                lDataContext = new CommonFunction().JSDataContext();

                try
                {
                    var lDelEmpDept = lDataContext.Emp_Depts.Where(p => p.EmployeeId == lItem.Id);
                    lDataContext.Emp_Depts.DeleteAllOnSubmit(lDelEmpDept);

                    var lDelItem = lDataContext.Employees.Single(p => p.Id == lItem.Id);

                    lDataContext.Employees.DeleteOnSubmit(lDelItem);
                    lDataContext.SubmitChanges();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    e.Cancel = true;
                }
            }
        }
예제 #3
0
 public commandCollection()
 {
     lDataContext         = new CommonFunction().JSDataContext();
     this.deleteCommand   = new DelegateCommand(OnDeleteCommandExecuted);
     this.deletingCommand = new DelegateCommand(OnDeletingCommandExecuted);
     //this.homeCommand = new DelegateCommand(OnHomeCommandExecuted);
 }
예제 #4
0
 public HSOrderHistory()
 {
     lDataContext       = new CommonFunction().JSDataContext();
     this.selectCommand = new DelegateCommand(OnSelectCommandExecuted);
     this.printCommand  = new DelegateCommand(OnPrintCommandExecuted);
     // _salesPerson = new ObservableCollection<DataSource.vEmpDept>();
 }
예제 #5
0
        public Window1()
        {
            InitializeComponent();



            lDataContext = new CommonFunction().JSDataContext();
        }
        public PriceHistoryWindow(int CustomerId, int ProductId, int?Unit)
        {
            InitializeComponent();

            lDataContext = new CommonFunction().JSDataContext();

            try
            {
                this.Header += " (" + lDataContext.Customers.SingleOrDefault(p => p.Id == CustomerId).Name + ")";
                var lProduct = lDataContext.Products.SingleOrDefault(p => p.Id == ProductId);
                this.txtProduct.Text  = lProduct.Name + " (" + lProduct.Description + ")";
                this.txtProduct.Text += "\nUnit : " + lDataContext.SellingUnits.SingleOrDefault(p => p.Id == Unit).Unit;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            var lPriceHist = from o in lDataContext.Orders
                             join i in lDataContext.Invoices
                             on o.InvoiceId equals i.Id
                             join oi in lDataContext.OrderItems
                             on o.Id equals oi.OrderId
                             where o.CustomerId.Equals(CustomerId) && oi.ProductId.Equals(ProductId) && oi.SellingUnitId.Equals(Unit)
                             select new
            {
                o.OrderDate,
                i.DeliveryDate,
                // Product = oi.Product.Name + " (" + oi.Product.Description + ")",
                // oi.SellingUnit.Unit,
                // VAT = oi.VatRate.Name,
                oi.UnitPrice,
                //Price = oi.UnitPrice + (oi.UnitPrice * (oi.VatRate.Rate / 100)),
                oi.Quantity
            };


            gridPriceHistory.ItemsSource = lPriceHist;

            var lSalesHist = from o in lDataContext.Sales
                             join oi in lDataContext.SalesItems
                             on o.Id equals oi.SalesId
                             where o.CustomerId.Equals(CustomerId) && oi.ProductId.Equals(ProductId) && oi.SellingUnitId.Equals(Unit)
                             select new
            {
                o.SalesDate,
                o.ExpireDate,
                //Product = oi.Product.Name + " (" + oi.Product.Description + ")",
                //oi.SellingUnit.Unit,
                // VAT = oi.VatRate.Name,
                oi.UnitPrice,
                // Price = oi.UnitPrice + (oi.UnitPrice * (oi.VatRate.Rate / 100))
            };

            gridSalesHistory.ItemsSource = lSalesHist;
        }
        public vmQuotationHistory()
        {
            lDataContext       = new CommonFunction().JSDataContext();
            this.searchCommand = new DelegateCommand(OnSearchCommandExecuted);
            this.StartDT       = DateTime.Today.AddDays(-1);
            this.EndDT         = DateTime.Today.AddDays(1).AddSeconds(-1);

            this.Type = 0;
        }
        //static public event newOrderHander newOrderCommand;


        public OpenQuotation()
        {
            InitializeComponent();

            lDataContext = new CommonFunction().JSDataContext();

            this.DataContext = lDataContext.Sales;
            textBoxFilterValue.Focus();
            //new vmSalesHistory();
        }
예제 #9
0
        public ScanEditor()
        {
            InitializeComponent();

            lDataContext = new CommonFunction().JSDataContext();

            DataContext = invoiceSet;

            MainPage.scanCommand -= MainPage_scanCommand;
            MainPage.scanCommand += MainPage_scanCommand;

            //this.RadGridView1.MouseDoubleClick += this.OnGridMouseDoubleClick;
        }
예제 #10
0
        public vmQuotationHistory(int?Type)
        {
            lDataContext = new CommonFunction().JSDataContext();

            this.searchCommand = new DelegateCommand(OnSearchCommandExecuted);

            this.StartDT = DateTime.Today.AddDays(-1);
            this.EndDT   = DateTime.Today.AddDays(1).AddSeconds(-1);
            this.Type    = Type;

            this.IsBusy = true;
            LoadingAsyncStart();
        }
예제 #11
0
        public Employee()
        {
            InitializeComponent();

            lDataContext = new CommonFunction().JSDataContext();

            this.DataContext = new vmEmployee();

            if (MainPage.lCurrentUser.UserRole.Name == "Read Only")
            {
                this.myRadDataForm.CommandButtonsVisibility = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.None;
            }
        }
예제 #12
0
        public vmEmployee()
        {
            lDataContext = new CommonFunction().JSDataContext();

            SalesPerson = new ObservableCollection <DataSource.vEmpDept>();
            foreach (DataSource.vEmpDept l in lDataContext.vEmpDepts.Where(p => p.Department == "Sales"))
            {
                SalesPerson.Add(l);
            }

            DeliveryPerson = new ObservableCollection <DataSource.vEmpDept>();

            foreach (DataSource.vEmpDept l in lDataContext.vEmpDepts.Where(p => p.Department == "Delivery"))
            {
                DeliveryPerson.Add(l);
            }
        }
예제 #13
0
        public OpenSupply()
        {
            InitializeComponent();
            lDataContext = new CommonFunction().JSDataContext();

            dtPickerST.SelectedValue = DateTime.Today;
            dtPickerET.SelectedValue = DateTime.Today.AddDays(1).AddSeconds(-1);

            List <DataSource.OpenOrderResult> lOpenOrderSet = new List <DataSource.OpenOrderResult>();

            foreach (DataSource.OpenOrderResult l in lDataContext.OpenOrder(null, null))
            {
                lOpenOrderSet.Add(l);
            }
            this.DataContext = lOpenOrderSet;

            this.textBoxFilterValue.Focus();
        }
예제 #14
0
        public vmOrderHistory(int?Type, DateTime?pST, DateTime?pET)
        {
            lDataContext = new CommonFunction().JSDataContext();

            this.searchCommand = new DelegateCommand(OnSearchCommandExecuted);
            this.updownCommand = new DelegateCommand(OnUpDownCommandExecuted);

            this.StartDT = (pST == null) ? DateTime.Today.AddDays(-1) : pST.Value;
            this.EndDT   = (pET == null) ? DateTime.Today.AddDays(1).AddSeconds(-1) : pET.Value;
            this.Type    = Type;

            if (lStaticOrderHistory == null)
            {
                this.IsBusy         = true;
                lStaticOrderHistory = new ObservableCollection <HSOrderHistory>();

                LoadingAsyncStart();
            }
        }
예제 #15
0
        public vmProduct()
        {
            lDataContext = new CommonFunction().JSDataContext();

            _unitSet = new ObservableCollection <DataSource.SellingUnit>();

            foreach (DataSource.SellingUnit l in lDataContext.SellingUnits)
            {
                _unitSet.Add(new DataSource.SellingUnit {
                    Id = l.Id, Unit = l.Unit
                });
            }

            _vatSet = new ObservableCollection <DataSource.VatRate>();

            foreach (DataSource.VatRate l in lDataContext.VatRates)
            {
                _vatSet.Add(new DataSource.VatRate {
                    Id = l.Id, Name = l.Name
                });
            }

            _rootCategories = new ObservableCollection <DataSource.Category>();

            foreach (DataSource.Category l in lDataContext.Categories.Where(p => p.ParentId == null))
            {
                _rootCategories.Add(new DataSource.Category {
                    Id = l.Id, Name = l.Name, ParentId = l.ParentId
                });
            }

            _categories = new ObservableCollection <DataSource.Category>();

            foreach (DataSource.Category l in lDataContext.Categories.Where(p => p.ParentId != null))
            {
                _categories.Add(new DataSource.Category {
                    Id = l.Id, Name = l.Name, ParentId = l.ParentId
                });
            }
        }
예제 #16
0
        public OpenQuotation(string pType)
        {
            InitializeComponent();

            lDataContext = new CommonFunction().JSDataContext();

            switch (pType)
            {
            case "QUOTATION":
                this.DataContext = lDataContext.Sales.Where(p => p.Master == false);
                this.Header      = "Open Quotation";
                break;

            case "MASTER":
                this.DataContext = lDataContext.Sales.Where(p => p.Master == true);
                this.Header      = "Open Master Quotation";
                break;
            }

            textBoxFilterValue.Focus();
            //new vmSalesHistory();
        }
예제 #17
0
 public vmCustomer()
 {
     lDataContext = new CommonFunction().JSDataContext();
 }
예제 #18
0
 public HSSecurity()
 {
     lDataContext       = new CommonFunction().JSDataContext();
     this.screenCommand = new DelegateCommand(OnScreenCommandExecuted);
     //this.screenCommand.CanExecuteChanged += ScreenCommand_CanExecuteChanged;
 }
예제 #19
0
 public HSSupplyItem()
 {
     lDataContext             = new CommonFunction().JSDataContext();
     this.priceHistoryCommand = new DelegateCommand(OnPriceHisotry);
     //this.deleteCommand = new DelegateCommand(OnDeleteItem);
 }
예제 #20
0
 public vmProductLight()
 {
     lDataContext = new CommonFunction().JSDataContext();
 }
예제 #21
0
 public HSInvoice()
 {
     lDataContext = new CommonFunction().JSDataContext();
 }