private void UpdateData(string userID, StockInFGData data, System.Data.OracleClient.OracleTransaction zTrans) { bool ret = true; DALObj.OnDB = false; DALObj.GetDataByLOID(data.LOID, zTrans); DALObj.SENDER = data.SENDER; DALObj.RECEIVEDATE = data.RECEIVEDATE; DALObj.REMARK = data.REMARK; DALObj.STATUS = data.STATUS; DALObj.INVNO = data.INVNO; DALObj.QCCODE = data.QCCODE; DALObj.RECEIVER = data.RECEIVER; DALObj.DOCTYPE = data.DOCTYPE; DALObj.QCDATE = data.QCDATE; if (DALObj.OnDB) ret = DALObj.UpdateCurrentData(userID, zTrans); else ret = DALObj.InsertCurrentData(userID, zTrans); _LOID = DALObj.LOID; if (!ret) { throw new ApplicationException(DALObj.ErrorMessage); } StockInItemDAL itemDAL = new StockInItemDAL(); itemDAL.DeleteDataByStockIn(data.LOID, zTrans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { StockInItemData item = (StockInItemData)data.ITEM[i]; itemDAL.PRODUCT = item.PRODUCT; itemDAL.QTY = item.QTY; itemDAL.PRICE = item.PRICE; itemDAL.STOCKIN = DALObj.LOID; itemDAL.REFLOID = item.REFLOID; itemDAL.REFTABLE = "POITEM"; itemDAL.LOTNO = item.LOTNO; itemDAL.QCQTY = item.QCQTY; if (item.QCRESULT == Constz.QCResult.Pass.Name) itemDAL.QCRESULT = Constz.QCResult.Pass.Code; else if (item.QCRESULT == Constz.QCResult.Fail.Name) itemDAL.QCRESULT = Constz.QCResult.Fail.Code; else itemDAL.QCRESULT = ""; itemDAL.QCREMARK = item.QCREMARK; itemDAL.ACTIVE = Constz.ActiveStatus.Active; itemDAL.STATUS = data.STATUS; itemDAL.UNIT = item.UNIT; itemDAL.PRICE = item.PRICE; itemDAL.REMARK = item.REMARK; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); } }
public bool DeleteData(ArrayList arrData) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { StockInItemDAL itemDAL = new StockInItemDAL(); for (int i = 0; i < arrData.Count; i++) { DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans); itemDAL.DeleteDataByStockIn(Convert.ToDouble(arrData[i]), obj.zTrans); ret = DALObj.DeleteCurrentData(obj.zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); } obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
public bool UpdateStockinReturnWHStatus(ArrayList arrData, string userID) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { for (int i = 0; i < arrData.Count; i++) { if (GetItem(Convert.ToDouble(arrData[i])).Rows.Count == 0) { throw new ApplicationException("äÁèÊÒÁÒö͹ØÁѵÔÃÒ¡ÒÃä´é à¹×èͧ¨Ò¡ºÒ§ÃÒ¡ÒÃäÁèä´éÃкØÊÔ¹¤éÒ"); } StockinReturnData data = GetData(Convert.ToDouble(arrData[i])); DALObj.OnDB = false; DALObj.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans); if (DALObj.STATUS == Constz.Requisition.Status.Waiting.Code) { DALObj.STATUS = Constz.Requisition.Status.Finish.Code; ret = DALObj.UpdateCurrentData(userID, obj.zTrans); if (!ret) throw new ApplicationException(DALObj.ErrorMessage); } StockInItemDAL itemDAL = new StockInItemDAL(); ret = itemDAL.UpdateStatusByStockIn(Convert.ToDouble(arrData[i]), Constz.StockinReturn.Status.Approved.Code, userID, obj.zTrans); if (!ret) throw new ApplicationException(itemDAL.ErrorMessage); } obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
public DataTable GetStockInItemBlank() { StockInItemDAL itemDAL = new StockInItemDAL(); return SearchDAL.GetReceiveItemListBlank(); }
private void UpdateData(string userID, StockinReturnData data, System.Data.OracleClient.OracleTransaction trans) { bool ret = true; DALObj.CODE = data.CODE; DALObj.DOCTYPE = data.DOCTYPE; DALObj.SENDER = data.SENDER; DALObj.RECEIVEDATE = data.RECEIVEDATE; DALObj.STATUS = data.STATUS; DALObj.REMARK = data.REMARK; DALObj.GRANDTOT = data.GRANDTOT; DALObj.CADDRESS = data.CADDRESS; DALObj.REFLOID = data.REFLOID; DALObj.REFTABLE = data.REFTABLE; DALObj.CTITLE = data.CTITLE; DALObj.CNAME = data.CNAME; DALObj.CLASTNAME = data.CLASTNAME; DALObj.CTEL = data.CTEL; DALObj.CFAX = data.CFAX; DALObj.RECEIVER = data.RECEIVER; DALObj.APPROVEDATE = data.APPROVEDATE; DALObj.APPROVER = data.APPROVER; if (DALObj.OnDB) { ret = DALObj.UpdateCurrentData(userID, trans); } else { ret = DALObj.InsertCurrentData(userID, trans); } if (!ret) throw new ApplicationException(DALObj.ErrorMessage); _LOID = DALObj.LOID; StockInItemDAL itemDAL = new StockInItemDAL(); itemDAL.DeleteDataByStockIn(data.LOID, trans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { StockinReturnItemData item = (StockinReturnItemData)data.ITEM[i]; itemDAL.STOCKIN = DALObj.LOID; itemDAL.PRODUCT = item.PRODUCT; itemDAL.UNIT = item.UNIT; itemDAL.LOTNO = item.LOTNO; itemDAL.PRICE = item.PRICE; itemDAL.QTY = item.QTY; itemDAL.QTYLOST = item.QTYLOST; itemDAL.REFLOID = item.REFLOID; itemDAL.REFTABLE = item.REFTABLE; itemDAL.STATUS = DALObj.STATUS; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, trans); if (!ret) throw new ApplicationException(itemDAL.ErrorMessage); } }
public bool SubmitQCStockIn(ArrayList arrData, string userID) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { for (int i =0; i<arrData.Count; ++i) { string[] str = arrData[i].ToString().Split('#'); if (str[1] == "STOCKIN") { StDAL.OnDB = false; StDAL.GetDataByLOID(Convert.ToDouble(str[0]), obj.zTrans); StockInItemDAL _itemDAL = new StockInItemDAL(); if (_itemDAL.GetDataList("WHERE STOCKIN = " + StDAL.LOID.ToString() + " AND QCRESULT NOT IN ('" + Constz.QCResult.Fail.Code + "', '" + Constz.QCResult.Pass.Code + "') ", obj.zTrans).Rows.Count == 0) throw new ApplicationException("ÃкؼšÒõÃǨÊͺÃÒ¡ÒÃàÅ¢·Õè " + StDAL.CODE + " ãËé¤Ãº·Ø¡ÃÒ¡ÒÃ"); if (StDAL.STATUS == Constz.Requisition.Status.QC.Code) { StDAL.STATUS = Constz.Requisition.Status.Approved.Code; ret = StDAL.UpdateCurrentData(userID, obj.zTrans); if (!ret) throw new ApplicationException(StDAL.ErrorMessage); } } else { PoDAl.OnDB = false; PoDAl.GetDataByLOID(Convert.ToDouble(str[0]), obj.zTrans); PDProductDAL _itemDAL = new PDProductDAL(); if (_itemDAL.GetDataList("WHERE PDPRODUCT = " + PoDAl.LOID.ToString() + " AND QCRESULT NOT IN ('" + Constz.QCResult.Fail.Code + "', '" + Constz.QCResult.Pass.Code + "') ", obj.zTrans).Rows.Count == 0) throw new ApplicationException("ÃкؼšÒõÃǨÊͺÃÒ¡ÒÃàÅ¢·Õè " + PoDAl.CODE + " ãËé¤Ãº·Ø¡ÃÒ¡ÒÃ"); if (PoDAl.STATUS == Constz.Requisition.Status.QC.Code) { PoDAl.STATUS = Constz.Requisition.Status.Approved.Code; ret = PoDAl.UpdateCurrentData(userID, obj.zTrans); if (!ret) throw new ApplicationException(PoDAl.ErrorMessage); ret = PoDAl.CutStock(Convert.ToDouble(str[0]), userID, obj.zTrans); if (!ret) throw new ApplicationException(PoDAl.ErrorMessage); } } } obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
private void UpdateData(string userID, StockinProductData data, System.Data.OracleClient.OracleTransaction zTrans) { bool ret = true; SDAL.OnDB = false; SDAL.GetDataByLOID(data.LOID, zTrans); SDAL.SENDER = data.SENDER; SDAL.RECEIVER = data.RECEIVER; if (SDAL.RECEIVEDATE.Year == 1) SDAL.RECEIVEDATE = DateTime.Today; //SDAL.CREATEON = data.STCREATEON; SDAL.REMARK = data.REMARK; SDAL.STATUS = data.STATUS; SDAL.DOCTYPE = data.DOCTYPE; if (SDAL.OnDB) ret = SDAL.UpdateCurrentData(userID, zTrans); else ret = SDAL.InsertCurrentData(userID, zTrans); _LOID = SDAL.LOID; if (!ret) { throw new ApplicationException(SDAL.ErrorMessage); } StockInItemDAL itemDAL = new StockInItemDAL(); itemDAL.DeleteDataByStockIn(data.LOID, zTrans); for (Int16 i = 0; i < data.ITEM.Count; ++i) { StockinProductData item = (StockinProductData)data.ITEM[i]; itemDAL.PRODUCT = item.PRODUCT; itemDAL.QTY = item.QTY; itemDAL.STOCKIN = SDAL.LOID; itemDAL.REFLOID = item.REFLOID; itemDAL.REFTABLE = "PDPRODUCT"; itemDAL.LOTNO = item.LOTNO; itemDAL.ACTIVE = Constz.ActiveStatus.Active; itemDAL.STATUS = Constz.Requisition.Status.Waiting.Code; itemDAL.UNIT = item.UNIT; itemDAL.OnDB = false; ret = itemDAL.InsertCurrentData(userID, zTrans); if (!ret) throw new ApplicationException(SDAL.ErrorMessage); } }
public bool NewStockIn(string UserID, ToDoListStockinOrderData data) { bool ret = true; OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); try { StockInDAL _DAL = new StockInDAL(); _DAL.OnDB = false; _DAL.ACCCODE = data.ACCCODE; _DAL.DOCTYPE = data.DOCTYPE; _DAL.RECEIVEDATE = data.RECEIVEDATE; _DAL.RECEIVER = data.RECEIVER; _DAL.SENDER = data.SENDER; _DAL.STATUS = data.STATUS; ret = _DAL.InsertCurrentData(UserID, obj.zTrans); if (!ret) { throw new ApplicationException(_DAL.ErrorMessage); } StockInItemDAL _DALItem = new StockInItemDAL(); for (int i = 0; i < data.ITEM.Count; ++i) { _DALItem.OnDB = false; ToDoListStockInOrderItemData itemData = (ToDoListStockInOrderItemData)data.ITEM[i]; _DALItem.LOTNO = itemData.LOTNO; _DALItem.PRICE = itemData.PRICE; _DALItem.PRODUCT = itemData.PRODUCT; _DALItem.QTY = itemData.QTY; _DALItem.REFLOID = itemData.REFLOID; _DALItem.REFTABLE = itemData.REFTABLE; _DALItem.STATUS = itemData.STATUS; _DALItem.STOCKIN = _DAL.LOID; _DALItem.UNIT = itemData.UNIT; ret = _DALItem.InsertCurrentData(UserID, obj.zTrans); if (!ret) { throw new ApplicationException(_DALItem.ErrorMessage); } } _LOID = _DAL.LOID; obj.zTrans.Commit(); obj.CloseConnection(); } catch (Exception ex) { obj.zTrans.Rollback(); obj.CloseConnection(); ret = false; _error = ex.Message; } return ret; }
public bool InsertStockInitem(string UserId, ArrayList arr) { bool ret = true; OracleDBObj DBObj = new OracleDBObj(); DBObj.CreateConnection(); DBObj.CreateTransaction(); try { foreach (StockInItemData data in arr) { StockInItemDAL oDAL = new StockInItemDAL(); oDAL.QTY = Convert.ToDouble(data.QTY); oDAL.STOCKIN = Convert.ToDouble(data.STOCKIN); oDAL.PRODUCT = Convert.ToDouble(data.PRODUCT); oDAL.STATUS = "AP"; oDAL.REFLOID = Convert.ToDouble(data.REFLOID); oDAL.REFTABLE = "REQUISITIONITEM"; oDAL.PRICE = Convert.ToDouble(data.PRICE); oDAL.UNIT = Convert.ToDouble(data.UNIT); oDAL.InsertCurrentData(UserId, DBObj.zTrans); } ret = true; DBObj.zTrans.Commit(); } catch (Exception ex) { ret = false; DBObj.zTrans.Rollback(); _error = ex.Message; } DBObj.CloseConnection(); return ret; }