private double InsertProductMaster(string UserID, BasketData bkData) { bool ret = true; ProductMasterDAL oDAL = new ProductMasterDAL(); oDAL.CODE = bkData.CODE; oDAL.NAME = bkData.NAME; oDAL.ENAME = bkData.ENAME; oDAL.UNIT = bkData.UNITBASKET; oDAL.PRODUCTGROUP = bkData.PRODUCTGROUP; oDAL.ACTIVE = bkData.ACTIVE; ret = oDAL.InsertCurrentData(UserID, null); if (ret == false) { _error = oDAL.ErrorMessage; return 0; } else return oDAL.LOID; }
private bool UpdateProductMaster(string UserID, BasketData bkData) { bool ret = true; ProductMasterDAL oDAL = new ProductMasterDAL(); oDAL.GetDataByLOID(bkData.PRODUCTMASTER, null); oDAL.CODE = bkData.CODE; oDAL.NAME = bkData.NAME; oDAL.ENAME = bkData.ENAME; oDAL.UNIT = bkData.UNITBASKET; oDAL.PRODUCTGROUP = bkData.PRODUCTGROUP; oDAL.ACTIVE = bkData.ACTIVE; ret = oDAL.UpdateCurrentData(UserID, null); if (ret == false) { _error = oDAL.ErrorMessage; return ret; } else return ret; }
public static string GetLotNo(string userID, double productLOID, OracleTransaction zTrans) { bool LetClose = false; string code = ""; OracleConnection zConn = null; if (zTrans == null) { LetClose = true; zConn = OracleDB.GetConnection(); zTrans = zConn.BeginTransaction(IsolationLevel.ReadCommitted); } ProductBarcodeDAL _bDAL = new ProductBarcodeDAL(); if (_bDAL.GetDataByLOID(productLOID, zTrans)) { ProductMasterDAL _dal = new ProductMasterDAL(); if (_dal.GetDataByLOID(_bDAL.PRODUCTMASTER, zTrans)) { if (_dal.YEAR == (DateTime.Now.Year + 543).ToString().Substring(2)) { if (_dal.RUNNING == "9") { _dal.RUNNING = "1"; switch (_dal.LOTNO) { case "A": _dal.LOTNO = "B"; break; case "B": _dal.LOTNO = "C"; break; case "C": _dal.LOTNO = "D"; break; case "D": _dal.LOTNO = "E"; break; case "E": _dal.LOTNO = "F"; break; case "F": _dal.LOTNO = "G"; break; case "G": _dal.LOTNO = "H"; break; case "H": _dal.LOTNO = "I"; break; case "I": _dal.LOTNO = "J"; break; case "J": _dal.LOTNO = "K"; break; case "K": _dal.LOTNO = "L"; break; case "L": _dal.LOTNO = "M"; break; case "M": _dal.LOTNO = "N"; break; case "N": _dal.LOTNO = "O"; break; case "O": _dal.LOTNO = "P"; break; case "P": _dal.LOTNO = "Q"; break; case "Q": _dal.LOTNO = "R"; break; case "R": _dal.LOTNO = "S"; break; case "S": _dal.LOTNO = "T"; break; case "T": _dal.LOTNO = "U"; break; case "U": _dal.LOTNO = "V"; break; case "V": _dal.LOTNO = "W"; break; case "W": _dal.LOTNO = "X"; break; case "X": _dal.LOTNO = "Y"; break; case "Y": _dal.LOTNO = "Z"; break; case "Z": _dal.LOTNO = "A"; break; default: _dal.LOTNO = "A"; break; } } else { _dal.RUNNING = (Convert.ToInt32(_dal.RUNNING == "" ? "0" : _dal.RUNNING) + 1).ToString().Trim(); } } else { _dal.LOTNO = "A"; _dal.RUNNING = "1"; _dal.YEAR = (DateTime.Now.Year + 543).ToString().Substring(2); } if (!_dal.UpdateCurrentData(userID, zTrans)) { if (LetClose) { zTrans.Commit(); zConn.Close(); } throw new ApplicationException(_dal.ErrorMessage); } else { code = (_dal.CODE.Length > 3 ? _dal.CODE.Substring(0, 3) : _dal.CODE) + " " + _dal.LOTNO + _dal.RUNNING + _dal.YEAR; } } } if (LetClose) { zTrans.Commit(); zConn.Close(); } return code.ToUpper(); }