public static void setProduct(int waybill_no, int barcode, int supplier_no, int product_no, float unit_input_price, int amount, float price, DateTime debt_date, string product_name) { if (getProductbyBarcode(barcode) == null) { //eklenecek ürünün database de olup olmadığınıa bakılır. Supplier sup = Supplier.setSupplier(supplier_no); using (MngContext context = new MngContext()) { Product p = new Product { waybill_no = waybill_no, barcode = barcode, supplier_no = supplier_no, product_no = product_no, unit_input_price = unit_input_price, amount = amount, price = price, product_name = product_name, Supplier = sup, MarketDebt = MarketDebt.setMDebt(price, debt_date, barcode), }; context.Products.Add(p); context.SaveChanges(); } } }
public static void setDSale(int customer_no, int sale_no, int product_no, float unit_input_price, DateTime sale_date, string payment_method, string empusname, int barcode, float price) { using (MngContext context = new MngContext()) { Employee e = Employee.getEmployeebyUsName(empusname); DebitSale m = new DebitSale { customer_no = customer_no, sale_no = sale_no, price = price, unit_input_price = unit_input_price, product_no = product_no, sale_date = sale_date, payment_method = payment_method, barcode = barcode, Employee = e, }; m.CustomerDebt = CustomerDebt.setCDebt(customer_no, price, sale_date, sale_no); context.DebitSales.Add(m); context.SaveChanges(); } }
public static void delProductByBarcode(int barcode) { Product del_product = getProductbyBarcode(barcode); if (del_product != null) { using (MngContext context = new MngContext()) { context.Products.Attach(del_product); context.Products.Remove(del_product); context.SaveChanges(); } } }
public static void setEmployee(string dusername, string dpassword) { if (getEmployee(dusername, dpassword) == null) { //eklenecek çalışanın database de olup olmadığınıa bakılır. using (var context = new MngContext()) { Employee e = new Employee { username = dusername, password = dpassword, }; context.Employees.Add(e); context.SaveChanges(); } } }
public static Supplier setSupplier(int supplier_no) { if (getSupplier(supplier_no) == null) { //eklenecek firmanın database de olup olmadığınıa bakılır. using (var context = new MngContext()) { Supplier e = new Supplier { supplier_no = supplier_no, }; context.Suppliers.Add(e); context.SaveChanges(); return(e); } } return(null); }
public static CustomerDebt setCDebt(int customer_no, float debt_amount, DateTime debt_date, int sale_no) { using (MngContext context = new MngContext()) { CustomerDebt m = new CustomerDebt { sale_no = sale_no, customer_no = customer_no, debt_amount = debt_amount, debt_date = debt_date, payed = false, //ürün stoğa eklendiğinde borç oluşur daima }; context.CustomerDebts.Add(m); context.SaveChanges(); return(m); } }
public static MarketDebt setMDebt(float debt_amount, DateTime debt_date, int barcode) { using (MngContext context = new MngContext()) { MarketDebt m = new MarketDebt { debt_amount = debt_amount, debt_date = debt_date, barcode = barcode, payed = false, //ürün stoğa eklendiğinde borç oluşur daima }; context.MarketDebts.Add(m); context.SaveChanges(); return(m); } }