Пример #1
0
		private void LoadItems()
		{
			DataClass clsDataClass = new DataClass();

			ProductComposition clsProductComposition = new ProductComposition();
			lstItem.DataSource = clsProductComposition.ListAsDataTable(Convert.ToInt64(lblProductID.Text), "CompositionID",SortOption.Ascending).DefaultView;
			lstItem.DataBind();
			clsProductComposition.CommitAndDispose();
		}
Пример #2
0
		private bool DeleteItems()
		{
			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)
			{
				ProductComposition clsProductComposition = new ProductComposition();
				clsProductComposition.Delete( stIDs.Substring(0,stIDs.Length-1));

				clsProductComposition.CommitAndDispose();
			}

			return boRetValue;
		}
Пример #3
0
		private void UpdateItem()
		{
			if (isChkListSingle() == true)
			{
				string stID = GetFirstID();
				if (stID!=null)
				{
					ProductComposition clsProductComposition = new ProductComposition();
					ProductCompositionDetails clsDetails = clsProductComposition.Details(Convert.ToInt64(stID));
					clsProductComposition.CommitAndDispose();

					cboProductCode.Items.Clear();
					cboVariation.Items.Clear();
					cboProductUnit.Items.Clear();

					cboProductCode.Items.Add(new ListItem(clsDetails.ProductCode, clsDetails.ProductID.ToString()));
					cboProductCode.SelectedIndex = 0;
					if (clsDetails.VariationMatrixID == 0)
					{	cboVariation.Items.Add(new ListItem("No Variation", "0"));	}
					else
					{	cboVariation.Items.Add(new ListItem(clsDetails.MatrixDescription, clsDetails.VariationMatrixID.ToString()));	}
					cboVariation.SelectedIndex = 0;
					cboProductUnit.Items.Add(new ListItem(clsDetails.UnitCode, clsDetails.UnitID.ToString()));
					cboProductUnit.SelectedIndex = 0;
					txtQuantity.Text = clsDetails.Quantity.ToString("###0.#0");
					lblCompositionID.Text = stID;
				}
			}
			else
			{
				string stScript = "<Script>";
				stScript += "window.alert('Cannot update more than one record. Please select at least one record to update.')";
				stScript += "</Script>";
				Response.Write(stScript);	
			}
		}
Пример #4
0
		private void SaveRecord()
		{
			ProductCompositionDetails clsDetails = new ProductCompositionDetails();

			clsDetails.MainProductID = Convert.ToInt64(lblProductID.Text);
			clsDetails.ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
			clsDetails.VariationMatrixID = Convert.ToInt64(cboVariation.SelectedItem.Value);
			clsDetails.Quantity = Convert.ToDecimal(txtQuantity.Text);
			clsDetails.UnitID = Convert.ToInt32(cboProductUnit.SelectedItem.Value);

			ProductComposition clsProductComposition = new ProductComposition();
			if (lblCompositionID.Text != "0")
			{
				clsDetails.CompositionID = Convert.ToInt64(lblCompositionID.Text);
				clsProductComposition.Update(clsDetails);
			}
			else
				clsProductComposition.Insert(clsDetails);
			
			clsProductComposition.CommitAndDispose();

		}