示例#1
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ı");
                }
            }
        }
示例#2
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");
        }
示例#3
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");
        }