Esempio n. 1
0
        //This function will update user modified data
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(txtFID.Text))
            {
                lblMessage.Text = "";
                using (LicenseEntities le = new LicenseEntities())
                {
                    try
                    {
                        int fid            = Convert.ToInt32(txtFID.Text);
                        var updataeLicense = le.LicenseDBs.FirstOrDefault(n => n.FID == fid);
                        if (updataeLicense != null)
                        {
                            updataeLicense.Business_Name         = txtBusiness_Name.Text;
                            updataeLicense.Business_Phone_Number = txtBusiness_Phone_Number.Text;
                            updataeLicense.City           = txtCity.Text;
                            updataeLicense.State          = txtState.Text;
                            updataeLicense.Zip            = txtZip.Text;
                            updataeLicense.License_Status = txtLicense_Status.Text;

                            updataeLicense.Classification_Code        = txtClassficationCode.Text;
                            updataeLicense.Classification_Description = txtClassficationDes.Text;

                            le.Entry(updataeLicense).State = System.Data.EntityState.Modified;
                            le.SaveChanges();
                            lblMessage.Text = "Update Success!";
                        }
                    }
                    catch (Exception)
                    {
                        lblMessage.Text = "Update failed!";
                    }
                }
            }
        }