Exemple #1
0
		private void LoadList()
		{	
			ProductSubGroupVariationsMatrix clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix();
			DataClass clsDataClass = new DataClass();

			string SortField = "MatrixID";
			if (Request.QueryString["sortfield"]!=null)
			{	SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID);	}
			
			SortOption sortoption = SortOption.Ascending;
			if (Request.QueryString["sortoption"]!=null)
			{	sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true);	}

			if (Request.QueryString["Search"]==null)
			{
				PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariationsMatrix.BaseList(Convert.ToInt64(lblSubGroupID.Text), SortField, sortoption)).DefaultView;
			}
			else
			{						
				string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
				PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariationsMatrix.Search(Convert.ToInt64(lblSubGroupID.Text), SearchKey, SortField, sortoption)).DefaultView;
			}

			clsProductSubGroupVariationsMatrix.CommitAndDispose();

			int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
			
			PageData.AllowPaging = true;
			PageData.PageSize = iPageSize;
			try
			{
				PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;				
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}
			catch
			{
				PageData.CurrentPageIndex = 1;
				lstItem.DataSource = PageData;
				lstItem.DataBind();
			}			
			
			cboCurrentPage.Items.Clear();
			for (int i=0; i < PageData.PageCount;i++)
			{
				int iValue = i + 1;
				cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
				if (PageData.CurrentPageIndex == i)
				{	cboCurrentPage.Items[i].Selected = true;}
				else
				{	cboCurrentPage.Items[i].Selected = false;}
			}
			lblDataCount.Text = " of " + " " + PageData.PageCount;
		}
Exemple #2
0
		public void InheritSubGroupVariationsMatrix(Int64 ProductSubGroupID, Int64 ProductID, ProductDetails prodDetails)
		{
			try 
			{	
				

				ProductBaseVariationsMatrixDetails clsBaseDetails;

				ProductSubGroupVariationsMatrix clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(base.Connection, base.Transaction);

				ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction);
				ProductVariationsMatrixDetails  clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();

				MySqlDataReader clsProductSubGroupVariationsMatrixList;
				MySqlDataReader clsProductSubGroupBaseVariationsMatrixList = clsProductSubGroupVariationsMatrix.BaseList(ProductSubGroupID,"MatrixID",SortOption.Ascending);

				Int64 SubGroupBaseMatrixID = 0;

				while (clsProductSubGroupBaseVariationsMatrixList.Read())
				{
					clsBaseDetails = new ProductBaseVariationsMatrixDetails();
					clsBaseDetails.ProductID = ProductID;
					clsBaseDetails.Description = "" + clsProductSubGroupBaseVariationsMatrixList["Description"].ToString();
					clsBaseDetails.UnitID = Convert.ToInt32(clsProductSubGroupBaseVariationsMatrixList["UnitID"]);
					clsBaseDetails.Price = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["Price"]);
					clsBaseDetails.WSPrice = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["WSPrice"]);
					clsBaseDetails.PurchasePrice = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["PurchasePrice"]);
					clsBaseDetails.IncludeInSubtotalDiscount = Convert.ToBoolean(clsProductSubGroupBaseVariationsMatrixList["IncludeInSubtotalDiscount"]);
					clsBaseDetails.VAT = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["VAT"]);
					clsBaseDetails.EVAT = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["EVAT"]);
					clsBaseDetails.LocalTax = Convert.ToDecimal(clsProductSubGroupBaseVariationsMatrixList["LocalTax"]);
					clsBaseDetails.Quantity = 0;
					clsBaseDetails.MinThreshold = prodDetails.MinThreshold;
					clsBaseDetails.MaxThreshold = prodDetails.MaxThreshold;

					clsBaseDetails.MatrixID = clsProductVariationsMatrix.InsertBaseVariation(clsBaseDetails);

					SubGroupBaseMatrixID = clsProductSubGroupBaseVariationsMatrixList.GetInt64(0);
					clsProductSubGroupVariationsMatrix = new ProductSubGroupVariationsMatrix(base.Connection, base.Transaction);
					clsProductSubGroupVariationsMatrixList =  clsProductSubGroupVariationsMatrix.List(SubGroupBaseMatrixID);

					while (clsProductSubGroupVariationsMatrixList.Read())
					{
						clsProductVariationsMatrixDetails = new ProductVariationsMatrixDetails();
						clsProductVariationsMatrixDetails.MatrixID = clsBaseDetails.MatrixID;
						clsProductVariationsMatrixDetails.ProductID = ProductID;
						clsProductVariationsMatrixDetails.VariationID = Convert.ToInt64(clsProductSubGroupVariationsMatrixList["VariationID"]);
						clsProductVariationsMatrixDetails.Description = "" + clsProductSubGroupVariationsMatrixList["Description"].ToString();
						clsProductVariationsMatrix.SaveVariation(clsProductVariationsMatrixDetails);
					}
					clsProductSubGroupVariationsMatrixList.Close(); 

				}
				clsProductSubGroupBaseVariationsMatrixList.Close();

			}
				
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}