예제 #1
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     if (DpSeccion.SelectedItem != null)
     {
         MPromovido NewProm = new MPromovido(Int32.Parse(DpLid.SelectedItem.Value), TxtLastName.Text, TxtMiddleName.Text, TxtNames.Text, Int32.Parse(DpSeccion.SelectedItem.Value)
                                             , TxtStret.Text, TxtColony.Text, TxtEmail.Text, TxtPhoneHome.Text, TxtPhoneOffice.Text, TxtPhoneNextel.Text, TxtElector.Text, CmbRelation.SelectedItem.Value);
         Saved = C.SavePromovido(NewProm);
         ReloadIntegrantsTable();
         ReloadLider();
         if (Saved == true)
         {
             Clear();
         }
     }
 }
예제 #2
0
        public bool SavePromovido(MPromovido prom)
        {
            bool Saved = false;

            try
            {
                if (!String.IsNullOrEmpty(prom.Paterno) && !String.IsNullOrEmpty(prom.Materno) && !String.IsNullOrEmpty(prom.Nombres))
                {
                    DBManager     DB             = new DBManager(ConfigurationManager.AppSettings["SQLiteDB"]);
                    StringBuilder WhereStatement = new StringBuilder();
                    WhereStatement.AppendFormat(@"ApellidoPaterno like {0}
                                              and ApellidoMaterno like {1}
                                              and Nombres like {2}"
                                                , Extensions.SParam(prom.Paterno)
                                                , Extensions.SParam(prom.Materno)
                                                , Extensions.SParam(prom.Nombres));
                    object ID = DB.GetValue("Promovido", IntegrantsColumns.Id, WhereStatement.ToString());

                    if (ID == null)
                    {
                        DB.Insert("Promovido", new object[] { IntegrantsColumns.Id, "null"
                                                              , IntegrantsColumns.Lider, prom.LiderId
                                                              , IntegrantsColumns.Paterno, Extensions.SParam(prom.Paterno)
                                                              , IntegrantsColumns.Materno, Extensions.SParam(prom.Materno)
                                                              , IntegrantsColumns.Nombres, Extensions.SParam(prom.Nombres)
                                                              , IntegrantsColumns.Seccion, prom.Seccion
                                                              , IntegrantsColumns.Calle, Extensions.SParam(prom.Calle)
                                                              , IntegrantsColumns.Colonia, Extensions.SParam(prom.Colonia)
                                                              , IntegrantsColumns.Email, Extensions.SParam(prom.Email)
                                                              , IntegrantsColumns.TelefonoDomicilio, Extensions.SParam(prom.Domicilio)
                                                              , IntegrantsColumns.TelefonoOficina, Extensions.SParam(prom.Oficina)
                                                              , IntegrantsColumns.TelefonoNextel, Extensions.SParam(prom.Nextel)
                                                              , IntegrantsColumns.ClaveElector, Extensions.SParam(prom.Elector)
                                                              , IntegrantsColumns.Parentesco, Extensions.SParam(prom.Parentesco) });

                        Saved = true;
                    }
                }
            }
            catch (Exception E)
            {
                throw E;
            }

            return(Saved);
        }