예제 #1
0
        //-------------------------------------
        // Lista Campaña Vigentes (App Android)
        //-------------------------------------
        public DataTable Android_Get_Campana_actual(BE_ReqCampana Request)
        {
            DataTable dt = new DataTable();

            try
            {
                //clsConection Obj = new clsConection();
                string Cadena = "Server=10.0.0.10\\SRVDATOSMED; DataBase = BDDatos; Uid=android; Pwd=C2879442C28147B;Integrated Security=False; Pooling = False";
                //string Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Android_Get_Campana_actual]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cPerJurCodigo", Request.cPerJurCodigo);
                        cm.Parameters.AddWithValue("cFlag", Request.cFlag);

                        cm.Connection = cn;

                        using (SqlDataReader dr = cm.ExecuteReader())
                            dt.Load(dr);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
예제 #2
0
        //--------------------------------------------------
        // Lista Detalle Campaña carga Grilla para editarla
        //--------------------------------------------------
        public DataTable Get_List_Campana_Detalle(BE_ReqCampana Request)
        {
            DataTable dt = new DataTable();

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Get_List_Campana_Detalle]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cPerJurCodigo", Request.cPerJurCodigo);
                        cm.Parameters.AddWithValue("nIntCamp", Request.nIntCamp);

                        cm.Connection = cn;

                        using (SqlDataReader dr = cm.ExecuteReader())
                            dt.Load(dr);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
예제 #3
0
        //----------------
        // Insert Campaña
        //----------------
        public bool Ins_Campana(BE_ReqCampana Request)
        {
            bool exito = false;

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Ins_Campana]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("nIntCamp", Request.nIntCamp);
                        cm.Parameters.AddWithValue("cPerJurCodigo", Request.cPerJurCodigo);
                        cm.Parameters.AddWithValue("cNombreCamp", Request.cNombreCamp);
                        cm.Parameters.AddWithValue("dFecIniCamp", Request.dFecIniCamp);
                        cm.Parameters.AddWithValue("dFecFinCamp", Request.dFecFinCamp);
                        cm.Parameters.AddWithValue("nTCostoCamp", Request.nTCostoCamp);
                        cm.Parameters.AddWithValue("cPerUseCodigo", Request.cPerUseCodigo);

                        cm.Connection = cn;

                        if (cm.ExecuteNonQuery() > 0)
                        {
                            exito = true;
                        }
                        else
                        {
                            throw new ApplicationException("se ha producido un error procedimiento almacenado: [usp_Ins_Campana]; Consulte al administrador del sistema");
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(exito);
        }
        public Campana[] ListarCampana(string cPerJurCodigo = "1000098770", string cFlag = "C")
        {
            try
            {
                List <Campana> lista  = new List <Campana>();
                BE_ReqCampana  Objeto = new BE_ReqCampana();

                if (VerificarPermisos(CredencialAutenticacion))
                {
                    BL_Campana Servicio = new BL_Campana();

                    DataTable dt = new DataTable();

                    Objeto.cPerJurCodigo = cPerJurCodigo;
                    Objeto.cFlag         = cFlag;

                    dt = Servicio.Android_Get_Campana_actual(Objeto);

                    foreach (DataRow row in dt.Rows)
                    {
                        lista.Add(new Campana(
                                      Convert.ToInt32(row[0]),
                                      Convert.ToString(row[1]),
                                      Convert.ToDouble(row[2])
                                      ));
                    }
                }
                else
                {
                    //return null;
                    lista.Add(new Campana(0, "Credenciales no validas", 0));
                }
                return(lista.ToArray());
            }
            catch (Exception ex)
            {
                throw new SoapException("Credenciales no validas.",
                                        SoapException.ServerFaultCode, "Error:", ex);
            }
        }
예제 #5
0
        //--------------------------
        //Genrar NewId para Campaña
        //--------------------------
        public string Get_NewId_nIntCampana(BE_ReqCampana Request)
        {
            string nNewId = "";

            try
            {
                clsConection Obj    = new clsConection();
                string       Cadena = Obj.GetConexionString("Naylamp");
                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Get_NewId_nIntCampana]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cPerJurCodigo", Request.cPerJurCodigo);
                        cm.Connection = cn;

                        SqlParameter pCod = new SqlParameter();
                        pCod.ParameterName = "nNewId";
                        pCod.DbType        = DbType.String;
                        pCod.Size          = 12;
                        pCod.Direction     = ParameterDirection.Output;

                        cm.Parameters.Add(pCod);
                        cm.ExecuteNonQuery();
                        nNewId = cm.Parameters["nNewId"].Value.ToString();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(nNewId);
        }
예제 #6
0
        //------------------------
        //select CtaCteServicio
        //------------------------
        public DataTable Get_Servicios_for_nIntCamp(BE_ReqCampana Request)
        {
            DA_Campana Obj = new DA_Campana();

            return(Obj.Get_Servicios_for_nIntCamp(Request));
        }
예제 #7
0
        //------------------------
        //select CtaCteServicio
        //------------------------
        public DataTable Get_List_Campana(BE_ReqCampana Request)
        {
            DA_Campana Obj = new DA_Campana();

            return(Obj.Get_List_Campana(Request));
        }
예제 #8
0
        //Delete Item Detalle Campana
        public bool Del_DetalleCampana(BE_ReqCampana Request)
        {
            DA_Campana Obj = new DA_Campana();

            return(Obj.Del_DetalleCampana(Request));
        }
예제 #9
0
        //Update Campana
        public bool Upd_Campana(BE_ReqCampana Request)
        {
            DA_Campana Obj = new DA_Campana();

            return(Obj.Upd_Campana(Request));
        }
예제 #10
0
        //Genera nuevo Codigo nIntCamp
        public string Get_NewId_nIntCampana(BE_ReqCampana Request)
        {
            DA_Campana Obj = new DA_Campana();

            return(Obj.Get_NewId_nIntCampana(Request));
        }