public static DataSet GetProduction(dhDBnames dhDBnames, dhProduction objProduction) { DataSet var_ret; if (objblProduction == null) { objblProduction = new blProduction(); } { var_ret = objblProduction.GetProduction(dhDBnames, objProduction); } return(var_ret); }
public static DataSet InsertUpdateProduction(dhDBnames dhDBnames, dhProduction objProduction, Boolean InsertItems = false) { try { DataSet var_ret; if (objblProduction == null) { objblProduction = new blProduction(); } var_ret = objblProduction.InsertUpdateProduction(dhDBnames, objProduction); if ((var_ret.Tables.Count > 0) && (var_ret.Tables[0].Rows.Count > 0) && (InsertItems)) { Int64? ID = Convert.ToInt64(var_ret.Tables[0].Rows[0]["iProductionid"].ToString());; DateTime ddate = (DateTime)(var_ret.Tables[0].Rows[0]["ddate"]);; if (objProduction.ItemsConsumed != null) { ItemsList ItemCollection = objProduction.ItemsConsumed; foreach (dhSaleItem item in ItemCollection) { // dhItemStock ObjInsertItem = new dhItemStock(); item.IProductionId = ID; item.IProductionItemid = 0; item.DDate = ddate; item.IUserId = objProduction.IUserid; if (objblProduction == null) { objblProduction = new blProduction(); } objblProduction.InsertUpdateProductionItem(dhDBnames, item); } } if (objProduction.ItemsProduced != null) { ItemsList ItemCollection = objProduction.ItemsProduced; foreach (dhSaleItem item in ItemCollection) { item.IProductionId = ID; item.IProductionItemid = 1; item.DDate = ddate; item.IUserId = objProduction.IUserid; if (objblProduction == null) { objblProduction = new blProduction(); } objblProduction.InsertUpdateProductionItem(dhDBnames, item); } } //// get the SaleID //Int64? ID = Convert.ToInt64(var_ret.Tables[0].Rows[0]["iProductionid"].ToString()); ; //// get the observerable collection //ItemsList ItemCollection = objProduction.ItemsOfProduction; //int ItemID = 1; //foreach (dhSaleItem item in ItemCollection) //{ // item.IProductionId = ID; // item.IUpdate = 0; // // item.ISerialNumber = ItemID; // ItemID = ItemID + 1; // item.IUserId = Convert.ToInt32(objProduction.IUserid); // if (objblProduction == null) { objblProduction = new blProduction(); } // { // var_ret = objblProduction.InsertUpdateProductionItem(dhDBnames, item); // } //} } return(var_ret); } catch (Exception ex) { throw ex; } }