public IActionResult addCustomer()
        {
            customerTypeModel ct = new customerTypeModel();

            ViewData["cus_type"] = ct.drop_cus_type_code();

            prefixModel px = new prefixModel();

            ViewData["prefix"] = px.drop_prefix("");

            provinceModel pv = new provinceModel();
            ampuresModel  am = new ampuresModel();
            districts     dt = new districts();

            ViewData["province"] = pv.drop_province("");
            ViewData["amphur"]   = am.dorp_amphur("");
            ViewData["district"] = dt.drop_district("");

            conditionPayModel cd = new conditionPayModel();

            ViewData["condition"] = cd.drop_con_pay("");


            lineModel ln = new lineModel();

            ViewData["line"] = ln.drop_line("");

            line_saleModel ls = new line_saleModel();

            ViewData["line_sale"] = ls.drop_line_sale("");

            return(View());
        }
        public IActionResult editcustomer(string cus)
        {
            ViewData["cus_id"] = cus;

            CustomerModel ctm = new CustomerModel();

            ctm.select_customer(" cus_id = '" + cus + "'");
            ViewData["cus_code"]         = ctm.cus_code;
            ViewData["cus_name"]         = ctm.cus_name;
            ViewData["cus_name_contact"] = ctm.cus_name_contact;
            ViewData["cus_trade"]        = ctm.cus_trade;
            ViewData["cus_tax"]          = ctm.cus_tax;

            customerTypeModel ct = new customerTypeModel();

            ViewData["cus_type"] = ct.drop_cus_type_code(ctm.cus_ref_type_id);

            prefixModel px = new prefixModel();

            ViewData["prefix"] = px.drop_prefix(ctm.cus_ref_prefix_id);
            px.select_prefix("prefix_id = '" + ctm.cus_ref_prefix_id + "'");
            ViewData["last_name"] = px.prefix_ending;


            CustomerAddressModel ca = new CustomerAddressModel();

            ca.select_address("add_ref_cus_id = '" + cus + "'");
            ViewData["add_num"]      = ca.add_num;
            ViewData["add_alley"]    = ca.add_alley;
            ViewData["add_road"]     = ca.add_road;
            ViewData["add_postcode"] = ca.add_poscode;
            ViewData["add_status"]   = ca.add_type_status;
            ViewData["add_branch"]   = ca.add_branch;
            ViewData["add_id"]       = ca.add_id;

            provinceModel pv = new provinceModel();
            ampuresModel  am = new ampuresModel();
            districts     dt = new districts();

            ViewData["province"] = pv.drop_province(ca.add_province);
            ViewData["amphur"]   = am.dorp_amphur(ca.add_amphur);
            ViewData["district"] = dt.drop_district(ca.add_district);


            CustomerContactModel c_t = new CustomerContactModel();

            c_t.select_contact("ct_ref_cus_id = '" + cus + "'");
            ViewData["ct_tel"]   = c_t.ct_tel;
            ViewData["ct_fax"]   = c_t.ct_fax;
            ViewData["ct_email"] = c_t.ct_email;
            ViewData["ct_web"]   = c_t.ct_web;
            ViewData["ct_id"]    = c_t.ct_id;


            CustomerCreditModel crd = new CustomerCreditModel();

            crd.select_credit("credit_ref_cus_id = '" + cus + "'");
            ViewData["credit_money"] = crd.credit_money;
            ViewData["credit_id"]    = crd.credit_id;

            conditionPayModel cd = new conditionPayModel();

            ViewData["condition"] = cd.drop_con_pay(crd.credit_ref_condition);


            CustomerLineSaleModel cl = new CustomerLineSaleModel();

            cl.select_cus_line("cs_ref_cus_id = '" + cus + "'");
            ViewData["sale_name"] = cl.cs_sale_name;
            ViewData["sale_id"]   = cl.cs_id;

            lineModel ln = new lineModel();

            ViewData["line"] = ln.drop_line(cl.cs_ref_line_id);

            line_saleModel ls = new line_saleModel();

            ViewData["line_sale"] = ls.drop_line_sale("");


            CustomerTransportModel ts = new CustomerTransportModel();

            ts.select_cus_tran("at_ref_cus_id = '" + cus + "'");
            ViewData["name_ts"]     = ts.at_customer_name;
            ViewData["num_ts"]      = ts.at_num;
            ViewData["alley_ts"]    = ts.at_alley;
            ViewData["road_ts"]     = ts.at_road;
            ViewData["postcode_ts"] = ts.at_postcode;

            ViewData["province_ts"] = pv.drop_province(ts.at_province);
            ViewData["amphur_ts"]   = am.dorp_amphur(ts.at_amphur);
            ViewData["district_ts"] = dt.drop_district(ts.at_district);
            ViewData["ts_id"]       = ts.at_id;


            return(View());
        }