예제 #1
0
		public Int32 Insert(ProductSubAttributeDetails Details)
		{
			try 
			{
				string SQL = "INSERT INTO tblProductSubAttribute (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);
			}	
		}
예제 #2
0
        public Int32 Insert(ProductSubAttributeDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO tblProductSubAttribute (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);
            }
        }
예제 #3
0
        public ProductSubAttributeDetails Details(Int32 ProductAttributeID)
        {
            try
            {
                string SQL = "SELECT * FROM tblProductSubAttribute " +
                             "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);

                ProductSubAttributeDetails Details = new ProductSubAttributeDetails();

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

                myReader.Close();

                return(Details);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
예제 #4
0
        public void Update(ProductSubAttributeDetails Details)
        {
            try
            {
                string SQL = "UPDATE tblProductSubAttribute 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);
            }
        }
예제 #5
0
		public ProductSubAttributeDetails Details(Int32 ProductAttributeID)
		{
			try
			{
				string SQL=	"SELECT * FROM tblProductSubAttribute " +
							"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);
				
				ProductSubAttributeDetails Details = new ProductSubAttributeDetails();

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

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
					

				
				
				

				throw base.ThrowException(ex);
			}	
		}
예제 #6
0
		public void Update(ProductSubAttributeDetails Details)
		{
			try 
			{
				string SQL=	"UPDATE tblProductSubAttribute 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);
			}	
		}