コード例 #1
0
        private void AddInsurance_Click(object sender, RoutedEventArgs e)
        {
            AddInsurance addInsurance = new AddInsurance();

            addInsurance.Show();
            this.Close();
        }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            AddInsurance adi = new AddInsurance();

            adi.Type              = txtType.Text;
            adi.MonthlyAmount     = decimal.Parse(txtMonthlyAmount.Text);
            adi.TotalInsurance    = decimal.Parse(txtTotalInsurance.Text);
            adi.TotalGetInsurance = decimal.Parse(txtTotalGetInsurance.Text);


            adi.UserName = Session["un"].ToString();

            db.AddInsurances.Add(adi);
            db.SaveChanges();

            lblInsuranceId.Text = adi.Id.ToString();

            ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Data Save Sucessfully!!!')", true);


            lblInsuranceId.Text       = "";
            txtType.Text              = "";
            txtMonthlyAmount.Text     = "";
            txtTotalInsurance.Text    = "";
            txtTotalGetInsurance.Text = "";
        }
        catch (Exception ex1)
        {
            Literal1.Text = ex1.Message;
        }
    }