Esempio n. 1
0
        public string makeEmpMultiUpdateQuery(DetailUnit _du)
        {
            string preString   = "update EMP set ";
            string whereString = "";
            string setString   = "";


            if (_du.getMultiEmp().Equals(""))
            {
                return(null);
            }

            whereString = " where " + getMultiWhereString(_du.getMultiEmp(), "$", "ID");


            if (_du.getDepartment() != -1)
            {
                if (!setString.Equals(""))
                {
                    setString = setString + ", ";
                }
                setString = setString + "DEPARTMENT = " + _du.getDepartment();
            }
            if (_du.getDivision() != -1)
            {
                if (!setString.Equals(""))
                {
                    setString = setString + ", ";
                }
                setString = setString + "DIVISION = " + _du.getDivision();
            }
            if (_du.getTitle() != -1)
            {
                if (!setString.Equals(""))
                {
                    setString = setString + ", ";
                }
                setString = setString + "TITLE = " + _du.getTitle();
            }


            if (setString.Equals(""))
            {
                return(null);
            }

            setString = setString + ", MODIFY_DATE = GETDATE()";

            return(preString + setString + whereString);
        }
Esempio n. 2
0
        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);
        }