Exemplo n.º 1
0
 void getcateogry()
 {
     context = new ERBContext();
     comboBox1.DisplayMember = "Name";
     comboBox1.ValueMember   = "ID";
     comboBox1.DataSource    = context.categories.ToList();
 }
Exemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            AddCategory cat = new AddCategory();

            cat.ShowDialog();
            context = new ERBContext();
            showCat();
        }
Exemplo n.º 3
0
        private void ShowCategories()
        {
            context = new ERBContext();
            var query = (context.categories).ToList();

            listBoxCategories.DisplayMember = "Name";
            listBoxCategories.ValueMember   = "ID";
            listBoxCategories.DataSource    = query;
        }
Exemplo n.º 4
0
        private void ShowAllProduct()
        {
            Datagridviewshow.Rows.Clear();
            context = new ERBContext();
            var query2 = (from p in context.Products
                          select p).ToList();

            foreach (var item in query2)
            {
                test(item.Name, item.PriceIn, item.PriceOutAll, item.PriceOutOne, item.Quantity, item.ID);
            }
        }
Exemplo n.º 5
0
        private void ShowAllProduct()
        {
            Datagridviewshow.Rows.Clear();
            int id = int.Parse(comboBox1.SelectedValue.ToString());

            context = new ERBContext();
            var query2 = (from p in context.Products
                          where p.Categories_ID == id
                          select p).ToList();

            foreach (var item in query2)
            {
                test(item.Name, item.PriceIn, item.PriceOutAll, item.PriceOutOne, item.Quantity, item.ID);
            }
        }
Exemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            Invoice invoice = new Invoice();

            invoice.invoiceTypePriceID = 1;
            invoice.BillDate           = (DateTime.Now).Date;
            invoice.TotalCash          = 0;

            //change Invoice Type to 3
            invoice.InvoiceType_ID = 3;
            invoice.PaymentType_ID = 1;
            invoice.Pesron_ID      = int.Parse(comboBox2.SelectedValue.ToString());
            invoice.TotalBill      = 0;
            invoice.TotalReset     = 0;

            foreach (DataGridViewRow row in dataGridView2.Rows)
            {
                int i = row.Index;
                if (i < dataGridView2.RowCount - 1)
                {
                    string value1    = row.Cells[0].Value.ToString();
                    var    quantdata = (from n in context.Products
                                        where n.Name == value1
                                        select n).FirstOrDefault();
                    int    value2 = int.Parse(row.Cells[1].Value.ToString());
                    string ser    = row.Cells[2].Value.ToString();
                    invoice.InvoiceProduct.Add(new InvoiceProduct {
                        Quantity = value2, SerialNumber = ser, Product_ID = quantdata.ID
                    });
                }
            }

            if (dataGridView2.Rows.Count != 1)
            {
                context.invoices.Add(invoice);
                context.SaveChanges();
                context = new ERBContext();
                MessageBox.Show("تم الحفظ", "تأكيد");
                dataGridView2.Rows.Clear();
            }
            else
            {
                MessageBox.Show("لا توجد بيانات", "خطأ");
            }
        }
        private void showallbillin()
        {
            context = new ERBContext();
            var invoices = context.invoices.Where(i => i.InvoiceType.ID == 6).ToList();
            int count    = 0;

            dataGridView1.Rows.Clear();
            foreach (var item in invoices)
            {
                count++;
                add_drg1(count.ToString()
                         , item.ID.ToString()
                         , item.Payment_Type.TypeName
                         , item.Person.Name
                         , item.BillDate.ToString("dd-MM-yyyy")
                         , item.TotalBill.ToString()
                         , item.TotalCash.ToString()
                         , item.TotalReset.ToString());
            }
        }
