public bool ValidateData(QCAnalysisData data) { bool ret = true; if (data.QCCODE == "") { ret = false; _error = "¡ÃسÒÃкØàÅ¢·ÕèÊ觵ÃǨ"; } else if (data.ITEM.Count == 0) { ret = false; _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ"; } return ret; }
public bool UpdateData(string userID, QCAnalysisData data) { // ####### UPDATE REQUISITION bool ret = true; if (ValidateData(data)) { OracleDBObj obj = new OracleDBObj(); obj.CreateConnection(); obj.CreateTransaction(); if (data.STLOID != 0) { // update old requisition DALObj.GetDataByLOID(data.STLOID, obj.zTrans); } else { DALObj.STLOID = data.STLOID; } try { DALObj.OnDB = false; DALObj.GetDataByLOID(data.STLOID, obj.zTrans); //DALObj.CODE = data.CODE; //DALObj.REQDATE = data.REQDATE; //DALObj.REMARK = data.REMARK; if (DALObj.OnDB) ret = DALObj.UpdateCurrentData(userID, obj.zTrans); else ret = DALObj.InsertCurrentData(userID, obj.zTrans); _STLOID = DALObj.STLOID; 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; } } else ret = false; return ret; }
public QCAnalysisData GetData(double loid) { QCAnalysisData data = new QCAnalysisData(); if (DALObj.GetDataByLOID(loid, null)) { data.STLOID = DALObj.STLOID; data.CODE = DALObj.CODE; data.QCCODE = DALObj.QCCODE; data.QCDATE = DALObj.QCDATE; data.PDNAME = DALObj.PDNAME; data.QTY = DALObj.QTY; data.STATUSVAL = DALObj.STATUSVAL; data.UNAME = DALObj.UNAME; data.DVNAME = DALObj.DVNAME; } return data; }