コード例 #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
ファイル: AddProvider.cs プロジェクト: serdar98/StokTakip
 public void PopulateDataGridViewStaff(frmStaff frmStaff)
 {
     frmStaff.dgvListStaff.AutoGenerateColumns = false;
     using (StockTracingEntities stockTracing = new StockTracingEntities())
     {
         frmStaff.dgvListStaff.DataSource = stockTracing.Staff.ToList <Staff>();
     }
 }
コード例 #3
0
ファイル: AddProvider.cs プロジェクト: serdar98/StokTakip
 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
ファイル: AddProvider.cs プロジェクト: serdar98/StokTakip
        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
ファイル: AddProvider.cs プロジェクト: serdar98/StokTakip
        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");
        }