示例#1
0
        private void DGVListStaff()
        {
            if (dgvListStaff.CurrentRow.Index != -1)
            {
                staff.StaffID = Convert.ToInt32(dgvListStaff.CurrentRow.Cells["StaffID"].Value);
                using (StockTracingEntities stockTracing = new StockTracingEntities())
                {
                    staff = stockTracing.Staff.Where(x => x.StaffID == staff.StaffID).FirstOrDefault();

                    txtStaffName.Text      = staff.StaffName;
                    txtStaffSurname.Text   = staff.StaffSurname;
                    txtStaffGender.Text    = staff.StaffGender;
                    txtStaffTelephone.Text = staff.StaffTelephone;
                    txtStaffSalary.Text    = staff.StaffSalary.ToString();
                }
                btnAddStaff.Text = "Personeli Güncelle";

                if (txtUserType.Text == "Staff")
                {
                    btnDeleteStaff.Enabled = false;
                }
                else
                {
                    btnDeleteStaff.Enabled = true;
                }
            }
        }
示例#2
0
 public void PopulateDataGridViewStaff(frmStaff frmStaff)
 {
     frmStaff.dgvListStaff.AutoGenerateColumns = false;
     using (StockTracingEntities stockTracing = new StockTracingEntities())
     {
         frmStaff.dgvListStaff.DataSource = stockTracing.Staff.ToList <Staff>();
     }
 }
示例#3
0
 public void PopulateDataGridViewProduct(frmProduct frmProduct)
 {
     frmProduct.dgvListProduct.AutoGenerateColumns = false;
     using (StockTracingEntities stockTracing = new StockTracingEntities())
     {
         frmProduct.dgvListProduct.DataSource = stockTracing.Product.ToList <Product>();
     }
 }
示例#4
0
        public void DGVListProduct()
        {
            if (dgvListProduct.CurrentRow.Index != -1)
            {
                product.ProductID = Convert.ToInt32(dgvListProduct.CurrentRow.Cells["ProductID"].Value);
                using (StockTracingEntities stockTracing = new StockTracingEntities())
                {
                    product = stockTracing.Product.Where(x => x.ProductID == product.ProductID).FirstOrDefault();

                    txtProductName.Text     = product.ProductName;
                    txtProductCategory.Text = product.ProductCategory;
                    txtProductPiece.Text    = product.ProductPiece;
                    txtProductPrice.Text    = product.ProductPrice.ToString();
                }

                btnAddProduct.Text       = "Ürünü Güncelle";
                btnDeleteProduct.Enabled = true;
            }
        }
示例#5
0
        private void DeleteProduct()
        {
            if (MessageBox.Show("Bu ürünü silmek istediğinize emin misiniz ?", "ÜRÜNÜ SİL", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (StockTracingEntities stockTracing = new StockTracingEntities())
                {
                    var entry = stockTracing.Entry(product);

                    if (entry.State == EntityState.Detached)
                    {
                        stockTracing.Product.Attach(product);
                    }

                    stockTracing.Product.Remove(product);
                    stockTracing.SaveChanges();
                    addProvider.PopulateDataGridViewProduct(this);
                    addProvider.ClearProduct(this);
                    MessageBox.Show("Ürün silme işlemi başarılı");
                }
            }
        }
示例#6
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");
        }
示例#7
0
        public void addStaff(frmStaff frmStaff)
        {
            staff.StaffName      = frmStaff.txtStaffName.Text.Trim();
            staff.StaffSurname   = frmStaff.txtStaffSurname.Text.Trim();
            staff.StaffGender    = frmStaff.txtStaffGender.Text.Trim();
            staff.StaffTelephone = frmStaff.txtStaffTelephone.Text.Trim();
            staff.StaffSalary    = Convert.ToDecimal(frmStaff.txtStaffSalary.Text.Trim());
            using (StockTracingEntities stockTracing = new StockTracingEntities())
            {
                if (staff.StaffID == 0)
                {
                    stockTracing.Staff.Add(staff);
                }
                else
                {
                    stockTracing.Entry(staff).State = EntityState.Modified;
                }
                stockTracing.SaveChanges();
            }

            ClearStaff(frmStaff);
            PopulateDataGridViewStaff(frmStaff);
            MessageBox.Show("Personel Kaydedildi", "Bilgi");
        }