Ejemplo n.º 1
0
 void RefreshData()
 {
     UserSource.DataSource      = BusinessAccessLayer.GetEntity().User_tbl;
     DBSource.DataSource        = BusinessAccessLayer.GetEntity().DB_tbl;
     SubPrivSource.DataSource   = BusinessAccessLayer.GetEntity().Sub_Priv_tbl;
     PrivelegeSource.DataSource = BusinessAccessLayer.GetEntity().Privilege_tbl;
 }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var checkAdd    = checkBox1.Checked;
            var checkedit   = checkBox2.Checked;
            var checkDelete = checkBox3.Checked;
            var checkView   = checkBox4.Checked;
            var selectDB    = int.Parse(comboBox1.SelectedValue.ToString());

            AsyncHelper.TaskAwaiter(() =>
            {
                var user = (User_tbl)UserSource.Current;

                var priv = user.Privilege_tbl.Where(x => x.DbID == selectDB);
                if (priv.Count() <= 0)
                {
                    var subpriv = new Sub_Priv_tbl
                    {
                        Add    = checkAdd,
                        Edit   = checkedit,
                        Delete = checkDelete,
                        View   = checkView
                    };

                    var privNew          = new Privilege_tbl();
                    privNew.DbID         = selectDB;
                    privNew.Sub_Priv_tbl = subpriv;

                    user.Privilege_tbl.Add(privNew);
                }

                BusinessAccessLayer.GetEntity().SaveChanges();
                return(true);
            });
        }
Ejemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     BusinessAccessLayer.GetEntity().SaveChanges();
     modRefreshData("");
     Close();
     Dispose();
 }
        private void button3_Click(object sender, EventArgs e)
        {
            if (txtGrandtotal.Text.Trim() == "")
            {
                return;
            }

            var result = MessageBox.Show(
                "You must save the transaction before you cant generate Invoice\nDo you want to save transaction?",
                "Saving transaction", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                _order.CustomerID      = int.Parse(cmbBillto.SelectedValue.ToString() ?? "0");
                _order.IsPaid          = false;
                _order.OrderDate       = DateTime.Now;
                _order.BillingDate     = dtpTransDate.Value.AddDays(30);
                _order.DeliveryAddress = txtAddress.Text;
                _order.DeliveryDate    = dtpTransDate.Value;
                _order.Term            = 30;

                foreach (var orderDetail in OrderDetailSource.OfType <Order_Detail>())
                {
                    _order.Order_Details.Add(orderDetail);
                }

                BusinessAccessLayer.GetEntity().Orders.AddObject(_order);
                BusinessAccessLayer.GetEntity().SaveChanges();

                GenerateInvoice();

                Close();
            }
        }
        public void RefreshData(string msg)
        {
            var entity = BusinessAccessLayer.GetEntity();

            entity.CreateDatabaseScript();
            SupplierSource.DataSource = entity.Suppliers;
        }
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                var products = BusinessAccessLayer.GetEntity().Products.Where(x => x.ProductName.Contains(textBox1.Text.Trim()));

                if (products.Count() <= 0)
                {
                    MessageBox.Show("Product Barcode not available", "invalid", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    return;
                }
                _orderDetails           = new Order_Detail();
                _orderDetails.Quantity  = 1;
                _orderDetails.UnitPrice = products.First().UnitPrice;
                _orderDetails.ProductID = products.First().ProductID;
                _orderDetails.IsVoid    = false;
                _orderDetails.IsReturn  = false;

                OrderDetailSource.Add(_orderDetails);

                CalculateSumAmount();
                textBox11.Clear();
                textBox11.Focus();
            }
        }
 public frmTransactionBilling()
 {
     InitializeComponent();
     _order = new Order();
     OrderSource.DataSource    = BusinessAccessLayer.GetEntity().Orders;
     CustomerSource.DataSource = BusinessAccessLayer.GetEntity().Customers;
     ProductSource.DataSource  = BusinessAccessLayer.GetEntity().Products;
 }
        public frmTransactionDelivery()
        {
            InitializeComponent();
            _order = new Order();
            OrderSource.DataSource    = BusinessAccessLayer.GetEntity().Orders;
            CustomerSource.DataSource = BusinessAccessLayer.GetEntity().Customers;
            ProductSource.DataSource  = BusinessAccessLayer.GetEntity().Products;

            textBox11.Focus();
        }
        private frmCustomerDataEntry(int id = 0)
        {
            InitializeComponent();

            if (id <= 0)
            {
                CustomerSource.DataSource = BusinessAccessLayer.GetEntity().Products;
            }
            else
            {
                CustomerSource.DataSource = BusinessAccessLayer.GetEntity().Customers.Where(e => e.ID == id);
            }
        }
