Ejemplo n.º 1
0
        public Manufacturer GetManufacturerDetails(int ManufacturerID)
        {
            Manufacturer manufacturer = null;

            SqlParameter[] Params = { new SqlParameter("@ManufacturerID", ManufacturerID) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificManufacturer",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count == 1)
                {
                    DataRow row = table.Rows[0];
                    manufacturer = new Manufacturer();
                    manufacturer.ManufacturerID = Convert.ToInt32(row["ManufacturerID"]);
                    manufacturer.Name = row["Name"].ToString();
                }
            }
            return manufacturer;
        }
Ejemplo n.º 2
0
 public List<Manufacturer> CheckDuplicateManufacturer(string manufacturer)
 {
     List<Manufacturer> manufacturerList = null;
     SqlParameter[] Params = { new SqlParameter("@manufacturer", manufacturer) };
     using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_CheckDuplicateManufacturer", CommandType.StoredProcedure, Params))
     {
         if (table.Rows.Count > 0)
         {
             manufacturerList = new List<Manufacturer>();
             foreach (DataRow row in table.Rows)
             {
                 Manufacturer manufact = new Manufacturer(); ;
                 manufact.ManufacturerID = Convert.ToInt32(row["ManufacturerID"]);
                 manufact.Name = row["Name"].ToString();
                 manufacturerList.Add(manufact);
             }
         }
     }
     return manufacturerList;
 }
Ejemplo n.º 3
0
        public List<Manufacturer> GetManufacturerList()
        {
            List<Manufacturer> ManufacturerList = null;

            using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewAllManufacturers", //*Note
                CommandType.StoredProcedure))
            {
                if (table.Rows.Count > 0)
                {
                    ManufacturerList = new List<Manufacturer>();
                    foreach (DataRow row in table.Rows)
                    {
                        Manufacturer manu = new Manufacturer();
                        manu.ManufacturerID = Convert.ToInt32(row["ManufacturerID"]);
                        manu.Name = row["Manufacturer"].ToString();
                        ManufacturerList.Add(manu);
                    }
                }
            }
            return ManufacturerList;
        }
Ejemplo n.º 4
0
 public bool UpdateManufacturer(Manufacturer manufacturer)
 {
     ManufacturerHandler myHandler = new ManufacturerHandler(); return myHandler.UpdateManufacturer(manufacturer);
 }
Ejemplo n.º 5
0
 public bool AddManufacturer(Manufacturer manufacturer)
 {
     ManufacturerHandler myHandler = new ManufacturerHandler(); return myHandler.InsertManufacturer(manufacturer);
 }
Ejemplo n.º 6
0
        public List<Manufacturer> ManufacturerGlobalSearch(string query)
        {
            List<Manufacturer> manufacturerList = null;

            SqlParameter[] Params = { new SqlParameter("@Search", query) };
            using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ManufacturerGlobalSearch",
                CommandType.StoredProcedure, Params))
            {
                if (table.Rows.Count > 0)
                {
                    manufacturerList = new List<Manufacturer>();
                    foreach (DataRow row in table.Rows)
                    {
                        Manufacturer manufacturer = new Manufacturer();
                        manufacturer.ManufacturerID = Convert.ToInt32(row["ManufacturerID"]);
                        manufacturer.Name = row["Name"].ToString();
                        manufacturerList.Add(manufacturer);
                    }
                }
            }
            return manufacturerList;
        }
Ejemplo n.º 7
0
 public bool InsertManufacturer(Manufacturer manu)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@Name", manu.Name)
     };
     return DataProvider.ExecuteNonQuery("sp_InsertManufacturer", CommandType.StoredProcedure,
         Params);
 }
Ejemplo n.º 8
0
 public bool UpdateManufacturer(Manufacturer manufacturer)
 {
     SqlParameter[] Params = new SqlParameter[]
     {
         new SqlParameter("@ManufacturerID", manufacturer.ManufacturerID ),
         new SqlParameter("@Name", manufacturer.Name)
     };
     return DataProvider.ExecuteNonQuery("sp_UpdateManufacturer", CommandType.StoredProcedure,
         Params);
 }