public string makeBadgeUpdateQuery(DetailUnit _du) { string preString = "update BADGE set "; string whereString = ""; string setString = ""; if (_du.getBid().Equals("")) { return(null); } whereString = " where BID = '" + _du.getBid() + "'"; if (!_du.getNewBid().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "BID = '" + _du.getNewBid() + "'"; } if (!_du.getCardName().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "DESCRIPTION = '" + _du.getCardName() + "'"; } if (!_du.getPin().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "PIN = " + _du.getPin(); } if (!_du.getIssueNum().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "SEQ = " + _du.getIssueNum() + "'"; } if (_du.getBadgeType() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "TYPE = " + _du.getBadgeType(); } if (_du.getBadgeStatus() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "STATUS_1 = " + _du.getBadgeStatus(); } if (_du.getBadgeFormat() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "FORMAT = " + _du.getBadgeFormat(); } if (_du.getIssueType() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ISSUE_TYPE = " + _du.getIssueType(); } if (_du.getIssueReason() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ISSUE_REASON = " + _du.getIssueReason(); } if (_du.getActive() != new DateTime(1000, 1, 1)) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACTIVATE_DATE = " + getCastString(getDate(_du.getActive())); } if (_du.getDeactive() != new DateTime(1000, 1, 1)) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "DEACTIVATE_DATE = " + getCastString(getDate(_du.getDeactive())) + " ,DEACTIVATE_DATE1 =" + getCastString(getDate(_du.getDeactive())) + " ,DEACTIVATE_DATE2 =" + getCastString(getDate(_du.getDeactive())) + " ,DEACTIVATE_DATE3 =" + getCastString(getDate(_du.getDeactive())) + " ,DEACTIVATE_DATE4 =" + getCastString(getDate(_du.getDeactive())); } if (!_du.getByPass().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "BYPASS_FLAG = " + _du.getByPass(); } if (!_du.getFpNum().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "FP_1 = " + _du.getFpNum(); } if (!_du.getVmStatus().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "VM = " + _du.getVmStatus(); } if (!_du.getAcs1Status().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACS_1 = " + _du.getAcs1Status(); } if (!_du.getAcs2Status().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACS_2 = " + _du.getAcs2Status(); } if (!_du.getAcs3Status().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACS_3 = " + _du.getAcs3Status(); } if (!_du.getAcs4Status().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACS_4 = " + _du.getAcs4Status(); } if (!_du.getMdmStatus().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "ACS_5 = " + _du.getMdmStatus(); } if (_du.getPT() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "PT = " + _du.getPT(); } if (!_du.getRight1().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_1 = '" + _du.getRight1() + "'"; } if (!_du.getRight2().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_2 = '" + _du.getRight2() + "'"; } if (!_du.getRight3().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_3 = '" + _du.getRight3() + "'";; } if (!_du.getRight4().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_4 = '" + _du.getRight4() + "'";; } if (setString.Equals("")) { return(null); } setString = setString + ", MODIFY_DATE = GETDATE()"; return(preString + setString + whereString); }
public string makeBadgeinsertQuery(DetailUnit _du) { string preString = "insert into BADGE "; string whereString = ""; string valuesString = "values("; if (_du.getBid().Equals("")) { return(null); } whereString = ""; valuesString = valuesString + " '" + _du.getNewBid() + "'"; valuesString = valuesString + " ,(select MAX(ID) from EMP) "; if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " '" + _du.getCardName() + "'"; if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getBadgeType(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getBadgeStatus(); valuesString = valuesString + ",1" + ",1" + ",1"; if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getBadgeFormat(); valuesString = valuesString + ",0"; if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getPin(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + getCastString(getDate(_du.getActive())); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + getCastString(getDate(_du.getDeactive())); valuesString = valuesString + " , getdate()"; if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getIssueType(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getIssueReason(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getByPass(); Log.WriteLogTmp("_du.getByPass()" + _du.getByPass()); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getAcs1Status(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getAcs2Status(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getAcs3Status(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getAcs4Status(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " " + _du.getMdmStatus(); Log.WriteLogTmp("_du.getMdmStatus()" + _du.getMdmStatus()); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + "" + _du.getFpNum(); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + "" + _du.getFpNum(); Log.WriteLogTmp("_du.getFpNum()" + _du.getFpNum()); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + "" + _du.getVmStatus(); Log.WriteLogTmp("_du.getVmStatus() : " + _du.getVmStatus()); if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + "'" + _du.getRight1() + "'"; if (!_du.getRight2().Equals("")) { if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " '" + _du.getRight2() + "'"; } if (!_du.getRight3().Equals("")) { if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " '" + _du.getRight3() + "'";; } if (!_du.getRight4().Equals("")) { if (!valuesString.Equals("")) { valuesString = valuesString + ", "; } valuesString = valuesString + " '" + _du.getRight4() + "'"; } if (!_du.getPT().Equals(-1)) { if (!valuesString.Equals("")) { valuesString = valuesString + ",'', "; } valuesString = valuesString + " " + _du.getPT() + " ,'N'," + getCastString(getDate(_du.getDeactive())) + "," + getCastString(getDate(_du.getDeactive())) + "," + getCastString(getDate(_du.getDeactive())) + "," + getCastString(getDate(_du.getDeactive())) + ")"; } if (valuesString.Equals("")) { return(null); } return(preString + valuesString); }
public string makeBadgeMultiUpdateQuery(DetailUnit _du) { string preString = "update BADGE set "; string whereString = ""; string setString = ""; if (_du.getMultiEmp().Equals("")) { return(null); } whereString = " where " + getMultiWhereString(_du.getMultiBid(), "$", "BID"); if (_du.getBadgeType() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "TYPE = " + _du.getBadgeType(); } if (_du.getBadgeStatus() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "STATUS_1 = " + _du.getBadgeStatus(); } if (_du.getBadgeFormat() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "FORMAT = " + _du.getBadgeFormat(); } if (_du.getDeactive() != DateTime.Now.AddYears(-10)) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "DEACTIVATE_DATE = " + getCastString(getDate(_du.getDeactive())); } if (!_du.getByPass().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "BYPASS_FLAG = " + _du.getByPass(); } if (_du.getPT() != -1) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "PT = " + _du.getPT(); } if (!_du.getRight1().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_1 = '" + _du.getRight1() + "'"; } if (!_du.getRight2().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_2 = '" + _du.getRight2() + "'"; } if (!_du.getRight3().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_3 = '" + _du.getRight3() + "'";; } if (!_du.getRight4().Equals("")) { if (!setString.Equals("")) { setString = setString + ", "; } setString = setString + "RIGHT_4 = '" + _du.getRight4() + "'";; } if (setString.Equals("")) { return(null); } setString = setString + ", MODIFY_DATE = GETDATE()"; return(preString + setString + whereString); }