public ProductsComponents(FrContext Db, Product product)
 {
     InitializeComponent();
     DB = Db;
     Product = product;
     InitializeLookups();
 }
Example #2
0
 public Categories(CategoryTypes type)
 {
     InitializeComponent();
     DB = new FrContext();
     Type = type;
     FillLB();
 }
Example #3
0
        public Users()
        {
            InitializeComponent();

            DB = new FrContext();

            Group_CB.ItemsSource = Enum.GetValues(typeof(Groups));

            FillLB();
        }
Example #4
0
        public static string GetNumber(DateTime date, TransactionTypes Type)
        {
            FrContext DB = new FrContext();

            if (Type == TransactionTypes.In || Type == TransactionTypes.Out)
            {
                var num = DB.Transfers.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && p.Type == Type);
                return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM"));
            }
            else if (Type == TransactionTypes.Buy || Type == TransactionTypes.ReBuy)
            {
                var num = DB.Transactions.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && (p.Type ==  TransactionTypes.Buy || p.Type ==  TransactionTypes.ReBuy));
                return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM"));
            }
            else
            {
                var num = DB.Transactions.Where(p => p.Date.Year == date.Year && p.Date.Month == date.Month && (p.Type != TransactionTypes.Buy && p.Type != TransactionTypes.ReBuy));
                return num.Count() != 0 ? (num.Max(p => p.Number) + 1).ToString() : string.Format("{0}001", date.ToString("yyMM"));
            }
        }
 public OutcomeTypes()
 {
     InitializeComponent();
     DB = new FrContext();
     FillLB();
 }
Example #6
0
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                var Types = DB.OutcomeTypes.OrderBy(c => c.Name).ToList();
                Types.Insert(0, new OutcomeType() { Id = 0, Name = "الكل" });
                OutcomeTypeSearch.ItemsSource = Types;
                Type.ItemsSource = DB.OutcomeTypes.OrderBy(c => c.Name).ToList();
                FillDG();
            }
            catch
            {

            }
        }
Example #7
0
 public Login()
 {
     InitializeComponent();
     DB = new FrContext();
     var user = DB.Users.AsQueryable().ToList();
 }
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                PersonCB.ItemsSource = DB.People.Where(p => p.Type == Type).OrderBy(p => p.Name).ToList();
                FillDG();
            }
            catch
            {

            }
        }
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                //components
                Component.ItemsSource = DB.Components.OrderBy(c => c.Name).ToList();
                var components = DB.Components.OrderBy(c => c.Name).ToList();
                components.Insert(0, new Component() { Id = 0, Name = "الكل" });
                ComponentSearch.ItemsSource = components;
                //Types
                var categories = DB.Categories.Where(c => c.Type == CategoryTypes.Compontent).OrderBy(c => c.Name).ToList();
                categories.Insert(0, new Category() { Id = 0, Name = "الكل" });
                Category.ItemsSource = categories;
                CategorySearch.ItemsSource = categories;

                FillDG();
            }
            catch
            {

            }
        }
Example #10
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                DB = new FrContext();
                FillLB();
                InitializeLookups();
            }
            catch
            {

            }
        }
Example #11
0
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                ComponentCB.ItemsSource = DB.Components.OrderBy(c => c.Name).ToList();
                UnitCB.ItemsSource = Enum.GetValues(typeof(Units));
                FillLB();
            }
            catch
            {

            }
        }
Example #12
0
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                ComponentCB.ItemsSource = DB.Components.OrderBy(c => c.Name).ToList();
                PersonCB.ItemsSource = DB.People.Where(p => p.Type == PersonTypes.Supplier).OrderBy(c => c.Name).ToList();
                var suppliers = DB.People.Where(p => p.Type == PersonTypes.Supplier).OrderBy(c => c.Name).ToList();
                suppliers.Insert(0, new Person() { Id = 0, Name = "الكل" });
                PersonSearch.ItemsSource = suppliers;
                UnitCB.ItemsSource = Enum.GetValues(typeof(Units));
                FillLB();
            }
            catch
            {

            }
        }
Example #13
0
        private void Initialize()
        {
            try
            {
                DB = new FrContext();
                ProductCB.ItemsSource = DB.Products.OrderBy(p => p.Name).ToList();
                PersonLB.ItemsSource = DB.People.Where(p => p.Type == PersonTypes.Customer).OrderBy(p => p.Name).ToList();
                TypeCB.ItemsSource = new[] { TransactionTypes.InHouse, TransactionTypes.Order, TransactionTypes.TakeAway, TransactionTypes.SellBack };
                TypeSearchCB.ItemsSource = new object[] { "الكل", TransactionTypes.InHouse, TransactionTypes.Order, TransactionTypes.TakeAway, TransactionTypes.SellBack };
                TypeCB.SelectedIndex = 1;
                var customers = DB.People.Where(p => p.Type == PersonTypes.Customer).OrderBy(p => p.Name).ToList();
                customers.Insert(0, new Person() { Id = 0, Name = "الكل" });
                PersonSearch.ItemsSource = customers;
                var categories = DB.Categories.Where(c => c.Type == CategoryTypes.Product).OrderBy(p => p.Name).ToList();
                categories.Insert(0, new Category() { Id = 0, Name = "الكل" });
                CategoryCB.ItemsSource = categories;
                CategoryCB.SelectedIndex = 0;
                FillLB();
            }
            catch
            {

            }
        }
Example #14
0
 public AddCustomer(FrContext Db, string phone)
 {
     InitializeComponent();
     this.DataContext = new Person() { Type= PersonTypes.Customer, Balance=0, Phone = phone };
     this.DB = Db;
 }
Example #15
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                DB = new FrContext();
                FillLB();
                GetAccounts();
            }
            catch
            {

            }
        }
Example #16
0
 public Income()
 {
     InitializeComponent();
     DB = new FrContext();
     FillDG();
 }