using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OracleClient;
//using NCBEAI.Adapters.Transport;
using System.Xml;

public partial class Business_AddMerchant : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadBusinessClass();
            loadBusinessUnit();
            loadRelationOfficer();
            loadBranch(1);
            loadCity();
            loadpostingMethod();
            txtBranch.Text = ddlBranch.SelectedValue;
            loadBUAcc(ddlBusinessUnit.SelectedValue);
            dateRegDate.date = getDayofMonth(DateTime.Now.Day);
            txtRegDate.Text = getDayofMonth(DateTime.Now.Day);
            // rowParent.Visible = false;
            btnSave.Enabled = false;

            string clID = Request.QueryString["clID"];
            if (!String.IsNullOrWhiteSpace(clID))
            {
               // lblClientNo.Text = clID;
                loadMerchant(clID);
            }   
        }

    }

    private void loadMerchant(string ID)
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "Ecom_Merchant_Reg.get_Merchant_by_Id";

        oracom.Parameters.Add("p_client_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

        oracom.Parameters["p_client_number"].Value = ID;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        oracon.Close();

        //set the data in the controls
       // lblRetailerID.Text = ds.Tables[0].Rows[0]["retailer_id"].ToString();
        ddlRelationshipOfficer.Enabled = true;
        txtRetailName.Text = ds.Tables[0].Rows[0]["retailer_name"].ToString();
        txtRetailNameAr.Text = ds.Tables[0].Rows[0]["retailer_name_ar"].ToString();
        txtRegNo.Text = ds.Tables[0].Rows[0]["registration_number"].ToString();
        //txtIndexNumber.Text = ds.Tables[0].Rows[0]["legal_form"].ToString();
        //ddlLang.SelectedValue = ds.Tables[0].Rows[0]["client_language"].ToString();
        ddlBusinessClass.SelectedValue = ds.Tables[0].Rows[0]["business_class"].ToString();
        //ddlCity.SelectedValue = ds.Tables[0].Rows[0]["city_code"].ToString();
        if (ds.Tables[0].Rows[0]["city_code"].ToString().Length != 0)
            ddlAddressCity.SelectedValue = ds.Tables[0].Rows[0]["city_code"].ToString();
        // txtStreet.Text = ds.Tables[0].Rows[0]["street"].ToString();
        if (ds.Tables[0].Rows[0]["street"].ToString().Length != 0)
            txtEngAdd1.Text = ds.Tables[0].Rows[0]["street"].ToString();
        //ddlProductType.SelectedValue = ds.Tables[0].Rows[0]["product_type"].ToString();
        ddlPostingMethod.SelectedValue = ds.Tables[0].Rows[0]["posting_method"].ToString();
        //ddlSettlMethod.SelectedValue = ds.Tables[0].Rows[0]["settlement_method"].ToString();
        //ddlBusinessUnit.SelectedValue = ds.Tables[0].Rows[0]["business_unit"].ToString();
        ddlRelationshipOfficer.SelectedValue = ds.Tables[0].Rows[0]["relationship_officer"].ToString();
        //txtRetailerID.Text = ds.Tables[0].Rows[0]["retailer_id"].ToString();

        //txtManualAppNo.Text = ds.Tables[0].Rows[0]["manual_application_number"].ToString();
        //CR Merchant
        //txtMerchantContact.Text = ds.Tables[0].Rows[0]["merchant_contact"].ToString();
        dateRegDate.date = ds.Tables[0].Rows[0]["registration_date"].ToString();

        txtRegDate.Text = ds.Tables[0].Rows[0]["registration_date"].ToString();
        //ddlIncomeRange.SelectedValue = ds.Tables[0].Rows[0]["income_range"].ToString();
        txtAccNo.Text = ds.Tables[0].Rows[0]["acct_number"].ToString();


        ViewState["cat_com"] = ds.Tables[0].Rows[0]["cat_commision"].ToString();
    
        ddlBranch.SelectedValue = ds.Tables[0].Rows[0]["branch_no"].ToString();
        
        //txtBranch.Text = ddlBranch.SelectedValue;
        loadBranch(2);
     
        loadAddress(ds);
    }

    private void loadAddress(DataSet ds)
    {
        //set the data in the controls
        txtContactname.Text = ds.Tables[0].Rows[0]["contact_name"].ToString();
        txtPOBox.Text = ds.Tables[0].Rows[0]["po_box"].ToString();
        txtEngAdd1.Text = ds.Tables[0].Rows[0]["english_address1"].ToString();
        txtEngAdd2.Text = ds.Tables[0].Rows[0]["english_address2"].ToString();
        txtEngAdd3.Text = ds.Tables[0].Rows[0]["english_address3"].ToString();

        txtPostCode.Text = ds.Tables[0].Rows[0]["post_code"].ToString();
        ddlAddressCity.SelectedValue = ds.Tables[0].Rows[0]["city"].ToString();
        txtTelWork.Text = ds.Tables[0].Rows[0]["tel_work"].ToString();
        txtTelOther.Text = ds.Tables[0].Rows[0]["tel_other"].ToString();
        txtFax.Text = ds.Tables[0].Rows[0]["fax"].ToString();
        txtMobile.Text = ds.Tables[0].Rows[0]["mobile"].ToString();
        txtMobile2.Text = ds.Tables[0].Rows[0]["mobile_2"].ToString();
        txtMobile3.Text = ds.Tables[0].Rows[0]["mobile_3"].ToString();
        txtEmail.Text = ds.Tables[0].Rows[0]["email_address"].ToString();
        txtEmail2.Text = ds.Tables[0].Rows[0]["email_2"].ToString();
        txtEmail3.Text = ds.Tables[0].Rows[0]["email_3"].ToString();
        //ddlAddressCat.SelectedValue = ds.Tables[0].Rows[0]["address_category"].ToString();

      //  txtTerminalID.Text = ds.Tables[0].Rows[0]["Term_Id"].ToString();
     //   txtTerminalLocation.Text = ds.Tables[0].Rows[0]["Terminal_Location"].ToString();

        }



    protected void btnSave_Click(object sender, EventArgs e)
    {
        //Check proper parent
        //if (checkProperParent())
        //{
        string error = "", ID = ""; //ID = "35377";
        bool saved = addMerchant(ref ID, ref error);
        if (saved)
        {
            //addAddress(ID);
            lblError.Text = "Merchant saved";
            Response.Redirect("UpdateMerchantECOM.aspx?clID=" + ID);
        }
        else
        {
            if (Helper.OracleError(error))
            {
                lblError.Text = "Save Failed";
                ExceptionUtility.LogException(0, "", "", "btnSave_Click", error);
            }
            else
                lblError.Text = error;
        }
        //}
    }

    private bool addMerchant(ref string ID, ref string error)
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "Ecom_Merchant_Reg.Add_eCom_Merchant_Details";

        oracom.Parameters.Add("p_current_uid", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_registration_date", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_account_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_merchant_no", OracleType.Number).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_client_level", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_retailer_name", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_retailer_name_ar", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_registration_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_business_class", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_relationship_officer", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_business_unit", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_branch_cd", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_record_type", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_effective_date", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_address_category", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_contact_name", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_po_box", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_english_address1", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_english_address2", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_english_address3", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_arabic_address1", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_arabic_address2", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_arabic_address3", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_post_code", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_city", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_country", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tel_work", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_tel_other", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_fax", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_mobile", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_mobile_2", OracleType.VarChar).Direction = ParameterDirection.Input;  
        oracom.Parameters.Add("p_mobile_3", OracleType.VarChar).Direction = ParameterDirection.Input;  
        oracom.Parameters.Add("p_email_address", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_email_2", OracleType.VarChar).Direction = ParameterDirection.Input;  
        oracom.Parameters.Add("p_email_3", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_posting_method", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_serial_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_purchase_date", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_model_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_manufacturer", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_software_version", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_terminal_id", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_terminal_location", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_primary_host_access", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_alternative_host_access", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_primary_phone_number", OracleType.VarChar).Direction = ParameterDirection.Input;
        //oracom.Parameters.Add("p_srv_type", OracleType.Number).Direction = ParameterDirection.Input; 
        //oracom.Parameters.Add("p_sr_number", OracleType.VarChar).Direction = ParameterDirection.Input;

        oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_res_code", OracleType.Number).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_res_type", OracleType.VarChar, 250).Direction = ParameterDirection.Output;
        oracom.Parameters.Add("p_res_msg", OracleType.VarChar, 250).Direction = ParameterDirection.Output;

        oracom.Parameters.Add("p_client_number", OracleType.VarChar, 250).Direction = ParameterDirection.Output;

        //oracom.Parameters.Add("p_client_number_orig", OracleType.VarChar).Direction = ParameterDirection.Input;
        
              string clID = Request.QueryString["clID"];
            //if (!String.IsNullOrWhiteSpace(clID))
            //     oracom.Parameters["p_client_number_orig"].Value=clID;
            //else 
            //     oracom.Parameters["p_client_number_orig"].Value= OracleString.Null;
        oracom.Parameters["p_lang"].Value = "EN";
        oracom.Parameters["p_current_uid"].Value = Session["uid"].ToString();

        oracom.Parameters["p_registration_date"].Value = dateRegDate.date;
        oracom.Parameters["p_account_number"].Value = txtAccNo.Text;
        oracom.Parameters["p_merchant_no"].Value = OracleNumber.Null;
        oracom.Parameters["p_client_level"].Value = OracleString.Null;
        oracom.Parameters["p_retailer_name"].Value = txtRetailName.Text;
        oracom.Parameters["p_retailer_name_ar"].Value = txtRetailNameAr.Text;
        oracom.Parameters["p_registration_number"].Value = txtRegNo.Text;
        oracom.Parameters["p_business_class"].Value = ddlBusinessClass.SelectedValue;
        oracom.Parameters["p_relationship_officer"].Value = ddlRelationshipOfficer.SelectedValue;
        oracom.Parameters["p_business_unit"].Value = ddlBusinessUnit.SelectedValue;
        oracom.Parameters["p_branch_cd"].Value = ddlBranch.SelectedValue;
        oracom.Parameters["p_record_type"].Value = OracleString.Null;
        oracom.Parameters["p_effective_date"].Value = dateRegDate.date;
        oracom.Parameters["p_address_category"].Value = OracleString.Null;
        oracom.Parameters["p_contact_name"].Value = txtContactname.Text;
        oracom.Parameters["p_po_box"].Value = txtPOBox.Text;
        oracom.Parameters["p_english_address1"].Value = txtEngAdd1.Text;
        oracom.Parameters["p_english_address2"].Value = txtEngAdd2.Text;
        oracom.Parameters["p_english_address3"].Value = txtEngAdd3.Text;
        oracom.Parameters["p_arabic_address1"].Value = OracleString.Null;
        oracom.Parameters["p_arabic_address2"].Value = OracleString.Null;
        oracom.Parameters["p_arabic_address3"].Value = OracleString.Null;
        oracom.Parameters["p_post_code"].Value = txtPostCode.Text;
        oracom.Parameters["p_city"].Value = ddlAddressCity.SelectedValue;
        oracom.Parameters["p_country"].Value = ddlAddressCountry.SelectedValue;
        oracom.Parameters["p_tel_work"].Value = txtTelWork.Text;
        oracom.Parameters["p_tel_other"].Value = txtTelOther.Text;
        oracom.Parameters["p_fax"].Value = txtFax.Text;
        oracom.Parameters["p_mobile"].Value = txtMobile.Text;
        oracom.Parameters["p_mobile_2"].Value = txtMobile2.Text;
        oracom.Parameters["p_mobile_3"].Value = txtMobile3.Text;
        oracom.Parameters["p_email_address"].Value = txtEmail.Text;
        oracom.Parameters["p_email_2"].Value = txtEmail2.Text;
        oracom.Parameters["p_email_3"].Value = txtEmail3.Text;
        oracom.Parameters["p_posting_method"].Value = ddlPostingMethod.SelectedValue;
        //oracom.Parameters["p_serial_number"].Value = OracleString.Null;
        //oracom.Parameters["p_purchase_date"].Value = OracleString.Null;
        //oracom.Parameters["p_model_number"].Value = OracleString.Null;
        //oracom.Parameters["p_manufacturer"].Value = OracleString.Null;
        //oracom.Parameters["p_software_version"].Value = OracleString.Null;
        //oracom.Parameters["p_terminal_id"].Value = txtTerminalID.Text;
        //oracom.Parameters["p_terminal_location"].Value = txtTerminalLocation.Text;
        //oracom.Parameters["p_primary_host_access"].Value = OracleString.Null;
        //oracom.Parameters["p_alternative_host_access"].Value = OracleString.Null;
        //oracom.Parameters["p_primary_phone_number"].Value = OracleString.Null;
        //oracom.Parameters["p_srv_type"].Value = OracleNumber.Null;
        //oracom.Parameters["p_sr_number"].Value = OracleString.Null;

        oracom.ExecuteNonQuery();
        oracon.Close();
        string a = oracom.Parameters["p_res_code"].Value.ToString();
        ID = oracom.Parameters["p_client_number"].Value.ToString();
        error = oracom.Parameters["p_res_msg"].Value.ToString();
        if (a == "0")
            return true;
        else
            return false;
    }

    //loading the lookups lists

    private void loadBranch(int type)
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "bank_lkp_editor.get_branches";

        oracom.Parameters.Add("p_branch_cd", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_lang", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

        if (type == 2)
            oracom.Parameters["p_branch_cd"].Value = ddlBranch.SelectedValue;
        else
            oracom.Parameters["p_branch_cd"].Value = OracleString.Null;

        oracom.Parameters["p_lang"].Value = "EN";

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        if (type == 2)
            txtBranch.Text = ds.Tables[0].Rows[0]["a_nm"].ToString();
        else
        {
            ddlBranch.DataSource = ds;
            ddlBranch.DataBind();
        }
        oracon.Close();
    }

    private void loadBusinessClass()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_Businessclass";

        oracom.Parameters.Add("p_Bclass", OracleType.Cursor).Direction = ParameterDirection.Output;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlBusinessClass.DataSource = ds;
        ddlBusinessClass.DataBind();

        ddlBusinessClass.Items.Insert(0, "------ Select ------");

        oracon.Close();
    }

    private void loadBusinessUnit()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.Get_Business_Units";

        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlBusinessUnit.DataSource = ds;
        ddlBusinessUnit.DataBind();
        ddlBusinessUnit.SelectedValue = "-1";
        oracon.Close();
    }

    private void loadRelationOfficer()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_relationship_officer";

        oracom.Parameters.Add("c_relationship_officer", OracleType.Cursor).Direction = ParameterDirection.Output;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlRelationshipOfficer.DataSource = ds;
        ddlRelationshipOfficer.DataBind();
        
        ddlRelationshipOfficer.Items.Insert(0, new ListItem("------------- Select-------------", "0"));

        oracon.Close();
    }

    private string getDayofMonth(int pDay)
    {
        string day = "", month = "", year = "";
        if (pDay < 10)
            day = "0" + pDay.ToString();
        else
            day = pDay.ToString();
        if (DateTime.Now.Month < 10)
            month = "0" + DateTime.Now.Month.ToString();
        else
            month = DateTime.Now.Month.ToString();
        year = DateTime.Now.Year.ToString();
        string date = day + "-" + month + "-" + year;
        return date;
    }

    private void loadBUAcc(string ID)
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.Get_Business_Unit_Acct";

        oracom.Parameters.Add("p_bu_code", OracleType.VarChar).Direction = ParameterDirection.Input;
        oracom.Parameters.Add("p_output", OracleType.Cursor).Direction = ParameterDirection.Output;

        oracom.Parameters["p_bu_code"].Value = ID;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        oracon.Close();

        txtBUAcc.Text = ds.Tables[0].Rows[0][0].ToString();

    }

    private void loadCity()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_city";

        oracom.Parameters.Add("p_city_names", OracleType.Cursor).Direction = ParameterDirection.Output;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlAddressCity.DataSource = ds;
        ddlAddressCity.DataBind();

        oracon.Close();
    }


    private void loadpostingMethod()
    {
        string DBConnection = Helper.dbConnection();

        OracleConnection oracon = new OracleConnection(DBConnection);
        oracon.Open();

        OracleCommand oracom = new OracleCommand();
        oracom.Connection = oracon;

        oracom.CommandType = CommandType.StoredProcedure;
        oracom.CommandText = "poslookup_getter.get_posting_method";

        oracom.Parameters.Add("p_pmethod", OracleType.Cursor).Direction = ParameterDirection.Output;

        OracleDataAdapter da = new OracleDataAdapter(oracom);
        DataSet ds = new DataSet();
        da.Fill(ds);

        ddlPostingMethod.DataSource = ds;
        ddlPostingMethod.DataBind();

        oracon.Close();

        ddlPostingMethod.SelectedValue = "002";
        // ddlPostingMethod.Enabled = false;
    }

    protected void ddlBusinessUnit_SelectedIndexChanged(object sender, EventArgs e)
    {
        loadBUAcc(ddlBusinessUnit.SelectedValue);
    }

    protected void btnMW_Click(object sender, EventArgs e)
    {

        lblError.Text = "Account Verification Done...<br>Account Information Acquired...";
        btnSave.Enabled = true;
    }

    
    
    


    protected void ddlBranch_SelectedIndexChanged1(object sender, EventArgs e)
    {
        loadBranch(2);
    }
}
