Esempio n. 1
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row        = GV_Pilots.Rows[e.RowIndex];
            int         idPilot    = Convert.ToInt32(GV_Pilots.DataKeys[e.RowIndex].Values[0]);
            string      mail       = (row.FindControl("txtEmail") as TextBox).Text;
            string      name       = (row.FindControl("txtFstName") as TextBox).Text;
            string      lstName    = (row.FindControl("txtLstName") as TextBox).Text;
            string      cert       = (row.FindControl("txtCert") as TextBox).Text;
            string      flightTime = (row.FindControl("txtTVuelo") as TextBox).Text;
            string      certDate   = (row.FindControl("txtCertDate") as TextBox).Text;

            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dPilot pil = (from p in ctx.dPilots
                              where p.id == idPilot
                              select p).FirstOrDefault();
                pil.email           = mail;
                pil.fstName         = name;
                pil.lstName         = lstName;
                pil.certificate     = char.Parse(cert);
                pil.flightTime      = Int32.Parse(flightTime);
                pil.certificateDate = DateTime.Parse(certDate);
                ctx.SubmitChanges();
            }
            GV_Pilots.EditIndex = -1;
            this.BindGrid();
        }
Esempio n. 2
0
        protected void Insert(object sender, EventArgs e)
        {
            lblMensaje.Text = "";
            if (txtBrand.Text != "" && txtCostUSD.Text != "" && txtModel.Text != "")
            {
                using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
                {
                    dCatCamera cam = new dCatCamera
                    {
                        brand   = txtBrand.Text,
                        model   = txtModel.Text,
                        costUsd = decimal.Parse(txtCostUSD.Text),
                    };
                    ctx.dCatCameras.InsertOnSubmit(cam);
                    ctx.SubmitChanges();
                }

                txtBrand.Text   = "";
                txtCostUSD.Text = "";
                txtModel.Text   = "";

                this.BindGrid();
            }
            else
            {
                lblMensaje.Text = "Favor de introducir los campos requeridos.";
            }
        }
Esempio n. 3
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int idCatCam = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);

            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dCatCamera cam = (from c in ctx.dCatCameras
                                  where c.id == idCatCam
                                  select c).FirstOrDefault();
                ctx.dCatCameras.DeleteOnSubmit(cam);
                ctx.SubmitChanges();
            }
            this.BindGrid();
        }
Esempio n. 4
0
        protected void Insert(object sender, EventArgs e)
        {
            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dCatCamera cam = new dCatCamera
                {
                    brand   = txtBrand.Text,
                    model   = txtModel.Text,
                    costUsd = decimal.Parse(txtCostUSD.Text),
                };
                ctx.dCatCameras.InsertOnSubmit(cam);
                ctx.SubmitChanges();
            }

            this.BindGrid();
        }
Esempio n. 5
0
        protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row      = GridView1.Rows[e.RowIndex];
            int         idCatCam = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);
            string      brand    = (row.FindControl("txtBrand") as TextBox).Text;
            string      model    = (row.FindControl("txtModel") as TextBox).Text;
            string      costUsd  = (row.FindControl("txtCostUSD") as TextBox).Text;

            using (DroidikaContextDataContext ctx = new DroidikaContextDataContext())
            {
                dCatCamera cam = (from c in ctx.dCatCameras
                                  where c.id == idCatCam
                                  select c).FirstOrDefault();
                cam.brand   = brand;
                cam.model   = model;
                cam.costUsd = decimal.Parse(costUsd);
                ctx.SubmitChanges();
            }
            GridView1.EditIndex = -1;
            this.BindGrid();
        }