コード例 #1
0
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            WattsALoanServiceReference.Customer customer = new WattsALoanServiceReference.Customer();
            customer.DateCreated    = DateTime.Now;
            customer.FullName       = TbxFullName.Text;
            customer.BillingAddress = TbxAddress.Text;
            customer.BillingCity    = TbxCity.Text;
            customer.BillingState   = TbxState.Text;
            customer.BillingZIPCide = TbxZipCide.Text;
            customer.EmailAddress   = TbxEmail.Text;

            WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanClient.WattsALoanServiceReference.WattsALoanServiceClient();
            bool result = client.InsertCustomer(customer);

            client.Close();

            string script = @"alert(""Add customer " + TbxFullName.Text;

            if (result)
            {
                script          += @" success."");";
                TbxFullName.Text = "";
                TbxAddress.Text  = "";
                TbxCity.Text     = "";
                TbxState.Text    = "";
                TbxZipCide.Text  = "";
                TbxEmail.Text    = "";
            }
            else
            {
                script += @" failed."");";
            }
            ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient();
                WattsALoanServiceReference.Customer customer = client.GetCustomer(int.Parse(Request.QueryString["id"]));
                client.Close();

                TbxCustomerID.Text = customer.CustomerID.ToString();
                TbxFullName.Text   = customer.FullName;
                TbxAddress.Text    = customer.BillingAddress;
                TbxCity.Text       = customer.BillingCity;
                TbxState.Text      = customer.BillingState;
                TbxZipCide.Text    = customer.BillingZIPCide;
                TbxEmail.Text      = customer.EmailAddress;
            }
        }