private BOL_USAGE_CHARGE_MASTER Cast_USAGE_CHARGE_MASTER(DataRow row)
        {
            BOL_USAGE_CHARGE_MASTER oUSAGE_FEE_MASTER = new BOL_USAGE_CHARGE_MASTER();
            string fee_master = row["FEE_STRUCTURE"].ToString().Trim();

            switch (fee_master)
            {
            case "基本契約":
                oUSAGE_FEE_MASTER.FEE_STRUCTURE = "BASIC";
                break;

            case "オプション":
                oUSAGE_FEE_MASTER.FEE_STRUCTURE = "OPTION";
                break;

            case "サービスデスク":
                oUSAGE_FEE_MASTER.FEE_STRUCTURE = "SD";
                break;

            default:
                oUSAGE_FEE_MASTER.FEE_STRUCTURE = null;
                break;
            }
            //oUSAGE_FEE_MASTER.FEE_STRUCTURE = row["FEE_STRUCTURE"].ToString();
            oUSAGE_FEE_MASTER.CONTRACT_CODE = row["CONTRACT_CODE"].ToString().Trim();
            oUSAGE_FEE_MASTER.CONTRACT_NAME = row["CONTRACT_NAME"].ToString().Trim();
            oUSAGE_FEE_MASTER.CONTRACT_QTY  = Utility_Component.dtColumnToInt(row["CONTRACT_QTY"].ToString().Trim());
            oUSAGE_FEE_MASTER.CONTRACT_UNIT = row["CONTRACT_UNIT"].ToString().Trim();
            oUSAGE_FEE_MASTER.ADOPTION_DATE = Utility_Component.dtColumnToDateTime(row["ADOPTION_DATE"].ToString().Trim());
            oUSAGE_FEE_MASTER.INITIAL_COST  = Utility_Component.dtColumnToDecimal(row["INITIAL_COST"].ToString().Trim());
            oUSAGE_FEE_MASTER.MONTHLY_COST  = Utility_Component.dtColumnToDecimal(row["MONTHLY_COST"].ToString().Trim());

            string input_type = row["INPUT_TYPE"].ToString();

            switch (input_type)
            {
            case "選択":
                oUSAGE_FEE_MASTER.INPUT_TYPE = 1;
                break;

            case "数量":
                oUSAGE_FEE_MASTER.INPUT_TYPE = 2;
                break;

            default:
                oUSAGE_FEE_MASTER.INPUT_TYPE = null;
                break;
            }

            //oUSAGE_FEE_MASTER.INPUT_TYPE = Utility_Component.dtColumnToInt(row["INPUT_TYPE"].ToString());
            oUSAGE_FEE_MASTER.NUMBER_DEFAULT = Utility_Component.dtColumnToInt(row["NUMBER_DEFAULT"].ToString());
            oUSAGE_FEE_MASTER.MEMO           = row["MEMO"].ToString();
            oUSAGE_FEE_MASTER.DISPLAY_ORDER  = Utility_Component.dtColumnToInt(row["DISPLAY_ORDER"].ToString());
            oUSAGE_FEE_MASTER.UPDATED_AT     = row["UPDATED_AT"].ToString().Length >= 1 ? row["UPDATED_AT"].ToString() : null;
            oUSAGE_FEE_MASTER.UPDATED_AT_RAW = row["UPDATED_AT_RAW"].ToString() == "" ? null : row["UPDATED_AT_RAW"].ToString();
            oUSAGE_FEE_MASTER.UPDATED_BY     = row["UPDATED_BY"].ToString().Length >= 1 ? row["UPDATED_BY"].ToString() : null;

            return(oUSAGE_FEE_MASTER);
        }
        private BOL_CUSTOMER_MASTER Cast_CUSTOMER_MASTER(DataRow row)
        {
            BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER();

            oCUSTOMER_MASTER.CONTRACT_DATE             = Utility_Component.dtColumnToDateTime(row["CONTRACT_DATE"].ToString());
            oCUSTOMER_MASTER.SPECIAL_NOTES_1           = row["SPECIAL_NOTES_1"].ToString();
            oCUSTOMER_MASTER.SPECIAL_NOTES_2           = row["SPECIAL_NOTES_2"].ToString();
            oCUSTOMER_MASTER.SPECIAL_NOTES_3           = row["SPECIAL_NOTES_3"].ToString();
            oCUSTOMER_MASTER.SPECIAL_NOTES_4           = row["SPECIAL_NOTES_4"].ToString();
            oCUSTOMER_MASTER.NCS_CUSTOMER_CODE         = row["NCS_CUSTOMER_CODE"].ToString();
            oCUSTOMER_MASTER.BILL_BILLING_INTERVAL     = Utility_Component.dtColumnToInt(row["BILL_BILLING_INTERVAL"].ToString());
            oCUSTOMER_MASTER.BILL_DEPOSIT_RULES        = Utility_Component.dtColumnToInt(row["BILL_DEPOSIT_RULES"].ToString());
            oCUSTOMER_MASTER.BILL_TRANSFER_FEE         = Utility_Component.dtColumnToDecimal(row["BILL_TRANSFER_FEE"].ToString());
            oCUSTOMER_MASTER.BILL_EXPENSES             = Utility_Component.dtColumnToDecimal(row["BILL_EXPENSES"].ToString());
            oCUSTOMER_MASTER.COMPANY_NAME_CHANGED_DATE = Utility_Component.dtColumnToDateTime(row["COMPANY_NAME_CHANGED_DATE"].ToString());
            oCUSTOMER_MASTER.PREVIOUS_COMPANY_NAME     = row["PREVIOUS_COMPANY_NAME"].ToString();
            oCUSTOMER_MASTER.OBOEGAKI_DATE             = Utility_Component.dtColumnToDateTime(row["OBOEGAKI_DATE"].ToString());
            return(oCUSTOMER_MASTER);
        }
        private BOL_CUSTOMER_MASTER Cast_CUSTOMER_MASTER(DataRow row)
        {
            BOL_CUSTOMER_MASTER oCUSTOMER_MASTER = new BOL_CUSTOMER_MASTER();

            oCUSTOMER_MASTER.COMPANY_NO_BOX = row["COMPANY_NO_BOX"].ToString().Trim();

            string transaction_type = row["TRANSACTION_TYPE"].ToString().Trim();

            switch (transaction_type)
            {
            case "要元":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 1;
                break;

            case "サプライヤ":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 2;
                break;

            case "納代":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 3;
                break;

            case "生産情報閲覧":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 4;
                break;

            case "SI":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 11;
                break;

            case "SOL":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 12;
                break;

            case "その他":
                oCUSTOMER_MASTER.TRANSACTION_TYPE = 19;
                break;
            }
            oCUSTOMER_MASTER.EFFECTIVE_DATE     = (DateTime)Utility_Component.dtColumnToDateTime(row["EFFECTIVE_DATE"].ToString().Trim());
            oCUSTOMER_MASTER.ORG_EFFECTIVE_DATE = Utility_Component.dtColumnToDateTime(row["ORG_EFFECTIVE_DATE"].ToString().Trim());
            oCUSTOMER_MASTER.CONTRACT_DATE      = Utility_Component.dtColumnToDateTime(row["CONTRACT_DATE"].ToString().Trim());
            oCUSTOMER_MASTER.SPECIAL_NOTES_1    = row["SPECIAL_NOTES_1"].ToString().Trim();
            oCUSTOMER_MASTER.SPECIAL_NOTES_2    = row["SPECIAL_NOTES_2"].ToString().Trim();
            oCUSTOMER_MASTER.SPECIAL_NOTES_3    = row["SPECIAL_NOTES_3"].ToString().Trim();
            oCUSTOMER_MASTER.SPECIAL_NOTES_4    = row["SPECIAL_NOTES_4"].ToString().Trim();
            oCUSTOMER_MASTER.NCS_CUSTOMER_CODE  = row["NCS_CUSTOMER_CODE"].ToString().Trim();

            string billingInterval = row["BILL_BILLING_INTERVAL"].ToString();

            switch (billingInterval)
            {
            case "月額":
                oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 1;
                break;

            case "四半期":
                oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 2;
                break;

            case "半期":
                oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 3;
                break;

            case "年額":
                oCUSTOMER_MASTER.BILL_BILLING_INTERVAL = 4;
                break;
            }

            string deposit_Rules = row["BILL_DEPOSIT_RULES"].ToString();

            switch (deposit_Rules)
            {
            case "翌月":
                oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 0;
                break;

            case "当月":
                oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 1;
                break;

            case "翌々月月頭":
                oCUSTOMER_MASTER.BILL_DEPOSIT_RULES = 2;
                break;
            }

            oCUSTOMER_MASTER.BILL_TRANSFER_FEE         = Utility_Component.dtColumnToDecimal(row["BILL_TRANSFER_FEE"].ToString());
            oCUSTOMER_MASTER.BILL_EXPENSES             = Utility_Component.dtColumnToDecimal(row["BILL_EXPENSES"].ToString());
            oCUSTOMER_MASTER.COMPANY_NAME_CHANGED_DATE = Utility_Component.dtColumnToDateTime(row["COMPANY_NAME_CHANGED_DATE"].ToString());
            oCUSTOMER_MASTER.PREVIOUS_COMPANY_NAME     = row["PREVIOUS_COMPANY_NAME"].ToString();
            oCUSTOMER_MASTER.OBOEGAKI_DATE             = Utility_Component.dtColumnToDateTime(row["OBOEGAKI_DATE"].ToString());
            oCUSTOMER_MASTER.UPDATED_AT     = row["UPDATED_AT"].ToString().Length >= 1 ? row["UPDATED_AT"].ToString() : null;
            oCUSTOMER_MASTER.UPDATED_AT_RAW = row["UPDATED_AT_RAW"].ToString() == "" ? null : row["UPDATED_AT_RAW"].ToString();
            oCUSTOMER_MASTER.UPDATED_BY     = row["UPDATED_BY"].ToString().Length >= 1 ? row["UPDATED_BY"].ToString() : null;
            oCUSTOMER_MASTER.REQ_SEQ        = Utility_Component.dtColumnToInt(row["REQ_SEQ"].ToString());
            return(oCUSTOMER_MASTER);
        }
