public Int32 Insert(ProductGroupVariationDetails Details)
		{
			try 
			{
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";
	 			
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				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);
			}	
		}
Esempio n. 2
0
        public Int32 Insert(ProductGroupVariationDetails Details)
        {
            try
            {
                Save(Details);

                string SQL = "SELECT LAST_INSERT_ID();";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                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);
            }
        }
		public void Update(ProductGroupVariationDetails Details, Int32 VarIDToUpdate)
		{
			try 
			{
				string SQL = "UPDATE tblProductGroupVariations SET " + 
					        "VariationID = @VariationID " +
					        "WHERE GroupID = @GroupID " +
					        "AND VariationID = @VarIDToUpdate;";
				 
				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("@VarIDToUpdate", VarIDToUpdate);

				base.ExecuteNonQuery(cmd);

				SQL = "UPDATE tblProductGroupVariationsMatrix a, tblProductGroupBaseVariationsMatrix b SET " + 
					        "VariationID = @VariationID " +
					    "WHERE a.MatrixID = b.MatrixID " +
					    "AND GroupID = @GroupID " +
					    "AND VariationID = @VarIDToUpdate;";
				  
				cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("@VarIDToUpdate", VarIDToUpdate);

				base.ExecuteNonQuery(cmd);
				
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Esempio n. 4
0
        public void Update(ProductGroupVariationDetails Details, Int32 VarIDToUpdate)
        {
            try
            {
                string SQL = "UPDATE tblProductGroupVariations SET " +
                             "VariationID = @VariationID " +
                             "WHERE GroupID = @GroupID " +
                             "AND VariationID = @VarIDToUpdate;";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("@VarIDToUpdate", VarIDToUpdate);

                base.ExecuteNonQuery(cmd);

                SQL = "UPDATE tblProductGroupVariationsMatrix a, tblProductGroupBaseVariationsMatrix b SET " +
                      "VariationID = @VariationID " +
                      "WHERE a.MatrixID = b.MatrixID " +
                      "AND GroupID = @GroupID " +
                      "AND VariationID = @VarIDToUpdate;";

                cmd             = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("@VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("@VarIDToUpdate", VarIDToUpdate);

                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Esempio n. 5
0
        public Int32 Save(ProductGroupVariationDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupVariations(@ProductGroupVariationID, @GroupID, @VariationID, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("ProductGroupVariationID", Details.ProductGroupVariationID);
                cmd.Parameters.AddWithValue("GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return(base.ExecuteNonQuery(cmd));
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Esempio n. 6
0
		private Int32 SaveRecord()
		{
			ProductGroupVariations clsProdVariation = new ProductGroupVariations();
			ProductGroupVariationDetails clsDetails = new ProductGroupVariationDetails();

			clsDetails.GroupID = Convert.ToInt16(lblProductGroupID.Text);
			clsDetails.VariationID = Convert.ToInt16(cboVariationType.SelectedItem.Value);
			clsDetails.VariationType = cboVariationType.SelectedItem.Text;

			int id = clsProdVariation.Insert(clsDetails);
			
			clsProdVariation.CommitAndDispose();

			return id;
		}
        public Int32 Save(ProductGroupVariationDetails Details)
        {
            try
            {
                string SQL = "CALL procSaveProductGroupVariations(@ProductGroupVariationID, @GroupID, @VariationID, @CreatedOn, @LastModified);";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("ProductGroupVariationID", Details.ProductGroupVariationID);
                cmd.Parameters.AddWithValue("GroupID", Details.GroupID);
                cmd.Parameters.AddWithValue("VariationID", Details.VariationID);
                cmd.Parameters.AddWithValue("CreatedOn", Details.CreatedOn == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.CreatedOn);
                cmd.Parameters.AddWithValue("LastModified", Details.LastModified == DateTime.MinValue ? Constants.C_DATE_MIN_VALUE : Details.LastModified);

                return base.ExecuteNonQuery(cmd);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Esempio n. 8
0
		private void SaveRecord()
		{
			ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
			ProductGroupVariationDetails clsDetails = new ProductGroupVariationDetails();

			clsDetails.GroupID = Convert.ToInt16(lblProductGroupID.Text);
			clsDetails.VariationID = Convert.ToInt16(cboVariationType.SelectedItem.Value);

			//			clsProdVariation.Delete(clsDetails.GroupID,lblProductGroupVariationID.Text);
			//			clsProdVariation.Insert(clsDetails);

			clsProductGroupVariation.Update(clsDetails, Convert.ToInt32(lblProductGroupVariationID.Text));
			
			clsProductGroupVariation.CommitAndDispose();
		}