Beispiel #1
0
        public List<Supplier> GetBookSupplierList()
        {
            List<Supplier> SupplierList = null;

            using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewAllBookSuppliers",
                CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    SupplierList = new List<Supplier>();
                    foreach (DataRow row in table.Rows)
                    {
                        Supplier supplier = new Supplier();
                        supplier.SupplierID = Convert.ToInt32(row["SupplierID"]);
                        supplier.Name = row["Name"].ToString();
                        supplier.LastName = row["LastName"].ToString();
                        supplier.Fax = row["Fax"].ToString();
                        supplier.ContactPerson = row["ContactPerson"].ToString();
                        supplier.ContactPersonNumber = row["ContactPersonNumber"].ToString();
                        SupplierList.Add(supplier);
                    }
                }
            }
            return SupplierList;
        }
Beispiel #2
0
        public Supplier GetSupplier(string User_Id)
        {
            Supplier supplier = null;

            SqlParameter[] Params = { new SqlParameter("@User_Id", User_Id) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificUserSupplier",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    supplier = new Supplier();
                    supplier.SupplierID = Convert.ToInt32(row["SupplierID"]);
                    supplier.Name = row["Name"].ToString();
                    supplier.LastName = row["LastName"].ToString();
                    supplier.Fax = row["Fax"].ToString();
                    supplier.ContactPerson = row["ContactPerson"].ToString();
                    supplier.ContactPersonNumber = row["ContactPersonNumber"].ToString();
                }
            }
            return supplier;
        }
 public bool UpdateSupplier(Supplier supplier)
 {
     SupplierHandler myHandler = new SupplierHandler(); return myHandler.UpdateSupplier(supplier);
 }
 public bool AddSupplier(Supplier supplier)
 {
     SupplierHandler myHandler = new SupplierHandler();
     return myHandler.InsertSupplier(supplier);
 }
Beispiel #5
0
 public bool UpdateSupplier(Supplier supplier)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter ("@SupplierID", supplier.SupplierID),
         new SqlParameter("@Name", supplier.Name ),
         new SqlParameter("@Telephone", supplier.LastName),
         new SqlParameter("@Fax", supplier.Fax),
         new SqlParameter("@ContactPerson", supplier.ContactPerson),
         new SqlParameter("@ContactPersonTel", supplier.ContactPersonNumber),
     };
     return DataProvider.ExecuteNonQuery("sp_UpdateSupplier", CommandType.StoredProcedure,
         Params);
 }
Beispiel #6
0
        public Supplier SearchSupplier(string Query)
        {
            Supplier supplier = null;
            SqlParameter[] Params = new SqlParameter[]
            {
                new SqlParameter("@Name", Query) ///SEARCH
            };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_SearchProduct",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    supplier = new Supplier();
                    supplier.SupplierID = Convert.ToInt32(row["SupplierID"]);
                    supplier.Name = row["Name"].ToString();
                    supplier.LastName = row["LastName"].ToString();
                    supplier.Fax = row["Fax"].ToString();
                    supplier.ContactPerson = row["ContactPerson"].ToString();
                    supplier.ContactPersonNumber = row["ContactPersonNumber"].ToString();

                }
            }
            return supplier;
        }
Beispiel #7
0
        public bool IsBookSupplier(int SupplierID)
        {
            Supplier supplier = null;
            SqlParameter[] Params = new SqlParameter[]
            {
                new SqlParameter("@SupplierID", SupplierID) ///SEARCH
            };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_CheckSupplierType",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    supplier = new Supplier();
                    supplier.SupplierID = Convert.ToInt32(row["SupplierID"]);

                }
            }
            return supplier.IsBookSupplier;
        }