Exemplo n.º 4
0
        protected void seperateAmigo_NonAmigo()
        {
            CUSTOMER_MASTER oCust      = new CUSTOMER_MASTER(Properties.Settings.Default.MyConnection);
            string          run_date   = DateTime.Now.ToString();
            DataTable       dtCustomer = oCust.getBillBankAccounts();

            for (int i = 0; i < dtUploadData.Rows.Count; i++)
            {
                string strCustomerName = (dtUploadData.Rows[i]["CUSTOMER_NAME"] != null ? dtUploadData.Rows[i]["CUSTOMER_NAME"].ToString().Trim() : "");
                var    query           = dtCustomer.AsEnumerable().Where
                                             (r => (r.Field <string>("BILL_BANK_ACCOUNT_NAME-1") == null ? "" : r.Field <string>("BILL_BANK_ACCOUNT_NAME-1").Trim()) == strCustomerName ||
                                             (r.Field <string>("BILL_BANK_ACCOUNT_NAME-2") == null ? "" : r.Field <string>("BILL_BANK_ACCOUNT_NAME-2").Trim()) == strCustomerName ||
                                             (r.Field <string>("BILL_BANK_ACCOUNT_NAME-3") == null ? "" : r.Field <string>("BILL_BANK_ACCOUNT_NAME-3").Trim()) == strCustomerName ||
                                             (r.Field <string>("BILL_BANK_ACCOUNT_NAME-4") == null ? "" : r.Field <string>("BILL_BANK_ACCOUNT_NAME-4").Trim()) == strCustomerName
                                             );
                if (query.Any()) //Amigo
                {
                    BOL_RECEIPT_DETAILS oReceipt = new BOL_RECEIPT_DETAILS();

                    oReceipt.DATA_CLASS                   = 1;
                    oReceipt.RECORD_CLASS                 = (dtUploadData.Rows[i]["RECORD_CLASS"] != null ? dtUploadData.Rows[i]["RECORD_CLASS"].ToString() : "");
                    oReceipt.TRANSACTION_DATE             = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["TRANSACTION_DATE"] != null ? dtUploadData.Rows[i]["TRANSACTION_DATE"].ToString() : "");
                    oReceipt.TRANSACTION_CONTACT_NAME     = (dtUploadData.Rows[i]["TRANSACTION_CONTACT_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_CONTACT_NAME"].ToString() : "");
                    oReceipt.TRANSACTION_BANKS_NAME       = (dtUploadData.Rows[i]["TRANSACTION_BANKS_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_BANKS_NAME"].ToString() : "");
                    oReceipt.TRANSACTION_BRANCH_NAME      = (dtUploadData.Rows[i]["TRANSACTION_BRANCH_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_BRANCH_NAME"].ToString() : "");
                    oReceipt.TRANSACTION_ACCOUNT_NO_CLASS = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO_CLASS"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO_CLASS"].ToString() : "");
                    oReceipt.TRANSACTION_ACCOUNT_TYPE     = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_TYPE"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_TYPE"].ToString() : "");
                    oReceipt.TRANSACTION_ACCOUNT_NO       = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO"].ToString() : "");
                    oReceipt.RESEND_INDICATION            = (dtUploadData.Rows[i]["RESEND_INDICATION"] != null ? dtUploadData.Rows[i]["RESEND_INDICATION"].ToString() : "");
                    oReceipt.TRANSACTION_NAME             = (dtUploadData.Rows[i]["TRANSACTION_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_NAME"].ToString() : "");
                    oReceipt.TRANSACTION_NO               = (dtUploadData.Rows[i]["TRANSACTION_NO"] != null ? dtUploadData.Rows[i]["TRANSACTION_NO"].ToString() : "");
                    oReceipt.TRANSACTION_DETAIL_CLASS     = (dtUploadData.Rows[i]["TRANSACTION_DETAIL_CLASS"] != null ? dtUploadData.Rows[i]["TRANSACTION_DETAIL_CLASS"].ToString() : "");
                    oReceipt.HANDLING_DATE                = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["HANDLING_DATE"] != null ? dtUploadData.Rows[i]["HANDLING_DATE"].ToString() : "");
                    oReceipt.DEPOSIT_DATE                 = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["DEPOSIT_DATE"] != null ? dtUploadData.Rows[i]["DEPOSIT_DATE"].ToString() : "");
                    oReceipt.DEPOSIT_AMOUNT               = Utility_Component.dtColumnToDecimal(dtUploadData.Rows[i]["DEPOSIT_AMOUNT"] != null ? dtUploadData.Rows[i]["DEPOSIT_AMOUNT"].ToString() : "");
                    oReceipt.CHECK_CLASS                  = (dtUploadData.Rows[i]["CHECK_CLASS"] != null ? dtUploadData.Rows[i]["CHECK_CLASS"].ToString() : "");
                    oReceipt.CUSTOMER_NAME                = (dtUploadData.Rows[i]["CUSTOMER_NAME"] != null ? dtUploadData.Rows[i]["CUSTOMER_NAME"].ToString() : "");
                    oReceipt.COLLECTION_NO_SHEETS         = Utility_Component.dtColumnToInt(dtUploadData.Rows[i]["COLLECTION_NO_SHEETS"] != null ? dtUploadData.Rows[i]["COLLECTION_NO_SHEETS"].ToString() : "");
                    oReceipt.COLLECTION_NO                = (dtUploadData.Rows[i]["COLLECTION_NO"] != null ? dtUploadData.Rows[i]["COLLECTION_NO"].ToString() : "");
                    oReceipt.CUSTOMER_NO                  = (dtUploadData.Rows[i]["CUSTOMER_NO"] != null ? dtUploadData.Rows[i]["CUSTOMER_NO"].ToString() : "");
                    oReceipt.BANK_NAME             = (dtUploadData.Rows[i]["BANK_NAME"] != null ? dtUploadData.Rows[i]["BANK_NAME"].ToString() : "");
                    oReceipt.BRANCH_NAME           = (dtUploadData.Rows[i]["BRANCH_NAME"] != null ? dtUploadData.Rows[i]["BRANCH_NAME"].ToString() : "");
                    oReceipt.TRANSACTION_FILE_NAME = (dtUploadData.Rows[i]["TRANSACTION_FILE_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_FILE_NAME"].ToString() : "");
                    oReceipt.TRANSFER_MESSAGE      = (dtUploadData.Rows[i]["TRANSFER_MESSAGE"] != null ? dtUploadData.Rows[i]["TRANSFER_MESSAGE"].ToString() : "");
                    oReceipt.NOTE                      = (dtUploadData.Rows[i]["NOTE"] != null ? dtUploadData.Rows[i]["NOTE"].ToString() : "");
                    oReceipt.NUMBER                    = (!String.IsNullOrEmpty(dtUploadData.Rows[i]["NUMBER"].ToString()) ? int.Parse(dtUploadData.Rows[i]["NUMBER"].ToString()) : 0);
                    oReceipt.RUN_DATE_TIME             = run_date;
                    oReceipt.RUN_RESULT                = 1;
                    oReceipt.DATA_MOVEMENT_INFORMATION = "";
                    oReceipt.PAYMENT_DAY               = null;
                    oReceipt.TYPE_OF_ALLOCATION        = 0;
                    oReceipt.ALLOCATED_QUANTITY        = 0;
                    oReceipt.ALLOCATED_MONEY           = 0;
                    oReceipt.ALLOCATED_COMPLETION_DATE = null;

                    lstAmigo.Add(oReceipt);
                }
                else //Non Amigo
                {
                    BOL_RECEIPT_DETAILS_NON_AMIGO oReceipt_NonAmigo = new BOL_RECEIPT_DETAILS_NON_AMIGO();
                    oReceipt_NonAmigo.DATA_CLASS                   = 1;
                    oReceipt_NonAmigo.RECORD_CLASS                 = (dtUploadData.Rows[i]["RECORD_CLASS"] != null ? dtUploadData.Rows[i]["RECORD_CLASS"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_DATE             = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["TRANSACTION_DATE"] != null ? dtUploadData.Rows[i]["TRANSACTION_DATE"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_CONTACT_NAME     = (dtUploadData.Rows[i]["TRANSACTION_CONTACT_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_CONTACT_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_BANKS_NAME       = (dtUploadData.Rows[i]["TRANSACTION_BANKS_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_BANKS_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_BRANCH_NAME      = (dtUploadData.Rows[i]["TRANSACTION_BRANCH_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_BRANCH_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_ACCOUNT_NO_CLASS = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO_CLASS"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO_CLASS"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_ACCOUNT_TYPE     = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_TYPE"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_TYPE"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_ACCOUNT_NO       = (dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO"] != null ? dtUploadData.Rows[i]["TRANSACTION_ACCOUNT_NO"].ToString() : "");
                    oReceipt_NonAmigo.RESEND_INDICATION            = (dtUploadData.Rows[i]["RESEND_INDICATION"] != null ? dtUploadData.Rows[i]["RESEND_INDICATION"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_NAME             = (dtUploadData.Rows[i]["TRANSACTION_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_NO               = (dtUploadData.Rows[i]["TRANSACTION_NO"] != null ? dtUploadData.Rows[i]["TRANSACTION_NO"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_DETAIL_CLASS     = (dtUploadData.Rows[i]["TRANSACTION_DETAIL_CLASS"] != null ? dtUploadData.Rows[i]["TRANSACTION_DETAIL_CLASS"].ToString() : "");
                    oReceipt_NonAmigo.HANDLING_DATE                = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["HANDLING_DATE"] != null ? dtUploadData.Rows[i]["HANDLING_DATE"].ToString() : "");
                    oReceipt_NonAmigo.DEPOSIT_DATE                 = Utility_Component.dtColumnToDateTime(dtUploadData.Rows[i]["DEPOSIT_DATE"] != null ? dtUploadData.Rows[i]["DEPOSIT_DATE"].ToString() : "");
                    oReceipt_NonAmigo.DEPOSIT_AMOUNT               = Utility_Component.dtColumnToDecimal(dtUploadData.Rows[i]["DEPOSIT_AMOUNT"] != null ? dtUploadData.Rows[i]["DEPOSIT_AMOUNT"].ToString() : "");
                    oReceipt_NonAmigo.CHECK_CLASS                  = (dtUploadData.Rows[i]["CHECK_CLASS"] != null ? dtUploadData.Rows[i]["CHECK_CLASS"].ToString() : "");
                    oReceipt_NonAmigo.CUSTOMER_NAME                = (dtUploadData.Rows[i]["CUSTOMER_NAME"] != null ? dtUploadData.Rows[i]["CUSTOMER_NAME"].ToString() : "");
                    oReceipt_NonAmigo.COLLECTION_NO_SHEETS         = Utility_Component.dtColumnToInt(dtUploadData.Rows[i]["COLLECTION_NO_SHEETS"] != null ? dtUploadData.Rows[i]["COLLECTION_NO_SHEETS"].ToString() : "");
                    oReceipt_NonAmigo.COLLECTION_NO                = (dtUploadData.Rows[i]["COLLECTION_NO"] != null ? dtUploadData.Rows[i]["COLLECTION_NO"].ToString() : "");
                    oReceipt_NonAmigo.CUSTOMER_NO                  = (dtUploadData.Rows[i]["CUSTOMER_NO"] != null ? dtUploadData.Rows[i]["CUSTOMER_NO"].ToString() : "");
                    oReceipt_NonAmigo.BANK_NAME             = (dtUploadData.Rows[i]["BANK_NAME"] != null ? dtUploadData.Rows[i]["BANK_NAME"].ToString() : "");
                    oReceipt_NonAmigo.BRANCH_NAME           = (dtUploadData.Rows[i]["BRANCH_NAME"] != null ? dtUploadData.Rows[i]["BRANCH_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSACTION_FILE_NAME = (dtUploadData.Rows[i]["TRANSACTION_FILE_NAME"] != null ? dtUploadData.Rows[i]["TRANSACTION_FILE_NAME"].ToString() : "");
                    oReceipt_NonAmigo.TRANSFER_MESSAGE      = (dtUploadData.Rows[i]["TRANSFER_MESSAGE"] != null ? dtUploadData.Rows[i]["TRANSFER_MESSAGE"].ToString() : "");
                    oReceipt_NonAmigo.NOTE   = (dtUploadData.Rows[i]["NOTE"] != null ? dtUploadData.Rows[i]["NOTE"].ToString() : "");
                    oReceipt_NonAmigo.NUMBER = (!String.IsNullOrEmpty(dtUploadData.Rows[i]["NUMBER"].ToString()) ? int.Parse(dtUploadData.Rows[i]["NUMBER"].ToString()) : 0);

                    oReceipt_NonAmigo.RUN_DATE_TIME             = run_date;
                    oReceipt_NonAmigo.RUN_RESULT                = 99;
                    oReceipt_NonAmigo.DATA_MOVEMENT_INFORMATION = "";
                    oReceipt_NonAmigo.PAYMENT_DAY               = null;
                    oReceipt_NonAmigo.TYPE_OF_ALLOCATION        = 0;
                    oReceipt_NonAmigo.ALLOCATED_QUANTITY        = 0;
                    oReceipt_NonAmigo.ALLOCATED_MONEY           = 0;
                    oReceipt_NonAmigo.ALLOCATED_COMPLETION_DATE = null;
                    lstNonAmigo.Add(oReceipt_NonAmigo);
                }
            }
        }
Exemplo n.º 5
0
        public string CreateInvoiceData(string BILLING_DATE, string status)
        {
            string errorStatus = "";

            using (TransactionScope dbTxn = new TransactionScope())
            {
                try
                {
                    int      OFFSET     = 0;
                    int      LIMIT      = 0;
                    String   strMessage = "";
                    int      TOTAL;
                    int      countForInsert   = 0;
                    string   checkGetOrCreate = "CREATE";
                    DateTime yearMonth        = Convert.ToDateTime(BILLING_DATE);
                    String   YEAR_MONTH       = yearMonth.ToString("yyyyMM");

                    if (InvoiceAllocationAmountCheck(BILLING_DATE))
                    {
                        errorStatus = "3";
                        return(errorStatus);
                    }

                    if (status == "1")
                    {
                        //delete Existing Invoice List
                        bool checkDelete = HandleDelete(BILLING_DATE);
                        if (!checkDelete)
                        {
                            errorStatus = "0";
                            return(errorStatus);
                        }
                    }

                    //Select Invoice Data
                    INVOICE_INFO DAL_INVOICE_INFO = new INVOICE_INFO(con);
                    DataTable    dt = DAL_INVOICE_INFO.GetInvoiceList(YEAR_MONTH, OFFSET, LIMIT, checkGetOrCreate, out strMessage, out TOTAL);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        decimal Key_source_Monthly_usage_fee_REQ_SEQ = 0;
                        decimal Supplier_Initial_expense_REQ_SEQ     = 0;
                        decimal Supplier_Monthly_usage_fee_REQ_SEQ   = 0;
                        decimal Production_information_browsing_Initial_expense_REQ_SEQ = 0;
                        decimal View_production_information_Annual_usage_fee_REQ_SEQ    = 0;

                        DataRow row = dt.Rows[i];

                        if (!string.IsNullOrEmpty(row["Key_source_Monthly_usage_fee"].ToString()))
                        {
                            Key_source_Monthly_usage_fee_REQ_SEQ = Convert.ToDecimal(row["Key_source_Monthly_usage_fee"].ToString());
                        }

                        if (!string.IsNullOrEmpty(row["Supplier_Initial_expense"].ToString()))
                        {
                            Supplier_Initial_expense_REQ_SEQ = Convert.ToDecimal(row["Supplier_Initial_expense"].ToString());
                        }

                        if (!string.IsNullOrEmpty(row["Supplier_Monthly_usage_fee"].ToString()))
                        {
                            Supplier_Monthly_usage_fee_REQ_SEQ = Convert.ToDecimal(row["Supplier_Monthly_usage_fee"].ToString());
                        }

                        if (!string.IsNullOrEmpty(row["Production_information_browsing_Initial_expense"].ToString()))
                        {
                            Production_information_browsing_Initial_expense_REQ_SEQ = Convert.ToDecimal(row["Production_information_browsing_Initial_expense"].ToString());
                        }

                        if (!string.IsNullOrEmpty(row["Viewing_production_information_Annual_usage_fee"].ToString()))
                        {
                            View_production_information_Annual_usage_fee_REQ_SEQ = Convert.ToDecimal(row["Viewing_production_information_Annual_usage_fee"].ToString());
                        }

                        BOL_INVOICE_INFO oINVOICE_INFO = new BOL_INVOICE_INFO();

                        #region Set value in Model
                        oINVOICE_INFO.COMPANY_NO_BOX = row["COMPANY_NO_BOX"].ToString();

                        oINVOICE_INFO.INVOICE_DATE               = DateTime.Now;
                        oINVOICE_INFO.NCS_CUSTOMER_CODE          = row["NCS_CUSTOMER_CODE"].ToString();
                        oINVOICE_INFO.BILL_SUPPLIER_NAME         = row["BILL_COMPANY_NAME"].ToString();
                        oINVOICE_INFO.BILL_SUPPLIER_NAME_READING = row["COMPANY_NAME_READING"].ToString();
                        oINVOICE_INFO.BILL_COMPANY_NAME          = row["COMPANY_NAME"].ToString();
                        oINVOICE_INFO.BILL_DEPARTMENT_IN_CHARGE  = row["BILL_DEPARTMENT_IN_CHARGE"].ToString();
                        oINVOICE_INFO.BILL_CONTACT_NAME          = row["BILL_CONTACT_NAME"].ToString();
                        oINVOICE_INFO.BILL_HONORIFIC             = "様";
                        oINVOICE_INFO.BILL_POSTAL_CODE           = row["BILL_POSTAL_CODE"].ToString();
                        oINVOICE_INFO.BILL_ADDRESS               = row["BILL_ADDRESS"].ToString();
                        oINVOICE_INFO.BILL_ADDRESS_2             = row["BILL_ADDRESS_BUILDING"].ToString();

                        string CONTRACT_PLAN = row["CONTRACT_PLAN"].ToString();
                        if (CONTRACT_PLAN == "SERVER")
                        {
                            oINVOICE_INFO.PLAN_SERVER       = 1;
                            oINVOICE_INFO.PLAN_SERVER_LIGHT = 0;
                            oINVOICE_INFO.PLAN_BROWSER_AUTO = 0;
                            oINVOICE_INFO.PLAN_BROWSER      = 0;
                        }
                        if (CONTRACT_PLAN == "SERVERRIGHT")
                        {
                            oINVOICE_INFO.PLAN_SERVER       = 0;
                            oINVOICE_INFO.PLAN_SERVER_LIGHT = 1;
                            oINVOICE_INFO.PLAN_BROWSER_AUTO = 0;
                            oINVOICE_INFO.PLAN_BROWSER      = 0;
                        }
                        if (CONTRACT_PLAN == "BROWSERAUTO")
                        {
                            oINVOICE_INFO.PLAN_SERVER       = 0;
                            oINVOICE_INFO.PLAN_SERVER_LIGHT = 0;
                            oINVOICE_INFO.PLAN_BROWSER_AUTO = 1;
                            oINVOICE_INFO.PLAN_BROWSER      = 0;
                        }
                        if (CONTRACT_PLAN == "BROWSER")
                        {
                            oINVOICE_INFO.PLAN_SERVER       = 0;
                            oINVOICE_INFO.PLAN_SERVER_LIGHT = 0;
                            oINVOICE_INFO.PLAN_BROWSER_AUTO = 0;
                            oINVOICE_INFO.PLAN_BROWSER      = 1;
                        }
                        if (CONTRACT_PLAN == "PRODUCT")
                        {
                            oINVOICE_INFO.PLAN_SERVER       = 0;
                            oINVOICE_INFO.PLAN_SERVER_LIGHT = 0;
                            oINVOICE_INFO.PLAN_BROWSER_AUTO = 0;
                            oINVOICE_INFO.PLAN_BROWSER      = 0;
                        }


                        oINVOICE_INFO.PLAN_AMIGO_CAI        = Utility_Component.dtColumnToInt(row["OP_AMIGO_CAI"].ToString());
                        oINVOICE_INFO.PLAN_AMIGO_BIZ        = Utility_Component.dtColumnToInt(row["OP_AMIGO_BIZ"].ToString());
                        oINVOICE_INFO.PLAN_ADD_BOX_SERVER   = Utility_Component.dtColumnToInt(row["OP_BOX_SERVER"].ToString());
                        oINVOICE_INFO.PLAN_ADD_BOX_BROWSER  = Utility_Component.dtColumnToInt(row["OP_BOX_BROWSER"].ToString());
                        oINVOICE_INFO.PLAN_OP_FLAT          = Utility_Component.dtColumnToInt(row["OP_FLAT"].ToString());
                        oINVOICE_INFO.PLAN_OP_SSL           = Utility_Component.dtColumnToInt(row["OP_CLIENT"].ToString());
                        oINVOICE_INFO.PLAN_OP_BASIC_SERVICE = Utility_Component.dtColumnToInt(row["OP_BASIC_SERVICE"].ToString());
                        oINVOICE_INFO.PLAN_OP_ADD_SERVICE   = Utility_Component.dtColumnToInt(row["OP_ADD_SERVICE"].ToString());

                        if (row["SOCIOS_USER_FLG"].ToString() == " ")
                        {
                            oINVOICE_INFO.PLAN_OP_SOCIOS = 0;
                        }
                        if (row["SOCIOS_USER_FLG"].ToString() == "*")
                        {
                            oINVOICE_INFO.PLAN_OP_SOCIOS = 1;
                        }
                        oINVOICE_INFO.BILL_DEPOSIT_RULES = row["BILL_DEPOSIT_RULES"].ToString();

                        oINVOICE_INFO.BILL_TRANSFER_FEE = Utility_Component.dtColumnToDecimal(row["BILL_TRANSFER_FEE"].ToString());
                        oINVOICE_INFO.BILL_EXPENSES     = Utility_Component.dtColumnToDecimal(row["BILL_EXPENSES"].ToString());

                        DateTime date            = Convert.ToDateTime(BILLING_DATE);
                        var      lastDateOfMonth = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)).ToString("dd");
                        var      lastDay         = new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)).DayOfWeek;
                        var      BILL_DATE       = BILLING_DATE + "/" + lastDateOfMonth;
                        DateTime PaymentDay      = Convert.ToDateTime(BILL_DATE);
                        string   strPaymentDay   = "";
                        if (lastDay.ToString() == "Saturday")
                        {
                            strPaymentDay = PaymentDay.AddDays(-1).ToString();
                        }
                        if (lastDay.ToString() == "Sunday")
                        {
                            strPaymentDay = PaymentDay.AddDays(-2).ToString();
                        }
                        if (lastDay.ToString() != "Saturday" && lastDay.ToString() != "Sunday")
                        {
                            strPaymentDay = PaymentDay.ToString();
                        }

                        oINVOICE_INFO.BILL_PAYMENT_DATE          = Utility_Component.dtColumnToDateTime(strPaymentDay);
                        oINVOICE_INFO.STATUS_PRINT               = null;
                        oINVOICE_INFO.STATUS_MEMO                = null;
                        oINVOICE_INFO.STATUS_SEND                = null;
                        oINVOICE_INFO.STATUS_MAIL_DATE           = null; //declare check
                        oINVOICE_INFO.STATUS_ACC_RECEIVABLE_DATE = null;
                        oINVOICE_INFO.STATUS_INVOCE_COPY_DATE    = null;
                        oINVOICE_INFO.STATUS_ACTUAL_MDB_UPDATE   = null;
                        oINVOICE_INFO.STATUS_ACTUAL_DEPOSIT_YYMM = null;
                        oINVOICE_INFO.STATUS_ACTUAL_DEPOSIT_DATE = null;
                        oINVOICE_INFO.STATUS_CASH_FORECAST_MM    = null;

                        //need to change set value
                        string depositRuleCheck = row["BILL_DEPOSIT_RULES"].ToString();
                        if (depositRuleCheck == "0")
                        {
                            oINVOICE_INFO.STATUS_PLAN_DEPOSIT_YYMM = date.AddMonths(1).ToString("yyMM");
                        }
                        if (depositRuleCheck == "1")
                        {
                            oINVOICE_INFO.STATUS_PLAN_DEPOSIT_YYMM = date.ToString("yyMM");
                        }
                        if (depositRuleCheck == "2")
                        {
                            oINVOICE_INFO.STATUS_PLAN_DEPOSIT_YYMM = date.AddMonths(2).ToString("yyMM");
                        }

                        //oINVOICE_INFO.STATUS_PLAN_DEPOSIT_YYMM = row["BILL_SUPPLIER_NAME"].ToString();
                        oINVOICE_INFO.STATUS_PAY_NOTICE_DATE    = null;
                        oINVOICE_INFO.TYPE_OF_ALLOCATION        = 0;
                        oINVOICE_INFO.ALLOCATION_TOTAL_AMOUNT   = 0;
                        oINVOICE_INFO.ALLOCATED_COMPLETION_DATE = null;
                        oINVOICE_INFO.DUNNING_COUNT             = 0;
                        oINVOICE_INFO.DUNNING_DATE     = null;
                        oINVOICE_INFO.ANSWER_DATE      = null;
                        oINVOICE_INFO.PAYMENT_DUE_DATE = null;
                        oINVOICE_INFO.ANSWER_MEMO      = null;
                        oINVOICE_INFO.SPECIAL_NOTES_1  = null;
                        oINVOICE_INFO.SPECIAL_NOTES_2  = null;
                        oINVOICE_INFO.SPECIAL_NOTES_3  = null;
                        oINVOICE_INFO.SPECIAL_NOTES_4  = null;

                        #endregion

                        if (Key_source_Monthly_usage_fee_REQ_SEQ > 0)
                        {
                            string TRANSACTION_TYPE = "12";
                            oINVOICE_INFO.TRANSACTION_TYPE = TRANSACTION_TYPE;
                            oINVOICE_INFO.YEAR_MONTH       = "-" + yearMonth.ToString("yyMM");
                            oINVOICE_INFO.BILL_AMOUNT      = Utility_Component.dtColumnToDecimal(row["Key_source_Monthly_usage_fee"].ToString());
                            oINVOICE_INFO.BILL_TAX         = Utility_Component.dtColumnToDecimal(row["Key_source_Monthly_usage_fee_TAX"].ToString());
                            oINVOICE_INFO.BILL_PRICE       = Utility_Component.dtColumnToDecimal(row["Key_source_Monthly_usage_fee_INCLUDING_TAX"].ToString());

                            //Insert InvoiceData
                            DAL_INVOICE_INFO.InsertInvoiceInfo(oINVOICE_INFO, out strMessage);
                            countForInsert++;
                        }

                        if (Supplier_Initial_expense_REQ_SEQ > 0)
                        {
                            string TRANSACTION_TYPE = "21";
                            oINVOICE_INFO.TRANSACTION_TYPE = TRANSACTION_TYPE;
                            oINVOICE_INFO.YEAR_MONTH       = "-" + yearMonth.ToString("yyMM") + "IC";
                            oINVOICE_INFO.BILL_AMOUNT      = Utility_Component.dtColumnToDecimal(row["Supplier_Initial_expense"].ToString());
                            oINVOICE_INFO.BILL_TAX         = Utility_Component.dtColumnToDecimal(row["Supplier_Initial_expense_TAX"].ToString());
                            oINVOICE_INFO.BILL_PRICE       = Utility_Component.dtColumnToDecimal(row["Supplier_Initial_expense_INCLUDING_TAX"].ToString());

                            //Insert InvoiceData
                            DAL_INVOICE_INFO.InsertInvoiceInfo(oINVOICE_INFO, out strMessage);
                            countForInsert++;
                        }

                        if (Supplier_Monthly_usage_fee_REQ_SEQ > 0)
                        {
                            string TRANSACTION_TYPE = "22";
                            oINVOICE_INFO.TRANSACTION_TYPE = TRANSACTION_TYPE;
                            oINVOICE_INFO.YEAR_MONTH       = "-" + yearMonth.ToString("yyMM");
                            oINVOICE_INFO.BILL_AMOUNT      = Utility_Component.dtColumnToDecimal(row["Supplier_Monthly_usage_fee"].ToString());
                            oINVOICE_INFO.BILL_TAX         = Utility_Component.dtColumnToDecimal(row["Supplier_Monthly_usage_fee_TAX"].ToString());
                            oINVOICE_INFO.BILL_PRICE       = Utility_Component.dtColumnToDecimal(row["Supplier_Monthly_usage_fee_INCLUDING_TAX"].ToString());

                            //Insert InvoiceData
                            DAL_INVOICE_INFO.InsertInvoiceInfo(oINVOICE_INFO, out strMessage);
                            countForInsert++;
                        }

                        if (Production_information_browsing_Initial_expense_REQ_SEQ > 0 || View_production_information_Annual_usage_fee_REQ_SEQ > 0)
                        {
                            string TRANSACTION_TYPE = "32";
                            oINVOICE_INFO.TRANSACTION_TYPE = TRANSACTION_TYPE;
                            oINVOICE_INFO.YEAR_MONTH       = "-" + yearMonth.ToString("yyMM");
                            oINVOICE_INFO.BILL_AMOUNT      = Utility_Component.dtColumnToDecimal(row["Production_information_browsing_Initial_expense"].ToString()) + Utility_Component.dtColumnToDecimal(row["Viewing_production_information_Annual_usage_fee"].ToString());
                            oINVOICE_INFO.BILL_TAX         = Utility_Component.dtColumnToDecimal(row["Production_information_browsing_Initial_expense_TAX"].ToString()) + Utility_Component.dtColumnToDecimal(row["View_production_information_Annual_usage_fee_TAX"].ToString());
                            oINVOICE_INFO.BILL_PRICE       = Utility_Component.dtColumnToDecimal(row["Production_information_browsing_Initial_expense_INCLUDING_TAX"].ToString()) + Utility_Component.dtColumnToDecimal(row["View_production_information_Annual_usage_fee_INCLUDING_TAX"].ToString());

                            //Insert InvoiceData
                            DAL_INVOICE_INFO.InsertInvoiceInfo(oINVOICE_INFO, out strMessage);
                            countForInsert++;
                        }
                    }

                    if (string.IsNullOrEmpty(strMessage) && countForInsert > 0)
                    {
                        errorStatus = "1," + countForInsert;
                        dbTxn.Complete();
                    }
                    else
                    {
                        errorStatus = "2";
                    }
                }
                catch (Exception ex)
                {
                    errorStatus = "2";
                }
            }
            return(errorStatus);
        }