コード例 #1
0
ファイル: Parser.cs プロジェクト: yozsa123/CshapeProject
        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);
        }