Exemple #1
0
        public Model.Client Select(Model.Client Client)
        {
            Model.Client cliente;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[client] Where client_id= " + Client.Client_id, db.Db());
                SqlDataReader dr = cmd.ExecuteReader(); //CommandBehavior.CloseConnection

                if (dr.Read())
                {
                    cliente = new Model.Client();
                    cliente.Client_id = Convert.ToInt32(dr["client_id"].ToString());
                    cliente.Local_name = dr["local_name"].ToString();
                    cliente.Intl_name = dr["intl_name"].ToString();
                    cliente.Code = dr["code"].ToString();
                    cliente.Active = Convert.ToInt32(dr["active"]);
                    cliente.Multinational = Convert.ToInt32(dr["multinational"].ToString());
                    return cliente;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
 private DAL.Models.Client ToObject(Model.Client client)
 {
     return(new DAL.Models.Client()
     {
         FullName = client.FullName
     });
 }
Exemple #3
0
 public Client ThirdClient()
 {
     var thirdClient = new Client
     {
         ClientId = 3,
         UserId = 6
     };
     return thirdClient;
 }
Exemple #4
0
 public Client SecondClient()
 {
     var secondClient = new Client
     {
         ClientId = 2,
         UserId = 4
     };
     return secondClient;
 }
Exemple #5
0
 public Client FirstClient()
 {
     var firstClient = new Client
     {
         ClientId = 1,
         UserId = 3
     };
     return firstClient;
 }
Exemple #6
0
        public List<Model.Client> Select(String pWhere)
        {
            List<Model.Client> lstClient = new List<Model.Client>();
            Model.Client cli;

            try
            {
                SqlCommand cmd = new SqlCommand("Select * From dbo.[client] " + pWhere, db.Db());
                SqlDataReader dr = cmd.ExecuteReader(); //CommandBehavior.CloseConnection

                while (dr.Read())
                {
                    cli = new Model.Client();
                    cli.Client_id = Convert.ToInt32(dr["client_id"].ToString());
                    cli.Local_name = dr["local_name"].ToString();
                    cli.Intl_name = dr["intl_name"].ToString();
                    cli.Code = dr["code"].ToString();
                    cli.Active = Convert.ToInt32(dr["active"]);
                    cli.Multinational = Convert.ToInt32(dr["multinational"].ToString());
                    lstClient.Add(cli);
                }
                return lstClient;

            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }