private bool InsertMaterialItemData(string UserID, DataTable tempTable, OracleDBObj objDB, double PdpLoid) { bool ret = true; string sqlDelete = "DELETE FROM MATERIALITEM WHERE PDPRODUCT = " + PdpLoid + ""; OracleDB.ExecNonQueryCmd(sqlDelete, objDB.zTrans); for (int i = 0; i < tempTable.Rows.Count; i++) { MaterialItemDAL miDAL = new MaterialItemDAL(); miDAL.PDPRODUCT = PdpLoid; miDAL.PRODUCT = Convert.ToDouble(tempTable.Rows[i]["MTRLOID"]); miDAL.ALLQTY = Convert.ToDouble(tempTable.Rows[i]["ALLQTY"]); miDAL.USEQTY = Convert.ToDouble(tempTable.Rows[i]["USEQTY"]); miDAL.WASTEQTYMAT = Convert.ToDouble(tempTable.Rows[i]["WASTEQTYMAT"]); miDAL.WASTEQTYMAN = Convert.ToDouble(tempTable.Rows[i]["WASTEQTYMAN"]); miDAL.RETURNQTY = Convert.ToDouble(tempTable.Rows[i]["RETURNQTY"]); miDAL.CHANGEQTY = Convert.ToDouble(tempTable.Rows[i]["CHANGEQTY"]); miDAL.UNIT = Convert.ToDouble(tempTable.Rows[i]["ULOID"]); miDAL.ACTIVE = tempTable.Rows[i]["ACTIVE"].ToString(); miDAL.REMARK = tempTable.Rows[i]["REMARK"].ToString(); miDAL.YIELDMAT = Convert.ToDouble(tempTable.Rows[i]["YIELDMAT"]); miDAL.YIELDMAM = Convert.ToDouble(tempTable.Rows[i]["YIELDMAM"]); miDAL.PGROUP = tempTable.Rows[i]["PGROUP"].ToString(); ret = miDAL.InsertCurrentData(UserID, objDB.zTrans); } return ret; }
private bool UpdateMaterial(string UserID, DataTable tempTable, OracleDBObj objDB, double PdpLoid) { bool ret = true; string sqlDelete = "DELETE FROM MATERIALITEM WHERE PDPRODUCT = " + PdpLoid + ""; OracleDB.ExecNonQueryCmd(sqlDelete, objDB.zTrans); double mtrLoid = 0; for (int i = 0; i < tempTable.Rows.Count; i++) { if (Convert.ToDouble(tempTable.Rows[i]["MTRLOID"])!=mtrLoid) { MaterialItemDAL miDAL = new MaterialItemDAL(); miDAL.PDPRODUCT = PdpLoid; miDAL.PRODUCT = Convert.ToDouble(tempTable.Rows[i]["MTRLOID"]); mtrLoid = Convert.ToDouble(tempTable.Rows[i]["MTRLOID"]); if (tempTable.Rows[i]["ALLQTY"].ToString() == "" || tempTable.Rows[i]["ALLQTY"] == null) miDAL.ALLQTY = 0; else miDAL.ALLQTY = Convert.ToDouble(tempTable.Rows[i]["ALLQTY"]); miDAL.USEQTY = Convert.ToDouble(tempTable.Rows[i]["USEQTY"]); miDAL.WASTEQTYMAT = Convert.ToDouble(tempTable.Rows[i]["WASTEQTYMAT"]); miDAL.WASTEQTYMAN = Convert.ToDouble(tempTable.Rows[i]["WASTEQTYMAN"]); miDAL.RETURNQTY = Convert.ToDouble(tempTable.Rows[i]["RETURNQTY"]); miDAL.CHANGEQTY = Convert.ToDouble(tempTable.Rows[i]["CHANGEQTY"]); miDAL.UNIT = Convert.ToDouble(tempTable.Rows[i]["UNIT"]); if (tempTable.Rows[i]["ACTIVE"].ToString() == "" || tempTable.Rows[i]["ACTIVE"] == null) miDAL.ACTIVE = "1"; else miDAL.ACTIVE = tempTable.Rows[i]["ACTIVE"].ToString(); miDAL.REMARK = tempTable.Rows[i]["REMARK"].ToString(); miDAL.YIELDMAT = Convert.ToDouble(tempTable.Rows[i]["YIELDMAT"]); miDAL.YIELDMAM = Convert.ToDouble(tempTable.Rows[i]["YIELDMAM"]); miDAL.PGROUP = tempTable.Rows[i]["PGROUP"].ToString(); ret = miDAL.InsertCurrentData(UserID, objDB.zTrans); if (ret == false) { _error = miDAL.ErrorMessage; return false; } } } return true; }