Beispiel #1
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID);
			lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.List(Convert.ToInt32(lblSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
			lstItem.DataBind();
			clsProductSubGroupVariation.CommitAndDispose();

            Data.Unit clsUnit = new Data.Unit();
			cboUnit.DataTextField = "UnitName";
			cboUnit.DataValueField = "UnitID";
			cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
			cboUnit.DataBind();
			cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
			clsUnit.CommitAndDispose();	
		}
Beispiel #2
0
		private void LoadList()
		{	
			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			DataClass clsDataClass = new DataClass();

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

			clsProductSubGroupVariation.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;
		}
Beispiel #3
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)
			{
				ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
				clsProductSubGroupVariation.Delete(Convert.ToInt16(lblSubGroupID.Text),stIDs.Substring(0,stIDs.Length-1));
				clsProductSubGroupVariation.CommitAndDispose();
			}

			return boRetValue;
		}
Beispiel #4
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");
            stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&subgroupid=" + Common.Encrypt(chkList.Value, Session.SessionID);

            switch (e.CommandName)
            {
                case "imgItemDelete":
                    ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
                    clsProductSubGroupVariation.Delete(long.Parse(lblSubGroupID.Text), chkList.Value);
                    clsProductSubGroupVariation.CommitAndDispose();

                    Response.Redirect(lblReferrer.Text);
                    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;
            }
        }
Beispiel #5
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();
			lblProductSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID);
			lblProductSubGroupVariationID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);

			Variation clsVariation = new Variation();
			string VariationType = clsVariation.Details( Convert.ToInt32(lblProductSubGroupVariationID.Text)).VariationType;
			clsVariation.CommitAndDispose();

			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			
			cboVariationType.DataTextField = "VariationType";
			cboVariationType.DataValueField = "VariationID";
			cboVariationType.DataSource =  clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.AvailableVariations(Convert.ToInt32(lblProductSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
			cboVariationType.DataBind();
			cboVariationType.Items.Add(new ListItem(VariationType, lblProductSubGroupVariationID.Text));
			cboVariationType.SelectedIndex = cboVariationType.Items.Count - 1;

			clsProductSubGroupVariation.CommitAndDispose();		
		}
Beispiel #6
0
		private void SaveRecord()
		{
			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			ProductSubGroupVariationDetails clsDetails = new ProductSubGroupVariationDetails();

			clsDetails.SubGroupID = Convert.ToInt64(lblProductSubGroupID.Text);
			clsDetails.VariationID = Convert.ToInt32(cboVariationType.SelectedItem.Value);
			
			clsProductSubGroupVariation.Update(clsDetails, Convert.ToInt32(lblProductSubGroupVariationID.Text));
			
			clsProductSubGroupVariation.CommitAndDispose();
		}
Beispiel #7
0
		private void LoadOptions()
		{
			DataClass clsDataClass = new DataClass();

			lblSubGroupID.Text = Common.Decrypt((string)Request.QueryString["subgroupid"],Session.SessionID);

			ProductSubGroupVariations clsProductSubGroupVariation = new ProductSubGroupVariations();
			lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductSubGroupVariation.List(Convert.ToInt32(lblSubGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
			lstItem.DataBind();
			clsProductSubGroupVariation.CommitAndDispose();

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

			ProductSubGroup clsProductSubGroup = new ProductSubGroup();
			ProductSubGroupDetails clsProductSubGroupDetails = clsProductSubGroup.Details(Convert.ToInt32(lblSubGroupID.Text));
			clsProductSubGroup.CommitAndDispose();

			cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductSubGroupDetails.BaseUnitID.ToString()));
			txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
			txtProductPrice.Text = clsProductSubGroupDetails.Price.ToString("#,##0.#0");
			txtPurchasePrice.Text = clsProductSubGroupDetails.PurchasePrice.ToString("#,##0.#0");
            chkIncludeInSubtotalDiscount.Checked = clsProductSubGroupDetails.IncludeInSubtotalDiscount;
			txtVAT.Text = clsProductSubGroupDetails.VAT.ToString("#,##0.#0");
			txtEVAT.Text = clsProductSubGroupDetails.EVAT.ToString("#,##0.#0");
			txtLocalTax.Text = clsProductSubGroupDetails.LocalTax.ToString("#,##0.#0");
			
		}
Beispiel #8
0
		private Int32 SaveRecord()
		{
			ProductSubGroupVariations clsProdSubVariation = new ProductSubGroupVariations();
			ProductSubGroupVariationDetails clsDetails = new ProductSubGroupVariationDetails();

			clsDetails.SubGroupID = Convert.ToInt16(lblProductSubGroupID.Text);
			clsDetails.VariationID = Convert.ToInt16(cboVariationType.SelectedItem.Value);
			clsDetails.VariationType = cboVariationType.SelectedItem.Text;

			int id = clsProdSubVariation.Insert(clsDetails);
			
			clsProdSubVariation.CommitAndDispose();

			return id;
		}