Beispiel #1
0
        public void Login(frmLogin login)
        {
            frmProduct     product     = new frmProduct();
            SqlDataAdapter dataAdapter = new SqlDataAdapter("Select * from [User] Where Username='******' and Password='******' ", connection);

            dataAdapter.Fill(dataTable);

            if (dataTable.Rows.Count == 0)
            {
                MessageBox.Show("Kullanıcı Adı veya Şifre Yanlış", "Hata");
            }
            else if (dataTable.Rows[0][3].ToString() == "Admin")
            {
                product.Show();
                login.Hide();

                ((Form)product).Controls["txtUserType"].Text = dataTable.Rows[0][3].ToString();
                ((Form)product).Controls["txtUser"].Text     = dataTable.Rows[0][1].ToString();
                product.Controls["txtUser"].BackColor        = Color.LightSkyBlue;
                product.Controls["txtUserType"].BackColor    = Color.LightSkyBlue;
            }
            else if (dataTable.Rows[0][3].ToString() == "Staff")
            {
                login.Hide();
                product.Show();

                ((Form)product).Controls["txtUserType"].Text = "Personel";
                ((Form)product).Controls["txtUser"].Text     = dataTable.Rows[0][1].ToString();
                product.Controls["txtUserType"].BackColor    = Color.LightGreen;
                product.Controls["txtUser"].BackColor        = Color.LightGreen;
            }
        }
Beispiel #2
0
 public void PopulateDataGridViewProduct(frmProduct frmProduct)
 {
     frmProduct.dgvListProduct.AutoGenerateColumns = false;
     using (StockTracingEntities stockTracing = new StockTracingEntities())
     {
         frmProduct.dgvListProduct.DataSource = stockTracing.Product.ToList <Product>();
     }
 }
Beispiel #3
0
        public void ClearProduct(frmProduct frmProduct)
        {
            frmProduct.txtProductName.Clear();
            frmProduct.txtProductCategory.Clear();
            frmProduct.txtProductPiece.Clear();
            frmProduct.txtProductPrice.Clear();

            frmProduct.btnAddProduct.Text       = "Ürün Ekle";
            frmProduct.btnDeleteProduct.Enabled = false;
            product.ProductID = 0;
        }
Beispiel #4
0
        public void addProduct(frmProduct frmProduct)
        {
            product.ProductName     = frmProduct.txtProductName.Text.Trim();
            product.ProductCategory = frmProduct.txtProductCategory.Text.Trim();
            product.ProductPiece    = frmProduct.txtProductPiece.Text.Trim();
            product.ProductPrice    = Convert.ToDecimal(frmProduct.txtProductPrice.Text.Trim());
            using (StockTracingEntities stockTracing = new StockTracingEntities())
            {
                if (product.ProductID == 0)
                {
                    stockTracing.Product.Add(product);
                }
                else
                {
                    stockTracing.Entry(product).State = EntityState.Modified;
                }
                stockTracing.SaveChanges();
            }

            ClearProduct(frmProduct);
            PopulateDataGridViewProduct(frmProduct);
            MessageBox.Show("Ürün Kayıt Başarılı", "Bilgi");
        }
Beispiel #5
0
        private void productToolMenu_Click(object sender, EventArgs e)
        {
            frmProduct product = new frmProduct();

            if (txtUserType.Text == "Admin")
            {
                ((Form)product).Controls["txtUserType"].Text = txtUserType.Text;
                ((Form)product).Controls["txtUser"].Text     = txtUser.Text;

                product.Controls["txtUser"].BackColor     = Color.LightSkyBlue;
                product.Controls["txtUserType"].BackColor = Color.LightSkyBlue;
            }
            else if (txtUserType.Text == "Personel")
            {
                ((Form)product).Controls["txtUserType"].Text = txtUserType.Text;
                ((Form)product).Controls["txtUser"].Text     = txtUser.Text;

                product.Controls["txtUser"].BackColor     = Color.LightGreen;
                product.Controls["txtUserType"].BackColor = Color.LightGreen;
            }

            this.Hide();
            product.Show();
        }