public static String ConcreateInsertCommand(APPR_RECEIVE_DETAIL_D source) { StringBuilder sqlCommand = new StringBuilder("INSERT INTO APPR_RECEIVE_DETAIL_D "); sqlCommand.Append(" (BRANCH_NO,DOC_TYPE,DOC_NO,DOC_DATE,SEQUENCE,PAYMENT_GROUP,PAYMENT_CODE,REFER_NO,REFER_DATE,AMOUNT,USER_ID,DATE_UPDATE,TIME_UPDATE,DESCRIPTION,STATUS,FLAG_RECEIVE,RECEIVE_DATE,SLIP_NO,SLIP_DATE,ACCOUNT_CODE,RETURN_FLAG,RETURN_TYPE,RETURN_NO,RETURN_DATE,SENDING_FLAG,SENDING_TYPE,SENDING_NO,SENDING_DATE,REF_SEQUENCE_NO,SHOW_DOC_DATE)"); sqlCommand.Append(" Values ("); sqlCommand.Append(BindValue(source.BRANCH_NO) + " ,"); sqlCommand.Append("'" + BindValue(source.DOC_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.DOC_NO) + "' ,"); sqlCommand.Append(BindValue(source.DOC_DATE) + " ,"); sqlCommand.Append(BindValue(source.SEQUENCE) + " ,"); sqlCommand.Append("'" + BindValue(source.PAYMENT_GROUP) + "' ,"); sqlCommand.Append("'" + BindValue(source.PAYMENT_CODE) + "' ,"); sqlCommand.Append("'" + BindValue(source.REFER_NO) + "' ,"); sqlCommand.Append(BindValue(source.REFER_DATE) + ","); sqlCommand.Append(BindValue(source.AMOUNT) + " ,"); sqlCommand.Append("'" + BindValue(source.USER_ID) + "' ,"); sqlCommand.Append(BindValue(source.DATE_UPDATE) + ","); sqlCommand.Append("'" + BindValue(source.TIME_UPDATE) + "' ,"); sqlCommand.Append("'" + BindValue(source.DESCRIPTION) + "' ,"); sqlCommand.Append("'" + BindValue(source.STATUS) + "' ,"); sqlCommand.Append(BindValue(source.FLAG_RECEIVE) + " ,"); sqlCommand.Append(BindValue(source.RECEIVE_DATE) + ","); sqlCommand.Append("'" + BindValue(source.SLIP_NO) + "' ,"); sqlCommand.Append(BindValue(source.SLIP_DATE) + ","); sqlCommand.Append("'" + BindValue(source.ACCOUNT_CODE) + "' ,"); sqlCommand.Append(BindValue(source.RETURN_FLAG) + " ,"); sqlCommand.Append("'" + BindValue(source.RETURN_TYPE) + "' ,"); sqlCommand.Append("'" + BindValue(source.RETURN_NO) + "' ,"); sqlCommand.Append(BindValue(source.RETURN_DATE) + ","); 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.REF_SEQUENCE_NO) + " ,"); sqlCommand.Append(BindValue(source.SHOW_DOC_DATE) + ")"); return(sqlCommand.ToString()); }
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); }