public Int64 InsertBaseVariation(ProductSubGroupBaseVariationsMatrixDetails Details)
		{
			try 
			{
                ProductSubGroupBaseVariationsMatrix clsProductSubGroupBaseVariationsMatrix = new ProductSubGroupBaseVariationsMatrix(base.Connection, base.Transaction);
                return clsProductSubGroupBaseVariationsMatrix.Insert(Details);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Пример #2
0
        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);
        }
Пример #3
0
        private void LoadRecord()
        {
            ProductSubGroupVariationsMatrix            clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix();
            ProductSubGroupBaseVariationsMatrixDetails clsBaseDetails = clsProductSubGroupVariationsMatrix.BaseDetails(Convert.ToInt32(lblMatrixID.Text), Convert.ToInt32(lblSubGroupID.Text));

            clsProductSubGroupVariationsMatrix.CommitAndDispose();

            cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsBaseDetails.UnitID.ToString()));
            txtProductPrice.Text  = clsBaseDetails.Price.ToString("#,##0.#0");
            txtPurchasePrice.Text = clsBaseDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsBaseDetails.IncludeInSubtotalDiscount;
            txtVAT.Text      = clsBaseDetails.VAT.ToString("#,##0.#0");
            txtEVAT.Text     = clsBaseDetails.EVAT.ToString("#,##0.#0");
            txtLocalTax.Text = clsBaseDetails.LocalTax.ToString("#,##0.#0");
        }
		public bool UpdateBaseVariation(ProductSubGroupBaseVariationsMatrixDetails Details)
		{
			try 
			{
                ProductSubGroupBaseVariationsMatrix clsProductSubGroupBaseVariationsMatrix = new ProductSubGroupBaseVariationsMatrix(base.Connection, base.Transaction);
                clsProductSubGroupBaseVariationsMatrix.Update(Details);

				return true;
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
		public ProductSubGroupBaseVariationsMatrixDetails BaseDetails(Int64 MatrixID, Int64 SubGroupID)
		{
			try
			{
				string SQL=	"SELECT " +
								"MatrixID, " +
								"SubGroupID, " +
								"description, " +
								"a.UnitID, " +
								"b.UnitName, " +
								"a.Price, " +
								"a.PurchasePrice, " +
								"a.IncludeInSubtotalDiscount, " +
								"a.VAT, " +
								"a.EVAT, " +
								"a.LocalTax " +
							"FROM tblProductSubGroupBaseVariationsMatrix a INNER JOIN " +
							"tblUnit b ON a.UnitID = b.UnitID " +
							"WHERE MatrixID = @MatrixID AND a.SubGroupID = @SubGroupID;"; 

				
	 			
				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 prmSubGroupID = new MySqlParameter("@SubGroupID",MySqlDbType.Int64);			
				prmSubGroupID.Value = SubGroupID;
				cmd.Parameters.Add(prmSubGroupID);

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

				while (myReader.Read()) 
				{
					Details.MatrixID = myReader.GetInt64("MatrixID");
					Details.SubGroupID = myReader.GetInt64("SubGroupID");
					Details.Description = "" + myReader["Description"].ToString();
					Details.UnitID = myReader.GetInt32("UnitID");
					Details.UnitName = "" + myReader["UnitName"].ToString();
					Details.Price = myReader.GetDecimal("Price");
					Details.PurchasePrice = myReader.GetDecimal("PurchasePrice");
					Details.IncludeInSubtotalDiscount = myReader.GetBoolean("IncludeInSubtotalDiscount");
					Details.VAT = myReader.GetDecimal("VAT");
					Details.EVAT = myReader.GetDecimal("EVAT");
					Details.LocalTax = myReader.GetDecimal("LocalTax");
				}

				myReader.Close();

				return Details;
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
Пример #6
0
		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);
			}	
		}
Пример #7
0
		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;
		}