Exemplo n.º 1
0
        /// <summary>
        /// Add a new supplier to the database
        /// </summary>
        /// <param name="supplier"></param>
        /// <param name="db"></param>
        public static void AddSupplierToTheDatabase(SupplierModel supplier, string db)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnVal(db)))
            {
                var p = new DynamicParameters();
                p.Add("@PersonId", supplier.Person.Id);
                p.Add("@Company", supplier.Company);

                p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
                connection.Execute("dbo.spSupplier_Create", p, commandType: CommandType.StoredProcedure);
                supplier.Id = p.Get <int>("@Id");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get all the incomeorders That the supplier in
 /// </summary>
 /// <param name=""></param>
 /// <returns></returns>
 public static List <IncomeOrderModel> GetIncomeOrders(SupplierModel supplier)
 {
     return(PublicVariables.IncomeOrders.FindAll(x => x.Supplier == supplier));
 }