Example #1
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);
			}	
		}
Example #2
0
		private void LoadList()
		{	
			ProductGroupVariationsMatrix clsProductGroupVariationsMatrix = new ProductGroupVariationsMatrix();
			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(clsProductGroupVariationsMatrix.BaseList(Convert.ToInt64(lblGroupID.Text), SortField, sortoption)).DefaultView;
			}
			else
			{						
				string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
				PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariationsMatrix.Search(Convert.ToInt64(lblGroupID.Text), SearchKey, SortField, sortoption)).DefaultView;
			}

			clsProductGroupVariationsMatrix.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;
		}