Ejemplo n.º 1
0
		private void SaveRecord()
		{
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsDetails = new ProductGroupUnitsMatrixDetails();

			clsDetails.MatrixID = Convert.ToInt64(lblMatrixID.Text);
			clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text);
			clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text);
			clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
			clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
			clsUnitMatrix.Update(clsDetails);
			
			clsUnitMatrix.CommitAndDispose();
		}
Ejemplo n.º 2
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			lblMatrixID.Text = iID.ToString();

			Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"],Session.SessionID));
			lblGroupID.Text = groupid.ToString();

			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			
			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid,"UnitName",SortOption.Ascending)).DefaultView;
			cboBottomUnit.DataBind();
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();	
		}
Ejemplo n.º 3
0
		private void LoadOptions()
		{

			DataClass clsDataClass = new DataClass();

			Int64 iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["id"],Session.SessionID));

            Data.Unit clsUnit = new Data.Unit();
			
			cboProductGroupUnit.DataTextField = "UnitName";
			cboProductGroupUnit.DataValueField = "UnitID";
			cboProductGroupUnit.DataSource = clsUnit.ListAsDataTable().DefaultView;
			cboProductGroupUnit.DataBind();
			cboProductGroupUnit.SelectedIndex = cboProductGroupUnit.Items.Count - 1;

			clsUnit.CommitAndDispose();		

			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(iID);
			clsUnitMatrix.CommitAndDispose();
			if (clsUnitDetails.BottomUnitName == null)
			{
				cboProductGroupUnit.Enabled = true;
			}
		}
Ejemplo n.º 4
0
		private void LoadRecord()
		{
			Int64 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID));
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsDetails = clsUnitMatrix.Details(iID);
			
			lblBaseUnitID.Text = clsDetails.BaseUnitID.ToString();
			txtBaseUnit.Text = Convert.ToString(clsDetails.BaseUnitName);
			txtBaseUnitValue.Text = clsDetails.BaseUnitValue.ToString();
			
			//			cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(clsDetails.BottomUnitID.ToString()));
			txtBottomUnitValue.Text = clsDetails.BottomUnitValue.ToString();

			clsUnitMatrix.CommitAndDispose();

		}
Ejemplo n.º 5
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			Int64 groupid = Convert.ToInt64(Common.Decrypt(Request.QueryString["groupid"].ToString(),Session.SessionID));
			lblGroupID.Text = Convert.ToString(groupid);
			
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsUnitDetails = clsUnitMatrix.LastDetails(groupid);

			if (clsUnitDetails.BottomUnitName == null)
			{
				ProductGroup clsProductGroup = new ProductGroup();
				ProductGroupDetails clsDetails = clsProductGroup.Details(groupid);
				clsProductGroup.CommitAndDispose();

				txtBaseUnit.Text = clsDetails.UnitDetails.UnitName;
				lblBaseUnitID.Text = clsDetails.UnitDetails.UnitID.ToString();
			}
			else
			{
				txtBaseUnit.Text = clsUnitDetails.BottomUnitName;
				lblBaseUnitID.Text = Convert.ToString(clsUnitDetails.BottomUnitID);
			}

			cboBottomUnit.DataTextField = "UnitName";
			cboBottomUnit.DataValueField = "UnitID";
			cboBottomUnit.DataSource = clsDataClass.DataReaderToDataTable(clsUnitMatrix.AvailableUnitsForProduct(groupid,"UnitName",SortOption.Ascending)).DefaultView;
			cboBottomUnit.DataBind();
			if (cboBottomUnit.Items.Contains( new ListItem(txtBaseUnit.Text, lblBaseUnitID.Text)))
			{
				cboBottomUnit.Items.RemoveAt( cboBottomUnit.Items.IndexOf(cboBottomUnit.Items.FindByValue(lblBaseUnitID.Text)));
			}
			cboBottomUnit.SelectedIndex = cboBottomUnit.Items.Count - 1;

			clsUnitMatrix.CommitAndDispose();
		}
Ejemplo n.º 6
0
		private Int64 SaveRecord()
		{
			ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
			ProductGroupUnitsMatrixDetails clsDetails = new ProductGroupUnitsMatrixDetails();

			clsDetails.GroupID = Convert.ToInt64(lblGroupID.Text);
			clsDetails.BaseUnitID = Convert.ToInt32(lblBaseUnitID.Text);
			clsDetails.BaseUnitValue = Convert.ToDecimal(txtBaseUnitValue.Text);
			clsDetails.BottomUnitID = Convert.ToInt32(cboBottomUnit.SelectedItem.Value);
			clsDetails.BottomUnitValue = Convert.ToDecimal(txtBottomUnitValue.Text);
			Int64 id = clsUnitMatrix.Insert(clsDetails);
			
			clsUnitMatrix.CommitAndDispose();

			return id;
		}
Ejemplo n.º 7
0
        protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            HtmlInputCheckBox chkList = null;
            string stParam = string.Empty;

            chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList");

            switch (e.CommandName)
            {
                case "imgItemDelete":
                    ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
                    clsUnitMatrix.Delete(chkList.Value);
                    clsUnitMatrix.CommitAndDispose();

                    LoadList();
                    break;
                case "imgItemEdit":
                    stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&subgroupid=" + Common.Encrypt(lblSubGroupID.Text, Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID);
                    Response.Redirect("Default.aspx" + stParam);
                    break;
            }
        }
Ejemplo n.º 8
0
		private bool Delete()
		{
			bool boRetValue = false;
			string stIDs = "";

			foreach(DataListItem item in lstItem.Items)
			{
				HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList");
				if (chkList!=null)
				{
					if (chkList.Checked == true)
					{
						stIDs += chkList.Value + ",";		
						boRetValue = true;
					}
				}
			}
			if (boRetValue)
			{
				ProductGroupUnitsMatrix clsUnitMatrix = new ProductGroupUnitsMatrix();
				clsUnitMatrix.Delete(stIDs.Substring(0,stIDs.Length-1));
				clsUnitMatrix.CommitAndDispose();
			}

			return boRetValue;
		}
Ejemplo n.º 9
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;
		}