コード例 #1
0
        public string InsertApprovalQueue(ApprovalQueue approvalQueue)
        {
            string        environment = ConfigurationManager.AppSettings["dbname"].ToString();
            StringBuilder sql         = new StringBuilder();

            //sql.Append(" IF NOT EXISTS(SELECT Company FROM Ice.UD24 WHERE Company = " + Escape(approvalQueue.CompanyID) + " AND ShortChar02 = " + Escape(approvalQueue.DocumentNo) + " AND Key1 = " + Escape(approvalQueue.ApprovalQueueID) + ") ");
            sql.Append($" IF NOT EXISTS(SELECT Company FROM {environment}.Ice.UD24 WHERE Company = " + Escape(approvalQueue.CompanyID) + " AND ShortChar02 = " + Escape(approvalQueue.DocumentNo) + " AND Character01 = " + Escape(approvalQueue.Remarks) + ") ");
            sql.Append(" BEGIN ");
            sql.Append($" INSERT INTO {environment}.Ice.UD24(Company, Key1, ShortChar01, ShortChar02, ShortChar03, ShortChar04, ShortChar05, Character01, Date01, Date03) ");
            sql.Append(" VALUES( " + Escape(approvalQueue.CompanyID) + ", ");
            sql.Append("         " + Escape(approvalQueue.ApprovalQueueID) + ", ");
            sql.Append("         " + Escape(approvalQueue.ModuleID) + ", ");
            sql.Append("         " + Escape(approvalQueue.DocumentNo) + ", ");
            sql.Append("         " + Escape(approvalQueue.ApprovalStatus) + ", ");
            sql.Append("         " + Escape(approvalQueue.ApprovalStage) + ", ");
            sql.Append("         " + Escape(approvalQueue.SupplierID) + ", ");
            sql.Append("         " + Escape(approvalQueue.Remarks) + ", ");
            sql.Append("         " + Escape(CommonClasses.ConvertDateToYMD(approvalQueue.SubmitDate.ToString())) + ", ");
            sql.Append("         " + Escape(CommonClasses.ConvertDateToYMD(approvalQueue.ProceedDate.ToString())) + ") ");
            sql.Append(" END ");

            SqlClass.Conn = ConfigurationManager.ConnectionStrings["Finsoft"].ToString();

            string errMsg = null;
            int    count  = (int)SqlClass.ExecuteCmdQry(sql.ToString(), ref errMsg);

            return(errMsg);
        }