Ejemplo n.º 1
0
		public void InheritGroupUnitMatrix(Int64 ProductGroupID, Int64 ProductSubGroupID)
		{
			try 
			{	
				

				ProductGroupUnitsMatrix clsProductGroupUnitsMatrix = new ProductGroupUnitsMatrix(base.Connection, base.Transaction);

				ProductSubGroupUnitsMatrix clsUnitMatrix = new ProductSubGroupUnitsMatrix(base.Connection, base.Transaction);
				ProductSubGroupUnitsMatrixDetails clsProductSubGroupUnitsMatrixDetails = new ProductSubGroupUnitsMatrixDetails();

				MySqlDataReader clsProductGroupUnitsMatrixList = clsProductGroupUnitsMatrix.List(ProductGroupID,"MatrixID",SortOption.Ascending);
				
				while (clsProductGroupUnitsMatrixList.Read())
				{
					clsProductSubGroupUnitsMatrixDetails.SubGroupID = Convert.ToInt64(ProductSubGroupID);
					clsProductSubGroupUnitsMatrixDetails.BaseUnitID = Convert.ToInt32(clsProductGroupUnitsMatrixList["BaseUnitID"]);
					clsProductSubGroupUnitsMatrixDetails.BaseUnitValue = Convert.ToDecimal(clsProductGroupUnitsMatrixList["BaseUnitValue"]);
					clsProductSubGroupUnitsMatrixDetails.BottomUnitID = Convert.ToInt32(clsProductGroupUnitsMatrixList["BottomUnitID"]);
					clsProductSubGroupUnitsMatrixDetails.BottomUnitValue = Convert.ToDecimal(clsProductGroupUnitsMatrixList["BottomUnitValue"]);
					clsUnitMatrix.Insert(clsProductSubGroupUnitsMatrixDetails);

				}
				clsProductGroupUnitsMatrixList.Close();
			}

			catch (Exception ex)
			{
				
				
				{
					
					
					
					
				}

				throw base.ThrowException(ex);
			}	
		}
Ejemplo n.º 2
0
		private void LoadList()
		{	
			ProductGroupUnitsMatrix clsProductGroupUnitsMatrix = new ProductGroupUnitsMatrix();
			DataClass clsDataClass = new DataClass();

			string SortField = "BaseUnitValue";
			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(clsProductGroupUnitsMatrix.List(Convert.ToInt64(lblGroupID.Text), SortField, sortoption)).DefaultView;
			}
			else
			{						
				string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
				PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupUnitsMatrix.Search(lblGroupID.Text, SortField, sortoption)).DefaultView;
			}

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