public Int32 Save(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL = "CALL procSaveProductSubGroupVariationsMatrix(@ProductSubGroupVariationsMatrixID, @MatrixID, @VariationID, @Description, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("ProductSubGroupVariationsMatrixID", Details.ProductSubGroupVariationsMatrixID); cmd.Parameters.AddWithValue("MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("VariationID", Details.VariationID); cmd.Parameters.AddWithValue("Description", Details.Description); 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); } }
public void Update(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL = "UPDATE tblProductSubGroupVariationsMatrix SET " + "Description = @Description " + "WHERE MatrixID = @MatrixID " + "AND VariationID = @VariationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@Description", Details.Description); cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("@VariationID", Details.VariationID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
public ProductSubGroupVariationsMatrixDetails Details(Int64 MatrixID, Int32 VariationID) { try { string SQL = "SELECT * FROM tblProductSubGroupVariationsMatrix " + "WHERE MatrixID = @MatrixID AND VariationID = @VariationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID", MySqlDbType.Int64); prmMatrixID.Value = MatrixID; cmd.Parameters.Add(prmMatrixID); MySqlParameter prmVariationID = new MySqlParameter("@VariationID", MySqlDbType.Int32); prmVariationID.Value = VariationID; cmd.Parameters.Add(prmVariationID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); ProductSubGroupVariationsMatrixDetails Details = new ProductSubGroupVariationsMatrixDetails(); while (myReader.Read()) { Details.MatrixID = MatrixID; Details.VariationID = VariationID; Details.Description = myReader.GetString(2); } myReader.Close(); return(Details); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public bool InsertVariation(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL = "INSERT INTO tblProductSubGroupVariationsMatrix (MatrixID, VariationID, Description) VALUES (@MatrixID, @VariationID, @Description);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("@VariationID", Details.VariationID); cmd.Parameters.AddWithValue("@Description", Details.Description); base.ExecuteNonQuery(cmd); return true; } catch (Exception ex) { throw base.ThrowException(ex); } }
public bool InsertVariation(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL = "INSERT INTO tblProductSubGroupVariationsMatrix (MatrixID, VariationID, Description) VALUES (@MatrixID, @VariationID, @Description);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("@VariationID", Details.VariationID); cmd.Parameters.AddWithValue("@Description", Details.Description); base.ExecuteNonQuery(cmd); return(true); } catch (Exception ex) { throw base.ThrowException(ex); } }
public ProductSubGroupVariationsMatrixDetails Details(Int64 MatrixID, Int32 VariationID) { try { string SQL= "SELECT * FROM tblProductSubGroupVariationsMatrix " + "WHERE MatrixID = @MatrixID AND VariationID = @VariationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; MySqlParameter prmMatrixID = new MySqlParameter("@MatrixID",MySqlDbType.Int64); prmMatrixID.Value = MatrixID; cmd.Parameters.Add(prmMatrixID); MySqlParameter prmVariationID = new MySqlParameter("@VariationID",MySqlDbType.Int32); prmVariationID.Value = VariationID; cmd.Parameters.Add(prmVariationID); MySqlDataReader myReader = base.ExecuteReader(cmd, System.Data.CommandBehavior.SingleResult); ProductSubGroupVariationsMatrixDetails Details = new ProductSubGroupVariationsMatrixDetails(); while (myReader.Read()) { Details.MatrixID = MatrixID; Details.VariationID = VariationID; Details.Description = myReader.GetString(2); } myReader.Close(); return Details; } catch (Exception ex) { { } throw base.ThrowException(ex); } }
public Int32 Save(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL = "CALL procSaveProductSubGroupVariationsMatrix(@ProductSubGroupVariationsMatrixID, @MatrixID, @VariationID, @Description, @CreatedOn, @LastModified);"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("ProductSubGroupVariationsMatrixID", Details.ProductSubGroupVariationsMatrixID); cmd.Parameters.AddWithValue("MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("VariationID", Details.VariationID); cmd.Parameters.AddWithValue("Description", Details.Description); 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); } }
public void Update(ProductSubGroupVariationsMatrixDetails Details) { try { string SQL= "UPDATE tblProductSubGroupVariationsMatrix SET " + "Description = @Description " + "WHERE MatrixID = @MatrixID " + "AND VariationID = @VariationID;"; MySqlCommand cmd = new MySqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@Description", Details.Description); cmd.Parameters.AddWithValue("@MatrixID", Details.MatrixID); cmd.Parameters.AddWithValue("@VariationID", Details.VariationID); base.ExecuteNonQuery(cmd); } catch (Exception ex) { throw base.ThrowException(ex); } }
public void InheritGroupVariationsMatrix(Int64 ProductGroupID, Int64 ProductSubGroupID) { try { ProductSubGroupBaseVariationsMatrixDetails clsSubGroupBaseDetails; ProductGroupVariationsMatrix clsProductGroupVariationsMatrix = new ProductGroupVariationsMatrix(base.Connection, base.Transaction); ProductSubGroupVariationsMatrix clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(base.Connection, base.Transaction); ProductSubGroupVariationsMatrixDetails clsProductSubGroupVariationsMatrixDetails = new ProductSubGroupVariationsMatrixDetails(); MySqlDataReader clsProductGroupVariationsMatrixList; MySqlDataReader clsProductGroupBaseVariationsMatrixList = clsProductGroupVariationsMatrix.BaseList(ProductGroupID,"MatrixID",SortOption.Ascending); Int64 GroupBaseMatrixID = 0; while (clsProductGroupBaseVariationsMatrixList.Read()) { clsSubGroupBaseDetails = new ProductSubGroupBaseVariationsMatrixDetails(); clsSubGroupBaseDetails.SubGroupID = ProductSubGroupID; clsSubGroupBaseDetails.Description = "" + clsProductGroupBaseVariationsMatrixList["Description"].ToString(); clsSubGroupBaseDetails.UnitID = Convert.ToInt32(clsProductGroupBaseVariationsMatrixList["UnitID"]); clsSubGroupBaseDetails.Price = Convert.ToDecimal(clsProductGroupBaseVariationsMatrixList["Price"]); clsSubGroupBaseDetails.PurchasePrice = Convert.ToDecimal(clsProductGroupBaseVariationsMatrixList["PurchasePrice"]); clsSubGroupBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(clsProductGroupBaseVariationsMatrixList["IncludeInSubtotalDiscount"]); clsSubGroupBaseDetails.VAT = Convert.ToDecimal(clsProductGroupBaseVariationsMatrixList["VAT"]); clsSubGroupBaseDetails.EVAT = Convert.ToDecimal(clsProductGroupBaseVariationsMatrixList["EVAT"]); clsSubGroupBaseDetails.LocalTax = Convert.ToDecimal(clsProductGroupBaseVariationsMatrixList["LocalTax"]); clsSubGroupBaseDetails.MatrixID = clsProductSubGroupVariationsMatrix.InsertBaseVariation(clsSubGroupBaseDetails); GroupBaseMatrixID = clsProductGroupBaseVariationsMatrixList.GetInt64(0); clsProductGroupVariationsMatrix = new ProductGroupVariationsMatrix(base.Connection, base.Transaction); clsProductGroupVariationsMatrixList = clsProductGroupVariationsMatrix.List(GroupBaseMatrixID); while (clsProductGroupVariationsMatrixList.Read()) { clsProductSubGroupVariationsMatrixDetails = new ProductSubGroupVariationsMatrixDetails(); clsProductSubGroupVariationsMatrixDetails.MatrixID = clsSubGroupBaseDetails.MatrixID; clsProductSubGroupVariationsMatrixDetails.SubGroupID = ProductSubGroupID; clsProductSubGroupVariationsMatrixDetails.VariationID = Convert.ToInt32(clsProductGroupVariationsMatrixList["VariationID"]); clsProductSubGroupVariationsMatrixDetails.Description = "" + clsProductGroupVariationsMatrixList["Description"].ToString(); clsProductSubGroupVariationsMatrix.InsertVariation(clsProductSubGroupVariationsMatrixDetails); } clsProductGroupVariationsMatrixList.Close(); } clsProductGroupBaseVariationsMatrixList.Close(); } catch (Exception ex) { { } throw base.ThrowException(ex); } }
private bool SaveRecord() { ProductSubGroupVariationsMatrixDetails clsDetails; ProductSubGroupVariationsMatrix clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(); string stringVariationDesc = null; foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); TextBox txtDescription = (TextBox) item.FindControl("txtDescription"); clsDetails = new ProductSubGroupVariationsMatrixDetails(); clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsDetails.SubGroupID = Convert.ToInt64(lblSubGroupID.Text); clsDetails.VariationID = Convert.ToInt32(chkList.Value); clsDetails.Description = txtDescription.Text; if (clsProductSubGroupVariationsMatrix.IsVariationExists(clsDetails.MatrixID, clsDetails.VariationID) == false) { clsProductSubGroupVariationsMatrix.InsertVariation(clsDetails); } else { clsProductSubGroupVariationsMatrix.Update(clsDetails); } HyperLink lnkVariationType = (HyperLink)item.FindControl("lnkVariationType"); stringVariationDesc += txtDescription.Text + "; "; } //update base variation matrix ProductSubGroupBaseVariationsMatrixDetails clsBaseDetails = new ProductSubGroupBaseVariationsMatrixDetails(); clsBaseDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text); clsBaseDetails.SubGroupID = Convert.ToInt64(lblSubGroupID.Text); clsBaseDetails.Description = stringVariationDesc; clsBaseDetails.UnitID = Convert.ToInt32(cboUnit.SelectedItem.Value); clsBaseDetails.Price = Convert.ToDecimal(txtProductPrice.Text); clsBaseDetails.PurchasePrice = Convert.ToDecimal(txtPurchasePrice.Text); clsBaseDetails.IncludeInSubtotalDiscount = chkIncludeInSubtotalDiscount.Checked; clsBaseDetails.VAT = Convert.ToDecimal(txtVAT.Text); clsBaseDetails.EVAT = Convert.ToDecimal(txtEVAT.Text); clsBaseDetails.LocalTax = Convert.ToDecimal(txtLocalTax.Text); clsProductSubGroupVariationsMatrix.UpdateBaseVariation(clsBaseDetails); clsProductSubGroupVariationsMatrix.CommitAndDispose(); return true; }