Пример #1
0
        public ProductInventoryDetails Details(Int64 ProductID)
        {
            try
            {
                System.Data.DataTable dt = ListAsDataTable(ProductID, "InventoryID", SortOption.Ascending);

                ProductInventoryDetails Details = new ProductInventoryDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    Details.InventoryID                = Int64.Parse(dr["InventoryID"].ToString());
                    Details.ProductID                  = Int64.Parse(dr["ProductID"].ToString());
                    Details.ProductCode                = "" + dr["ProductCode"].ToString();
                    Details.VariationMatrixID          = Int64.Parse(dr["VariationMatrixID"].ToString());
                    Details.VariationMatrixDescription = "" + dr["VariationMatrixDescription"].ToString();
                    Details.ProductUnitID              = Int32.Parse(dr["ProductUnitID"].ToString());
                    Details.UnitName     = "" + dr["UnitName"].ToString();
                    Details.Quantity     = Int32.Parse(dr["Quantity"].ToString());
                    Details.MinThreshold = Int32.Parse(dr["MinThreshold"].ToString());
                    Details.MaxThreshold = Int32.Parse(dr["MaxThreshold"].ToString());
                }

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #2
0
        public void Update(ProductInventoryDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblInventory SET " +
                             "ProductID = @ProductID, " +
                             "Quantity = @Quantity, " +
                             "ProductUnitID = @ProductUnitID, " +
                             "MinThreshold = @MinThreshold, " +
                             "MaxThreshold = @MaxThreshold " +
                             "WHERE InventoryID = @InventoryID;";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmProductID = new MySqlParameter("@ProductID", MySqlDbType.Int32);
                prmProductID.Value = Details.ProductID;
                cmd.Parameters.Add(prmProductID);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity", MySqlDbType.Int32);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID", MySqlDbType.Int32);
                prmProductUnitID.Value = Details.ProductUnitID;
                cmd.Parameters.Add(prmProductUnitID);

                MySqlParameter prmMinThreshold = new MySqlParameter("@MinThreshold", MySqlDbType.Int32);
                prmMinThreshold.Value = Details.MinThreshold;
                cmd.Parameters.Add(prmMinThreshold);

                MySqlParameter prmMaxThreshold = new MySqlParameter("@MaxThreshold", MySqlDbType.Int32);
                prmMaxThreshold.Value = Details.MaxThreshold;
                cmd.Parameters.Add(prmMaxThreshold);

                MySqlParameter prmInventoryID = new MySqlParameter("@InventoryID", MySqlDbType.Int32);
                prmInventoryID.Value = Details.InventoryID;
                cmd.Parameters.Add(prmInventoryID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                {
                }

                throw base.ThrowException(ex);
            }
        }
