public void TestSelectDatabase() { APPR_DO_HEADER item = ctx.APPR_DO_HEADER.FirstOrDefault(); APPR_DO_DETAIL appr_do_details = ctx.APPR_DO_DETAIL.FirstOrDefault(); APPR_DO_ADDRESS appr_do_address = ctx.APPR_DO_ADDRESS.FirstOrDefault(); APPR_DO_REMARK appr_do_remark = ctx.APPR_DO_REMARK.FirstOrDefault(); APPR_RECEIVE_H appr_receive_h = ctx.APPR_RECEIVE_H.FirstOrDefault(); APPR_RECEIVE_DETAIL_D appr_receive_detail_d = ctx.APPR_RECEIVE_DETAIL_D.FirstOrDefault(); APPR_GL_HEADER appr_gl_header = ctx.APPR_GL_HEADER.FirstOrDefault(); APPR_GL_DETAIL appr_gl_detail = ctx.APPR_GL_DETAIL.FirstOrDefault(); APPR_DO_HEADER header = new APPR_DO_HEADER() { BRANCH_NO = 2, SECTION = item.SECTION, DOC_TYPE = item.DOC_TYPE, DOC_NO = "12122e35451790", DOC_DATE = item.DOC_DATE, DESCRIPTION = item.DESCRIPTION, AMOUNT_BEFORE_DISCOUNT = item.AMOUNT_BEFORE_DISCOUNT, DISCOUNT_CREDIT_PATTERN = item.DISCOUNT_CREDIT_PATTERN, DISCOUNT_CASH_PATTERN = item.DISCOUNT_CASH_PATTERN, DISCOUNT_CREDIT = item.DISCOUNT_CREDIT, DISCOUNT_CASH = item.DISCOUNT_CASH, AMOUNT_BEFORE_VAT = item.AMOUNT_BEFORE_VAT, VAT_RATE = item.VAT_RATE, VAT_AMOUNT = item.VAT_AMOUNT, TOTAL_AMOUNT = item.TOTAL_AMOUNT, LEDGER_TYPE = item.LEDGER_TYPE, EMP_CODE = item.EMP_CODE, CUSTOMER_CODE = item.CUSTOMER_CODE, CUSTOMER_CODE_SHIPTO = item.CUSTOMER_CODE_SHIPTO, REFER_TYPE = item.REFER_TYPE, REFER_NO = item.REFER_NO, REFER_DATE = item.REFER_DATE, LAST_LINE = item.LAST_LINE, REMARK = item.REMARK, STATUS = item.STATUS, USER_ID = item.USER_ID, TIME = item.TIME, REF_BUDGET = item.REF_BUDGET, REF_PROJECT = item.REF_PROJECT, BUD_ACCOUNT_CODE = item.BUD_ACCOUNT_CODE, REF_ACTIVITY = item.REF_ACTIVITY, STATUS_APPROVE = item.STATUS_APPROVE, REMARK_APPROVE = item.REMARK_APPROVE, DATE_APPROVED = item.DATE_APPROVED, BUD_YEAR = item.BUD_YEAR, PAYMENT_TERM = item.PAYMENT_TERM, DELIVERY_DATE = item.DELIVERY_DATE, DUEDATE = item.DUEDATE, TYPE_TAX = item.TYPE_TAX, PAY_TYPE = item.PAY_TYPE, INVOICE_TYPE = item.INVOICE_TYPE, MEMBER_CODE = item.MEMBER_CODE, SALE_TYPE = item.SALE_TYPE, PAY_CASH = item.PAY_CASH, PAY_OTHER = item.PAY_OTHER, PAY_DEPOSIT = item.PAY_DEPOSIT, TIME_PRINT = item.TIME_PRINT, DATE_UPDATE = item.DATE_UPDATE, AR_ACCOUNT = item.AR_ACCOUNT, SHOW_DOC_DATE = item.SHOW_DOC_DATE, TYPE_DISPOSE = item.TYPE_DISPOSE, PREMIUM_AMOUNT = item.PREMIUM_AMOUNT, PLAN_CODE = item.PLAN_CODE, FUND_CODE = item.FUND_CODE, }; ctx.APPR_DO_HEADER.AddObject(header); ctx.SaveChanges(); ctx.APPR_DO_HEADER.DeleteObject(header); ctx.SaveChanges(); //Assert.IsNotNull(header); Assert.IsNotNull(appr_do_details); Assert.IsNotNull(appr_do_address); Assert.IsNotNull(appr_do_remark); Assert.IsNotNull(appr_receive_h); Assert.IsNotNull(appr_receive_detail_d); Assert.IsNotNull(appr_gl_header); Assert.IsNotNull(appr_gl_detail); }
public static String ConcreateInsertCommand(APPR_RECEIVE_H source) { StringBuilder sqlCommand = new StringBuilder("INSERT INTO APPR_RECEIVE_H "); //sqlCommand.Append("(BRACH_NO,DOC_TYPE,DOC_NO,DOC_DATE,SECTION,EMP_CODE,CUSTOMER_CODE,DESCRIPTION1,DESCRIPTION2,LEDGER_TYPE,BANK_CODE,CHEQUE_NOCHEQUE_DATE,CREDIT_BANK_ACCOUNT,CREDIT_BANK_SECRET_ACCOUNT,DEBIT_AR_ACCOUNT,DEBIT_AR_SECRET_ACCOUNT,CREDIT_WHOLDING_ACCOUNT,CREDIT_WHOLDING_SECRET_ACCOUNT,DEBIT_CHARGE_ACCOUNT,DEBIT_CHARGE_SECRET_ACCOUNT,INVOICE_AMOUNT,INVOICE_RECEIVE_AMOUNT,WITHOLDINGTAX_AMOUNT,CHARGE_AMOUNT,PAYMENT_AMOUNT,REFER_TYPE,REFER_NO,REFER_DATE,REMARK,STATUS,USER_ID,REF_BUDGET,REF_PROJECT,BUD_ACCOUNT_CODE,ACTIVITY,BUD_YEAR,AMOUNT_DEPOSIT,PAY_CASH,PAY_OTHER,RECEIVE_TYPE,INVOICE_TYPE,INVOICE_RECEIVE_BEFORE_VAT,INVOICE_RECEIVE_VAT,SENDING_FLAG,SENDING_TYPE,SENDING_NO,SENDING_DATE,DONATE_FLAG,DONATE_NO,PREMIUM_AMOUNT,PLAN_CODE,FUND_CODE)"); sqlCommand.Append("(BRACH_NO,DOC_TYPE,DOC_NO,DOC_DATE,SECTION,EMP_CODE,CUSTOMER_CODE,DESCRIPTION1,DESCRIPTION2,LEDGER_TYPE,BANK_CODE,CHEQUE_NO,CHEQUE_DATE,CREDIT_BANK_ACCOUNT,CREDIT_BANK_SECRET_ACCOUNT,DEBIT_AR_ACCOUNT,DEBIT_AR_SECRET_ACCOUNT,CREDIT_WHOLDING_ACCOUNT,CREDIT_WHOLDING_SECRET_ACCOUNT,DEBIT_CHARGE_ACCOUNT,DEBIT_CHARGE_SECRET_ACCOUNT,INVOICE_AMOUNT,INVOICE_RECEIVE_AMOUNT,WITHOLDINGTAX_AMOUNT,CHARGE_AMOUNT,PAYMENT_AMOUNT,REFER_TYPE,REFER_NO,REFER_DATE,REMARK,STATUS,USER_ID,REF_BUDGET,REF_PROJECT,BUD_ACCOUNT_CODE,ACTIVITY,BUD_YEAR,AMOUNT_DEPOSIT,PAY_CASH,PAY_OTHER,RECEIVE_TYPE,INVOICE_TYPE,INVOICE_RECEIVE_BEFORE_VAT,INVOICE_RECEIVE_VAT,SENDING_FLAG,SENDING_TYPE,SENDING_NO,SENDING_DATE,DONATE_FLAG,DONATE_NO,PREMIUM_AMOUNT,PLAN_CODE,FUND_CODE)"); sqlCommand.Append(" Values ("); sqlCommand.Append(BindValue(source.BRACH_NO) + " ,"); sqlCommand.Append("'" + BindValue(source.DOC_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.DOC_NO) + "' ,"); sqlCommand.Append(BindValue(source.DOC_DATE) + ","); sqlCommand.Append("'" + BindValue(source.SECTION) + "' ,"); sqlCommand.Append("'" + BindValue(source.EMP_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.CUSTOMER_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.DESCRIPTION1) + "' ,"); sqlCommand.Append("'" + BindValue(source.DESCRIPTION2) + "' ,"); sqlCommand.Append("'" + BindValue(source.LEDGER_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.BANK_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.CHEQUE_NO) + "' ,"); sqlCommand.Append(BindValue(source.CHEQUE_DATE) + " ,"); sqlCommand.Append("'" + BindValue(source.CREDIT_BANK_ACCOUNT) + "' ,"); sqlCommand.Append(BindValue(source.CREDIT_BANK_SECRET_ACCOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.DEBIT_AR_ACCOUNT) + "' ,"); sqlCommand.Append(BindValue(source.DEBIT_AR_SECRET_ACCOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.CREDIT_WHOLDING_ACCOUNT) + "' ,"); sqlCommand.Append(BindValue(source.CREDIT_WHOLDING_SECRET_ACCOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.DEBIT_CHARGE_ACCOUNT) + "' ,"); sqlCommand.Append(BindValue(source.DEBIT_CHARGE_SECRET_ACCOUNT) + " ,"); sqlCommand.Append(BindValue(source.INVOICE_AMOUNT) + " ,"); sqlCommand.Append(BindValue(source.INVOICE_RECEIVE_AMOUNT) + " ,"); sqlCommand.Append(BindValue(source.WITHOLDINGTAX_AMOUNT) + " ,"); sqlCommand.Append(BindValue(source.CHARGE_AMOUNT) + " ,"); sqlCommand.Append(BindValue(source.PAYMENT_AMOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.REFER_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.REFER_NO) + "' ,"); sqlCommand.Append(BindValue(source.REFER_DATE) + " ,"); sqlCommand.Append("'" + BindValue(source.REMARK) + "' ,"); sqlCommand.Append("'" + BindValue(source.STATUS) + "' ,"); sqlCommand.Append("'" + BindValue(source.USER_ID) + "' ,"); sqlCommand.Append("'" + BindValue(source.REF_BUDGET) + "' ,"); sqlCommand.Append("'" + BindValue(source.REF_PROJECT) + "' ,"); sqlCommand.Append("'" + BindValue(source.BUD_ACCOUNT_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.ACTIVITY) + "' ,"); sqlCommand.Append(BindValue(source.BUD_YEAR) + ","); sqlCommand.Append(BindValue(source.AMOUNT_DEPOSIT) + " ,"); sqlCommand.Append(BindValue(source.PAY_CASH) + " ,"); sqlCommand.Append(BindValue(source.PAY_OTHER) + " ,"); sqlCommand.Append("'" + BindValue(source.RECEIVE_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.INVOICE_TYPE) + "' ,"); sqlCommand.Append(BindValue(source.INVOICE_RECEIVE_BEFORE_VAT) + " ,"); sqlCommand.Append(BindValue(source.INVOICE_RECEIVE_VAT) + " ,"); sqlCommand.Append(BindValue(source.SENDING_FLAG) + " ,"); sqlCommand.Append("'" + BindValue(source.SENDING_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.SENDING_NO) + "' ,"); sqlCommand.Append(BindValue(source.SENDING_DATE) + ","); sqlCommand.Append(BindValue(source.DONATE_FLAG) + " ,"); sqlCommand.Append("'" + BindValue(source.DONATE_NO) + "' ,"); sqlCommand.Append(BindValue(source.PREMIUM_AMOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.PLAN_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.FUND_CODE) + "' )"); return(sqlCommand.ToString()); }