Ejemplo n.º 1
0
        public int Save(UsersML User)
        {
            try
            {
                ModelDAL ModelDAL = new ModelDAL();
                String   Response = ModelDAL.InsertModel(User, TableName, IdUserSession);

                SqlConnection Conexion = new SqlConnection
                {
                    ConnectionString = ConnectionString
                };

                using (SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion))
                {
                    Conexion.Open();
                    int newID = (Int32)cmd2.ExecuteScalar();

                    if (Conexion.State == System.Data.ConnectionState.Open)
                    {
                        Conexion.Close();
                    }
                    return(newID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("{0}.save : {1}", core, ex));
            }
        }
Ejemplo n.º 2
0
 public int Save(CompanyML company)
 {
     try
     {
         ModelDAL ModelDAL = new ModelDAL();
         return(Convert.ToInt32(ModelDAL.InsertModel(company, TableName, IdUserSession, ConnectionString)));
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.save : {1}", core, ex));
     }
 }
Ejemplo n.º 3
0
 public int Insert(UsersEmployeeML usersEmployee)
 {
     try
     {
         ModelDAL      ModelDAL = new ModelDAL();
         String        Response = ModelDAL.InsertModel(usersEmployee, TableName, IdUserSession);
         SqlConnection Conexion = new SqlConnection
         {
             ConnectionString = ConnectionString
         };
         Conexion.Open();
         SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion);
         return(cmd2.ExecuteNonQuery());
     }
     catch (Exception ex)
     {
         throw new Exception(String.Format("{0}.Insert : {1}", core, ex));
     }
 }
Ejemplo n.º 4
0
        public int Save(MigrationHistoryML MigrationHistory)
        {
            ModelDAL      data     = new ModelDAL();
            String        Response = data.InsertModel(MigrationHistory, TableName, IdUserSession);
            SqlConnection Conexion = new SqlConnection
            {
                ConnectionString = ConnectionString
            };

            using (SqlCommand cmd2 = new SqlCommand(Response.ToString(), Conexion))
            {
                Conexion.Open();
                int newID = (Int32)cmd2.ExecuteScalar();

                if (Conexion.State == System.Data.ConnectionState.Open)
                {
                    Conexion.Close();
                }
                return(newID);
            }
        }