public Int32 Insert(ProductCharacteristicsMatrixDetails Details)
		{
			try 
			{
				string SQL = "INSERT INTO tblProductCharacteristicsMatrix (ProductAttributeCode, ProductAttributeName) VALUES (@ProductAttributeCode, @ProductAttributeName);";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
//				MySqlParameter prmProductAttributeCode = new MySqlParameter("@ProductAttributeCode",MySqlDbType.String);			
//				prmProductAttributeCode.Value = Details.ProductAttributeCode;
//				cmd.Parameters.Add(prmProductAttributeCode);
//
//				MySqlParameter prmProductAttributeName = new MySqlParameter("@ProductAttributeName",MySqlDbType.String);			
//				prmProductAttributeName.Value = Details.ProductAttributeName;
//				cmd.Parameters.Add(prmProductAttributeName);

				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);
                

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

				return iID;
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}
Exemple #2
0
        public Int32 Insert(ProductCharacteristicsMatrixDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblProductCharacteristicsMatrix (ProductAttributeCode, ProductAttributeName) VALUES (@ProductAttributeCode, @ProductAttributeName);";



                MySqlCommand cmd = new MySqlCommand();


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

//				MySqlParameter prmProductAttributeCode = new MySqlParameter("@ProductAttributeCode",MySqlDbType.String);
//				prmProductAttributeCode.Value = Details.ProductAttributeCode;
//				cmd.Parameters.Add(prmProductAttributeCode);
//
//				MySqlParameter prmProductAttributeName = new MySqlParameter("@ProductAttributeName",MySqlDbType.String);
//				prmProductAttributeName.Value = Details.ProductAttributeName;
//				cmd.Parameters.Add(prmProductAttributeName);

                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);


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

                return(iID);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #3
0
        public ProductCharacteristicsMatrixDetails Details(Int32 ProductAttributeID)
        {
            try
            {
                string SQL = "SELECT * FROM tblProductCharacteristicsMatrix " +
                             "WHERE ProductAttributeID = @ProductAttributeID;";



                MySqlCommand cmd = new MySqlCommand();


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

                MySqlParameter prmProductAttributeID = new MySqlParameter("@ProductAttributeID", MySqlDbType.Int16);
                prmProductAttributeID.Value = ProductAttributeID;
                cmd.Parameters.Add(prmProductAttributeID);

                MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);

                ProductCharacteristicsMatrixDetails Details = new ProductCharacteristicsMatrixDetails();

                while (myReader.Read())
                {
//					Details.a = ProductAttributeID;
//					Details.ProductAttributeCode = myReader.GetString(1);
//					Details.ProductAttributeName = myReader.GetString(2);
                }

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Exemple #4
0
        public void Update(ProductCharacteristicsMatrixDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblProductCharacteristicsMatrix SET " +
                             "ProductAttributeCode = @ProductAttributeCode, " +
                             "ProductAttributeName = @ProductAttributeName " +
                             "WHERE ProductAttributeID = @ProductAttributeID;";



                MySqlCommand cmd = new MySqlCommand();


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

//				MySqlParameter prmProductAttributeCode = new MySqlParameter("@ProductAttributeCode",MySqlDbType.String);
//				prmProductAttributeCode.Value = Details.ProductAttributeCode;
//				cmd.Parameters.Add(prmProductAttributeCode);
//
//				MySqlParameter prmProductAttributeName = new MySqlParameter("@ProductAttributeName",MySqlDbType.String);
//				prmProductAttributeName.Value = Details.ProductAttributeName;
//				cmd.Parameters.Add(prmProductAttributeName);
//
//				MySqlParameter prmProductAttributeID = new MySqlParameter("@ProductAttributeID",MySqlDbType.Int16);
//				prmProductAttributeID.Value = Details.ProductAttributeID;
//				cmd.Parameters.Add(prmProductAttributeID);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
		public ProductCharacteristicsMatrixDetails Details(Int32 ProductAttributeID)
		{
			try
			{
				string SQL=	"SELECT * FROM tblProductCharacteristicsMatrix " +
							"WHERE ProductAttributeID = @ProductAttributeID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

				MySqlParameter prmProductAttributeID = new MySqlParameter("@ProductAttributeID",MySqlDbType.Int16);
				prmProductAttributeID.Value = ProductAttributeID;
				cmd.Parameters.Add(prmProductAttributeID);

				MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult);
				
				ProductCharacteristicsMatrixDetails Details = new ProductCharacteristicsMatrixDetails();

				while (myReader.Read()) 
				{
//					Details.a = ProductAttributeID;
//					Details.ProductAttributeCode = myReader.GetString(1);
//					Details.ProductAttributeName = myReader.GetString(2);
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}
		public void Update(ProductCharacteristicsMatrixDetails Details)
		{
			try 
			{
				string SQL=	"UPDATE tblProductCharacteristicsMatrix SET " + 
								"ProductAttributeCode = @ProductAttributeCode, " +  
								"ProductAttributeName = @ProductAttributeName " +  
							"WHERE ProductAttributeID = @ProductAttributeID;";
				  
				
	 			
				MySqlCommand cmd = new MySqlCommand();
				
				
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
//				MySqlParameter prmProductAttributeCode = new MySqlParameter("@ProductAttributeCode",MySqlDbType.String);			
//				prmProductAttributeCode.Value = Details.ProductAttributeCode;
//				cmd.Parameters.Add(prmProductAttributeCode);
//
//				MySqlParameter prmProductAttributeName = new MySqlParameter("@ProductAttributeName",MySqlDbType.String);			
//				prmProductAttributeName.Value = Details.ProductAttributeName;
//				cmd.Parameters.Add(prmProductAttributeName);
//
//				MySqlParameter prmProductAttributeID = new MySqlParameter("@ProductAttributeID",MySqlDbType.Int16);			
//				prmProductAttributeID.Value = Details.ProductAttributeID;
//				cmd.Parameters.Add(prmProductAttributeID);

				base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}