コード例 #1
0
        public List <BE.Pais> Listar()
        {
            List <BE.Pais> lst = new List <BE.Pais>();

            try
            {
                var daPais = new DA.Pais();

                DataTable dt = daPais.Listar();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var bePais = new BE.Pais();

                    DataRow dr = dt.Rows[i];
                    daPais.Cargar(ref bePais, ref dr);

                    lst.Add(bePais);
                }


                return(lst);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
ファイル: Pais.cs プロジェクト: r3xakead0/ErpCasino
 public void Cargar(ref BE.Pais bePais, ref DataRow dr)
 {
     try
     {
         bePais.Codigo    = dr["CodPais"] == DBNull.Value ? "" : dr["CodPais"].ToString();
         bePais.Nombre    = dr["Nombre"] == DBNull.Value ? "" : dr["Nombre"].ToString();
         bePais.Name      = dr["Name"] == DBNull.Value ? "" : dr["Name"].ToString();
         bePais.Nom       = dr["Nom"] == DBNull.Value ? "" : dr["Nom"].ToString();
         bePais.Iso2      = dr["Iso2"] == DBNull.Value ? "" : dr["Iso2"].ToString();
         bePais.PhoneCode = dr["PhoneCode"] == DBNull.Value ? "" : dr["PhoneCode"].ToString();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
        public bool Obtener(ref BE.Pais oBeTbPais)
        {
            bool exists = false;

            try
            {
                var daPais = new DA.Pais();

                exists = daPais.Obtener(ref oBeTbPais);

                return(exists);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
ファイル: Pais.cs プロジェクト: r3xakead0/ErpCasino
        public bool Obtener(ref BE.Pais bePais)
        {
            try
            {
                string sp = "SpTbPaisObtener";

                using (SqlConnection cnn = new SqlConnection(ConnectionManager.ConexionLocal))
                {
                    cnn.Open();

                    SqlCommand cmd = new SqlCommand(sp, cnn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataAdapter dad = new SqlDataAdapter(cmd);
                    dad.SelectCommand.Parameters.Add(new SqlParameter("@CODPAIS", bePais.Codigo));

                    DataTable dt = new DataTable();
                    dad.Fill(dt);

                    if ((dt.Rows.Count == 1))
                    {
                        DataRow dr = dt.Rows[0];
                        Cargar(ref bePais, ref dr);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }