コード例 #1
0
        protected void GridViewPolicy_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row    = GridViewPolicy.Rows[e.RowIndex];
            int         id     = Convert.ToInt32(((TextBox)(row.Cells[1].Controls[0])).Text);
            Policy      Policy = _db.Policies.Where(f => f.Id == id).FirstOrDefault();

            Policy.ClientId          = int.Parse(e.NewValues["ClientId"].ToString());
            Policy.RegistredAt       = Convert.ToDateTime(e.NewValues["RegistredAt"].ToString());
            Policy.Finish            = Convert.ToDateTime(e.NewValues["Finish"].ToString());
            Policy.TypeOfInsuranceId = int.Parse(e.NewValues["TypeOfInsuranceId"].ToString());
            _db.SaveChanges();
            GridViewPolicy.EditIndex = -1;

            ShowData(strFindPolicy);
        }
コード例 #2
0
        protected void GridViewTypeOfInsurance_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow     row             = GridViewTypeOfInsurance.Rows[e.RowIndex];
            int             id              = Convert.ToInt32(((TextBox)(row.Cells[1].Controls[0])).Text);
            TypeOfInsurance TypeOfInsurance = _db.TypesOfInsurance.Where(f => f.Id == id).FirstOrDefault();

            TypeOfInsurance.Name        = ((TextBox)(row.Cells[2].Controls[0])).Text;
            TypeOfInsurance.Description = ((TextBox)(row.Cells[3].Controls[0])).Text;
            TypeOfInsurance.Price       = int.Parse(((TextBox)(row.Cells[4].Controls[0])).Text);
            TypeOfInsurance.Payment     = int.Parse(((TextBox)(row.Cells[5].Controls[0])).Text);
            _db.SaveChanges();
            GridViewTypeOfInsurance.EditIndex = -1;

            ShowData(strFindTypeOfInsurance);
        }
コード例 #3
0
        protected void GridViewClient_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Update the values.
            GridViewRow row    = GridViewClient.Rows[e.RowIndex];
            int         id     = Convert.ToInt32(((TextBox)(row.Cells[1].Controls[0])).Text);
            Client      client = _db.Clients.Where(f => f.Id == id).FirstOrDefault();

            client.FullName     = ((TextBox)(row.Cells[2].Controls[0])).Text;
            client.Gender       = ((TextBox)(row.Cells[3].Controls[0])).Text;
            client.Phone        = ((TextBox)(row.Cells[4].Controls[0])).Text;
            client.DateOfBirth  = Convert.ToDateTime(e.NewValues["DateOfBirth"].ToString());
            client.Adress       = ((TextBox)(row.Cells[6].Controls[0])).Text;
            client.SerialNumber = ((TextBox)(row.Cells[7].Controls[0])).Text;
            client.Residence    = ((TextBox)(row.Cells[8].Controls[0])).Text;
            _db.SaveChanges();
            GridViewClient.EditIndex = -1;

            ShowData(strFindClient);
        }