Ejemplo n.º 10
0
        private frmProductDataEntry(int id = 0)
        {
            InitializeComponent();

            bindingSupplier.DataSource = BusinessAccessLayer.GetEntity().Suppliers;
            if (id <= 0)
            {
                bindingProduct.DataSource = BusinessAccessLayer.GetEntity().Products;
            }
            else
            {
                bindingProduct.DataSource = BusinessAccessLayer.GetEntity().Products.Where(e => e.ProductID == id);
            }
        }
        private frmSupplierDataEntry(int id = 0)
        {
            InitializeComponent();


            if (id <= 0)
            {
                SupplierSource.DataSource = BusinessAccessLayer.GetEntity().Suppliers;
            }
            else
            {
                SupplierSource.DataSource = BusinessAccessLayer.GetEntity().Suppliers.Where(e => e.SupplierID == id);
            }
        }
Ejemplo n.º 12
0
        private void OnChangeDataSelect()
        {
            var user  = (User_tbl)UserSource.Current;
            var Dbtbl = (DB_tbl)DBSource.Current;

            var checkAdd    = checkBox1.Checked;
            var checkedit   = checkBox2.Checked;
            var checkDelete = checkBox3.Checked;
            var checkView   = checkBox4.Checked;
            var selectDB    = int.Parse(comboBox1.SelectedValue.ToString());

            var dataAwaiter = AsyncHelper.TaskAwaiter(() =>
            {
                var privList =
                    BusinessAccessLayer.GetEntity().Privilege_tbl.Where(x => x.UserID == user.ID && x.DbID == Dbtbl.ID);


                if (privList.Count() <= 0)
                {
                    var subpriv = new Sub_Priv_tbl
                    {
                        Add    = checkAdd,
                        Edit   = checkedit,
                        Delete = checkDelete,
                        View   = checkView
                    };

                    var privNew          = new Privilege_tbl();
                    privNew.DbID         = selectDB;
                    privNew.Sub_Priv_tbl = subpriv;

                    user.Privilege_tbl.Add(privNew);
                    BusinessAccessLayer.GetEntity().SaveChanges();

                    privList =
                        BusinessAccessLayer.GetEntity().Privilege_tbl.Where(x => x.UserID == user.ID && x.DbID == Dbtbl.ID);
                }
                return(privList);
            });

            dataAwaiter.OnCompleted(() =>
            {
                var privList = dataAwaiter.GetResult();
                if (privList.Count() > 0)
                {
                    SubPrivSource.DataSource = privList.First().Sub_Priv_tbl;
                }
            });
        }
Ejemplo n.º 13
0
        public frmRemittance(int id = 0)
        {
            InitializeComponent();

            UserSource.DataSource = BusinessAccessLayer.GetEntity().User_tbl;

            var ordersPaid =
                BusinessAccessLayer.GetEntity().Orders.ToList().Where(
                    e => (e.OrderDate >= DateTime.Now.AddHours(-8) && e.OrderDate <= DateTime.Now) ||
                    (e.DeliveryDate >= DateTime.Now.AddHours(-8) && e.DeliveryDate <= DateTime.Now));

            decimal?totalRemit = null;

            totalRemit = ordersPaid.Sum(e => e.Payments.Sum(x => x.AmountPaid));

            label3.Text = (totalRemit ?? 0).ToString("#,###.00");
        }