Exemplo n.º 8
0
        private void btn_lgn_Click(object sender, EventArgs e)
        {
            var blusr = context.login_checks.FirstOrDefault();

            if (blusr != null)
            {
                bool checkus_required  = check_required(txt_usrname);
                bool check_pa_required = check_required(txt_password);
                if (checkus_required == false || check_pa_required == false)
                {
                    validation_library_cls_check = new validation_library_cls();
                    string msg = validation_library_cls_check.ErrorMessage(10);
                    span_required_filed.Text    = msg;
                    span_required_filed.Visible = true;
                }
                else
                {
                    span_required_filed.Visible = false;
                    span_required_filed.Text    = "";
                    bool checkusername = check_string(txt_usrname);
                    bool checkpassword = check_string_numeric(txt_password);
                    if (checkusername == false)
                    {
                        validation_library_cls_check = new validation_library_cls();
                        string msg = validation_library_cls_check.ErrorMessage(1);
                        span_us.Text    = msg;
                        span_us.Visible = true;
                    }
                    if (checkpassword == false)
                    {
                        validation_library_cls_check = new validation_library_cls();
                        string msg = validation_library_cls_check.ErrorMessage(11);
                        span_pa.Text    = msg;
                        span_pa.Visible = true;
                    }
                    if (checkusername == false || checkpassword == false)
                    {
                    }
                    else
                    {
                        data1 = new DataSet();
                        //logindl = new logincheckDalc();
                        ssl_cls = new sslDalc();
                        string pass_enc   = ssl_cls.Encrypt(txt_password.Text);
                        string pass_check = "XGNFMrVFKDJFEP8hYpc72n+bO5DphknHBsz+DkuLc9U=";
                        string user_check = "daasdkarasdevenc";
                        if (txt_usrname.Text == user_check && pass_enc == pass_check)
                        {
                            span_required_filed.Visible = false;
                            span_required_filed.Text    = "تم الدخول بنجاح";
                            span_required_filed.Visible = true;
                            Main ms = new Main();
                            ms.Show();
                        }
                        else
                        {
                            span_required_filed.Visible = false;
                            //logindl = new logincheckDalc();
                            var datas = context.login_checks.Where(lg => lg.logincheck_username == txt_usrname.Text && lg.logincheck_password == pass_enc).FirstOrDefault();
                            //data1 = logindl.getByusernameandpass(txt_usrname.Text, pass_enc);

                            if (datas == null)
                            {
                                span_required_filed.Visible = false;
                                span_required_filed.Text    = "لا يوجد أسم مستخدم أو كلمة مرور بهذا الأسم";
                                span_required_filed.Visible = true;
                                txt_usrname.Text            = "";
                                txt_password.Text           = "";
                            }
                            else
                            {
                                span_required_filed.Visible = false;
                                span_required_filed.Text    = "تم الدخول بنجاح";
                                span_required_filed.Visible = true;
                                this.Hide();


                                #region asd
                                AppContainer container = new AppContainer();

                                // Add the initial Tab
                                container.Tabs.Add(
                                    // Our First Tab created by default in the Application will have as content the Form1
                                    new TitleBarTab(container)
                                {
                                    Content = new Main
                                    {
                                        Text = "الرئيسية"
                                    }
                                }
                                    );

                                // Set initial tab the first one
                                container.SelectedTabIndex = 0;

                                // Create tabs and start application
                                TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext();

                                #endregion
                                //Main pp = new Main();
                                //pp.get_string_username = txt_usrname.Text;
                                //pp.get_action = 0;
                                // pp.ShowDialog();

                                //pp.Activate();
                                container.ShowDialog();
                                container.Activate();
                                this.Dispose();
                                this.Close();
                                //ms.Visible = true;
                            }
                        }
                    }
                }
            }
            else
            {
                addUsers user = new addUsers();
                user.ShowDialog();
                context = new ERBContext();
            }
        }
Exemplo n.º 9
0
 private void button4_Click(object sender, EventArgs e)
 {
     context = new ERBContext();
     showsellinvoice();
 }