Пример #3
0
        public Int64 Insert(ProductInventoryDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblInventory (" +
                             "ProductID, " +
                             "VariationMatrixID, " +
                             "ProductUnitID, " +
                             "Quantity, " +
                             "MinThreshold" +
                             ")VALUES (" +
                             "@ProductID, " +
                             "@VariationMatrixID, " +
                             "@ProductUnitID, " +
                             "@Quantity, " +
                             "@MinThreshold, " +
                             "@MaxThreshold);";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                MySqlParameter prmProductID = new MySqlParameter("@ProductID", MySqlDbType.Int32);
                prmProductID.Value = Details.ProductID;
                cmd.Parameters.Add(prmProductID);

                MySqlParameter prmVariationMatrixID = new MySqlParameter("@VariationMatrixID", MySqlDbType.Int16);
                prmVariationMatrixID.Value = Details.VariationMatrixID;
                cmd.Parameters.Add(prmVariationMatrixID);

                MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID", MySqlDbType.Int16);
                prmProductUnitID.Value = Details.ProductUnitID;
                cmd.Parameters.Add(prmProductUnitID);

                MySqlParameter prmQuantity = new MySqlParameter("@Quantity", MySqlDbType.Int32);
                prmQuantity.Value = Details.Quantity;
                cmd.Parameters.Add(prmQuantity);

                MySqlParameter prmMinThreshold = new MySqlParameter("@MinThreshold", MySqlDbType.Int32);
                prmMinThreshold.Value = Details.MinThreshold;
                cmd.Parameters.Add(prmMinThreshold);

                MySqlParameter prmMaxThreshold = new MySqlParameter("@MaxThreshold", MySqlDbType.Int32);
                prmMaxThreshold.Value = Details.MaxThreshold;
                cmd.Parameters.Add(prmMaxThreshold);

                base.ExecuteNonQuery(cmd);

                SQL = "SELECT LAST_INSERT_ID();";

                cmd.Parameters.Clear();
                cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

                return(iID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Пример #4
0
		public Int64 Insert(ProductInventoryDetails Details)
		{
			try 
			{
				string SQL =	"INSERT INTO tblInventory (" + 
								"ProductID, " +
								"VariationMatrixID, " +
								"ProductUnitID, " +
								"Quantity, " +
								"MinThreshold" +
								")VALUES (" +
								"@ProductID, " +
								"@VariationMatrixID, " +
								"@ProductUnitID, " +
								"@Quantity, " +
								"@MinThreshold, " +
								"@MaxThreshold);";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				MySqlParameter prmProductID = new MySqlParameter("@ProductID",MySqlDbType.Int32);			
				prmProductID.Value = Details.ProductID;
				cmd.Parameters.Add(prmProductID);
				
				MySqlParameter prmVariationMatrixID = new MySqlParameter("@VariationMatrixID",MySqlDbType.Int16);	
				prmVariationMatrixID.Value = Details.VariationMatrixID;
				cmd.Parameters.Add(prmVariationMatrixID);

				MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID",MySqlDbType.Int16);	
				prmProductUnitID.Value = Details.ProductUnitID;
				cmd.Parameters.Add(prmProductUnitID);

				MySqlParameter prmQuantity = new MySqlParameter("@Quantity",MySqlDbType.Int32);	
				prmQuantity.Value = Details.Quantity;
				cmd.Parameters.Add(prmQuantity);

				MySqlParameter prmMinThreshold = new MySqlParameter("@MinThreshold",MySqlDbType.Int32);			
				prmMinThreshold.Value = Details.MinThreshold;
				cmd.Parameters.Add(prmMinThreshold);

				MySqlParameter prmMaxThreshold = new MySqlParameter("@MaxThreshold",MySqlDbType.Int32);			
				prmMaxThreshold.Value = Details.MaxThreshold;
				cmd.Parameters.Add(prmMaxThreshold);

				base.ExecuteNonQuery(cmd);

				SQL = "SELECT LAST_INSERT_ID();";
				
				cmd.Parameters.Clear(); 
				cmd.CommandText = SQL;

                System.Data.DataTable dt = new System.Data.DataTable("LAST_INSERT_ID");
                base.MySqlDataAdapterFill(cmd, dt);

                Int64 iID = 0;
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    iID = Int64.Parse(dr[0].ToString());
                }

				return iID;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #5
0
		public ProductInventoryDetails Details(Int64 ProductID)
		{
			try
			{
                System.Data.DataTable dt = ListAsDataTable(ProductID, "InventoryID", SortOption.Ascending);
				
				ProductInventoryDetails Details = new ProductInventoryDetails();

				foreach (System.Data.DataRow dr in dt.Rows)
				{
					Details.InventoryID = Int64.Parse(dr["InventoryID"].ToString());
					Details.ProductID = Int64.Parse(dr["ProductID"].ToString());
					Details.ProductCode = "" + dr["ProductCode"].ToString();
					Details.VariationMatrixID = Int64.Parse(dr["VariationMatrixID"].ToString());
					Details.VariationMatrixDescription = "" + dr["VariationMatrixDescription"].ToString();
					Details.ProductUnitID = Int32.Parse(dr["ProductUnitID"].ToString());
					Details.UnitName = "" + dr["UnitName"].ToString();
					Details.Quantity = Int32.Parse(dr["Quantity"].ToString());
					Details.MinThreshold = Int32.Parse(dr["MinThreshold"].ToString());
                    Details.MaxThreshold = Int32.Parse(dr["MaxThreshold"].ToString());
				}

				return Details;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #6
0
		public void Update(ProductInventoryDetails Details)
		{
			try 
			{
				string SQL=	"UPDATE tblInventory SET " + 
							"ProductID = @ProductID, " +  
							"Quantity = @Quantity, " +  
							"ProductUnitID = @ProductUnitID, " +  
							"MinThreshold = @MinThreshold, " + 
							"MaxThreshold = @MaxThreshold " + 
							"WHERE InventoryID = @InventoryID;";
							
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmProductID = new MySqlParameter("@ProductID",MySqlDbType.Int32);			
				prmProductID.Value = Details.ProductID;
				cmd.Parameters.Add(prmProductID);

				MySqlParameter prmQuantity = new MySqlParameter("@Quantity",MySqlDbType.Int32);	
				prmQuantity.Value = Details.Quantity;
				cmd.Parameters.Add(prmQuantity);

				MySqlParameter prmProductUnitID = new MySqlParameter("@ProductUnitID",MySqlDbType.Int32);			
				prmProductUnitID.Value = Details.ProductUnitID;
				cmd.Parameters.Add(prmProductUnitID);

				MySqlParameter prmMinThreshold = new MySqlParameter("@MinThreshold",MySqlDbType.Int32);			
				prmMinThreshold.Value = Details.MinThreshold;
				cmd.Parameters.Add(prmMinThreshold);

				MySqlParameter prmMaxThreshold = new MySqlParameter("@MaxThreshold",MySqlDbType.Int32);			
				prmMaxThreshold.Value = Details.MaxThreshold;
				cmd.Parameters.Add(prmMaxThreshold);

				MySqlParameter prmInventoryID = new MySqlParameter("@InventoryID",MySqlDbType.Int32);	
				prmInventoryID.Value = Details.InventoryID;
				cmd.Parameters.Add(prmInventoryID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}