Ejemplo n.º 14
0
        //Use to validate user login entry
        private void sValidate()
        {
            var user =
                BusinessAccessLayer.GetEntity().User_tbl.Where(
                    e => e.UserID == txtUsername.Text && e.Password == txtPassword.Text);


            if (user.Count() > 0)
            {
                isvalid = true;
                User    = txtUsername.Text;
                Close();
                return;
            }

            MessageBox.Show("Invalid username or password", "invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 15
0
        public frmManageUser()
        {
            InitializeComponent();

            var userCount = BusinessAccessLayer.GetEntity().User_tbl.Count();

            if (userCount <= 0)
            {
                var user = new User_tbl();
                user.UserID   = "Admin";
                user.Password = "******";
                BusinessAccessLayer.GetEntity().User_tbl.AddObject(user);
                BusinessAccessLayer.GetEntity().SaveChanges();
            }

            RefreshData();
            comboBox1.SelectedValueChanged += comboBox1_SelectedValueChanged;
        }
Ejemplo n.º 16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var remitttance = new Remittance();

            remitttance.DateRemit = DateTime.Now;
            remitttance.UserID    = int.Parse(comboBox1.SelectedValue.ToString());

            foreach (var remittanceDetail in RemitDetailSource.OfType <RemittanceDetail>())
            {
                remitttance.RemittanceDetails.Add(remittanceDetail);
            }


            BusinessAccessLayer.GetEntity().Remittances.AddObject(remitttance);
            BusinessAccessLayer.GetEntity().SaveChanges();
            Close();
            Dispose();
        }
        public frmTransactionBilling(int id)
        {
            InitializeComponent();
            _order = new Order();

            if (BusinessAccessLayer.GetEntity().Orders.Where(e => e.OrderID == id).Count() <= 0)
            {
                MessageBox.Show("Order Transaction doesnt exist", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            _order = BusinessAccessLayer.GetEntity().Orders.Where(e => e.OrderID == id).First();

            OrderSource.DataSource       = _order;
            CustomerSource.DataSource    = _order.Customer;
            ProductSource.DataSource     = BusinessAccessLayer.GetEntity().Products;
            OrderDetailSource.DataSource = _order.Order_Details;

            CalculateSumAmount();
        }
Ejemplo n.º 18
0
        private void btnCash_Click(object sender, EventArgs e)
        {
            if (txtGrandtotal.Text.Trim() == "")
            {
                return;
            }

            var paymentEntry = new frmPaymentEntry();

            paymentEntry.AmountToPay = double.Parse(txtGrandtotal.Text);
            paymentEntry.ShowDialog();

            if (!paymentEntry.IsSubmit)
            {
                return;
            }

            var payment = new Payment();

            payment.AmountPaid = (decimal)paymentEntry.Cash;
            payment.Balance    = (decimal)(paymentEntry.Cash - double.Parse(txtGrandtotal.Text));

            _order.CustomerID  = int.Parse(cmbBillto.SelectedValue.ToString() ?? "0");
            _order.IsPaid      = (payment.Balance == 0);
            _order.OrderDate   = dtpTransDate.Value;
            _order.BillingDate = dtpTransDate.Value;
            _order.Term        = 30;
            _order.Payments.Add(payment);

            foreach (var orderDetail in OrderDetailSource.OfType <Order_Detail>())
            {
                _order.Order_Details.Add(orderDetail);
            }

            BusinessAccessLayer.GetEntity().Orders.AddObject(_order);
            BusinessAccessLayer.GetEntity().SaveChanges();

            MessageBox.Show("transaction saved", "transaction", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Close();
        }
Ejemplo n.º 19
0
        //---------------------------------------------//

        //Constructor
        public frmMain()
        {
            var data = BusinessAccessLayer.GetEntity();

            InitializeComponent();
        }
Ejemplo n.º 20
0
        private void showSelected(string msg)
        {
            if (msg.Contains("Walk"))
            {
                new frmTransactionWalkin().ShowDialog();
            }
            else if (msg.Contains("Purchase Order"))
            {
                new frmTransactionOrder().ShowDialog();
            }
            else if (msg.Contains("Delivery"))
            {
                new frmTransactionDelivery().ShowDialog();
            }
            else if (msg == "Order List")
            {
                showOrderList();
            }
            else if (msg.Contains("Remit"))
            {
                new frmRemittance().ShowDialog();
                showRemmitanceList();
            }
            else if (msg == "Item List")
            {
                showManageProduct();
            }
            else if (msg.Contains("Details"))
            {
                showManageProductDetails();
            }
            else if (msg.Contains("Buying Report"))
            {
                var rptRange = new frmDateRangeReport();
                rptRange.Title = "Buying Report Range";
                rptRange.ShowDialog();
                if (!rptRange.IsShow)
                {
                    return;
                }

                var f = new frmProductInventoryReport();
                f.ProductBindingSource.DataSource = BusinessAccessLayer.GetEntity().Products;
                f.ShowDialog();
            }
            else if (msg.Contains("Open P/O Report"))
            {
                var rptRange = new frmDateRangeReport();
                rptRange.Title = "Open P/O Report Range";
                rptRange.ShowDialog();
                if (!rptRange.IsShow)
                {
                    return;
                }

                var f = new frmOpenPOReport();
                f.GetOrderList_ResultBindingSource.DataSource = BusinessAccessLayer.GetEntity().GetOrderList();
                //.Where(e=> e.DeliveryDate >= rptRange.dtFrom.Value && e.DeliveryDate <= rptRange.dtFrom.Value);
                f.ShowDialog();
            }
            else if (msg.Contains("AR Cash Report"))
            {
            }

            else if (msg.Contains("Account Recievable"))
            {
                showARList();
            }
        }
Ejemplo n.º 21
0
        public void RefreshData(string msg)
        {
            var entity = BusinessAccessLayer.GetEntity();

            OrderSource.DataSource = entity.GetOrderList();
        }
Ejemplo n.º 22
0
        public void RefreshData(string msg)
        {
            var entity = BusinessAccessLayer.GetEntity();

            OrderSource.DataSource = entity.GetAccountReceivable();
        }
        public void RefreshData(string msg)
        {
            var entity = BusinessAccessLayer.GetEntity();

            BillingSource.DataSource = entity.RemittanceDetails;
        }
Ejemplo n.º 24
0
        public void RefreshData(string msg)
        {
            var entity = BusinessAccessLayer.GetEntity();

            CustomerSource.DataSource = entity.Customers;
        }