public static List<PurchasingProducts> GetAll()
        {
            DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString);
            List<PurchasingProducts> lstPurchasingProducts = new List<PurchasingProducts>();
            PurchasingProducts objPurchasingProducts = new PurchasingProducts();

            string strGetOneRecord = "SELECT * FROM [PurchasingProducts]";
            string[] strAddParameterName = new string[] { };
            object[] objAddparametervalue = new object[] { };
            DataTable objtab = new DataTable();
            objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue);

            for (int i = 0; i < objtab.Rows.Count; i++)
            {
                int intId;
                int intQuantity;
                decimal decPrice;
                objPurchasingProducts = new PurchasingProducts();
                int.TryParse(objtab.Rows[i]["Id"].ToString(), out intId);
                objPurchasingProducts.Id = intId;
                objPurchasingProducts.Name = objtab.Rows[i]["Name"] != null ? objtab.Rows[i]["Name"].ToString() : string.Empty;
                int.TryParse(objtab.Rows[i]["Quqntity"].ToString(), out intQuantity);
                objPurchasingProducts.Quantity = intQuantity;
                decimal.TryParse(objtab.Rows[i]["Price"].ToString(), out decPrice);
                objPurchasingProducts.Price = decPrice;
                lstPurchasingProducts.Add(objPurchasingProducts);
            }
            return lstPurchasingProducts;
        }
        public static PurchasingProducts Get(int Id)
        {
            DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString);

            PurchasingProducts objPurchasingProducts = new PurchasingProducts();
            string strGetOneRecord = "SELECT * FROM [PurchasingProducts] where Id=@Id";
            string[] strAddParameterName = new string[] { "Id" };
            object[] objAddparametervalue = new object[] { objPurchasingProducts.Id };
            System.Data.DataTable objtab = objdb.ExecuteGetAllQuery(strGetOneRecord, strAddParameterName, objAddparametervalue);
            return objPurchasingProducts;
        }
        public Response Create(PurchasingProducts objPurchasingProducts)
        {
            SQLConnector.DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString);
            string stInsert = @"INSERT INTO [PurchasingProducts]([Name],[Quantity] ,[Price])
                VALUES(@Name,@Quantity,@Price)";
            string[] strAddParameterName = new string[] { "Name", "Quantity", "Price" };
            object[] objAddparametervalue = new object[] { objPurchasingProducts.Name, objPurchasingProducts.Quantity, objPurchasingProducts.Price };
            if (!objdb.ExecuteQuery(stInsert, strAddParameterName, objAddparametervalue))
                return new Response(9999, string.Format(Failure_MSG, "insert"));

            else

                return new Response(5555, string.Format(SUCCESS_MSG, "inserted"));
        }
 public Response Update(PurchasingProducts objPurchasingProducts)
 {
     DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString);
     string strUpsate = @"UPDATE [PurchasingProducts]
           SET [Name] = @Name,
                    [Quantity] = @Quantity,
              [Price] = @Price
         WHERE Id=@Id";
     string[] strAddParameterName = new string[] { "Name", "Quantity", "Price", "Id" };
     object[] objAddparametervalue = new object[] { objPurchasingProducts.Name, objPurchasingProducts.Quantity, objPurchasingProducts.Price, objPurchasingProducts.Id };
     if (!objdb.ExecuteQuery(strUpsate, strAddParameterName, objAddparametervalue))
         return new Response(9999, string.Format(Failure_MSG, "update"));
     else
         return new Response(5555, string.Format(SUCCESS_MSG, "updated"));
 }
        public Response Delete(PurchasingProducts objPurchasingProducts)
        {
            DBOperations objdb = new DBOperations(Properties.Settings.Default.SuperMarketConnectionString);
            string strDelete = "DELETE FROM [PurchasingProducts] WHERE Id=@Id";
            string[] strAddParameterName = new string[] { "Id" };
            object[] objAddparametervalue = new object[] { objPurchasingProducts.Id };
            if (!objdb.ExecuteQuery(strDelete, strAddParameterName, objAddparametervalue))

                return new Response(9999, string.Format(Failure_MSG, "delete"));
            else

                return new Response(5555, string.Format(SUCCESS_MSG, "deleted"));
        }