//=========================================================================== public void add_store_operation_sup(int sid, int storeId, float getValue, string date) { operations_store ops = new operations_store(); if (date != null && date != "") { ops.date = date; } else { ops.date = DateTime.Now.ToString("dd/MM/yyyy"); } ops.supplierId = sid; ops.storeId = storeId; ops.give_value = getValue; DB.operations_store.Add(ops); DB.SaveChanges(); }
//=========================================================================== private void make_store_operation(int storeId, decimal value, int opType) { operations_store ops = new operations_store(); ops.storeId = storeId; if (opType == 1) { ops.get_value = (float)value; } else if (opType == 2) { ops.give_value = (float)value; } float charge = (float)DB.stores.Where(s => s.id == storeId).Single().value; ops.charge = charge; ops.date = DateTime.Now.ToString("dd/MM/yyyy"); DB.operations_store.Add(ops); DB.SaveChanges(); }
//=========================================================================== public void add_store_operation_give(int cid, int storeId, float value, string date = "") { stores st = DB.stores.Where(s => s.id == storeId).SingleOrDefault(); operations_store ops = new operations_store(); ops.clientId = cid; ops.storeId = storeId; ops.give_value = value; // ops.charge = (double)st.value; if (date == "") { ops.date = DateTime.Now.Date.ToString("dd/MM/yyyy", new CultureInfo("ar-AE")); } else { ops.date = (DateTime.Parse(date)).ToString("dd/MM/yyyy", new CultureInfo("ar-AE")); } DB.operations_store.Add(ops); DB.SaveChanges(); }
//===================================================== public void add_store_operation_get_store(int storeId1, int storeId2, float getValue, string date = "") { stores st = DB.stores.Where(s => s.id == storeId1).SingleOrDefault(); operations_store ops = new operations_store(); ops.storeId = storeId1; ops.fromToStoreId = storeId2; ops.get_value = getValue; ops.charge = (double)st.value; if (date == "") { ops.date = DateTime.Now.Date.ToString("dd/MM/yyyy", new CultureInfo("ar-AE")); } else { ops.date = (DateTime.Parse(date)).ToString("dd/MM/yyyy", new CultureInfo("ar-AE")); } DB.operations_store.Add(ops); DB.SaveChanges(); }