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) { ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); clsProductGroupVariation.Delete(Convert.ToInt16(lblGroupID.Text), stIDs.Substring(0, stIDs.Length - 1)); clsProductGroupVariation.CommitAndDispose(); } return(boRetValue); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"], Session.SessionID); lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"], Session.SessionID); ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.List(Convert.ToInt32(lblGroupID.Text), "VariationType", SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsProductGroupVariation.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(); ProductGroup clsProductGroup = new ProductGroup(); ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(lblGroupID.Text)); cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString())); txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0"); txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0"); chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount; txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0"); txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0"); txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0"); }
private Int32 SaveRecord() { ProductGroupVariations clsProdVariation = new ProductGroupVariations(); ProductGroupVariationDetails clsDetails = new ProductGroupVariationDetails(); clsDetails.GroupID = Convert.ToInt16(lblProductGroupID.Text); clsDetails.VariationID = Convert.ToInt16(cboVariationType.SelectedItem.Value); clsDetails.VariationType = cboVariationType.SelectedItem.Text; int id = clsProdVariation.Insert(clsDetails); clsProdVariation.CommitAndDispose(); return(id); }
private void SaveRecord() { ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); ProductGroupVariationDetails clsDetails = new ProductGroupVariationDetails(); clsDetails.GroupID = Convert.ToInt16(lblProductGroupID.Text); clsDetails.VariationID = Convert.ToInt16(cboVariationType.SelectedItem.Value); // clsProdVariation.Delete(clsDetails.GroupID,lblProductGroupVariationID.Text); // clsProdVariation.Insert(clsDetails); clsProductGroupVariation.Update(clsDetails, Convert.ToInt32(lblProductGroupVariationID.Text)); clsProductGroupVariation.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"], Session.SessionID); ProductGroupVariations clsVariation = new ProductGroupVariations(); cboVariationType.DataTextField = "VariationType"; cboVariationType.DataValueField = "VariationID"; cboVariationType.DataSource = clsDataClass.DataReaderToDataTable(clsVariation.AvailableVariations(Convert.ToInt32(lblProductGroupID.Text), "VariationType", SortOption.Ascending)).DefaultView; cboVariationType.DataBind(); cboVariationType.SelectedIndex = cboVariationType.Items.Count - 1; clsVariation.CommitAndDispose(); }
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": ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); clsProductGroupVariation.Delete(int.Parse(lblGroupID.Text), chkList.Value); clsProductGroupVariation.CommitAndDispose(); Response.Redirect(lblReferrer.Text); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID) + "&groupid=" + Common.Encrypt(lblGroupID.Text, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; } }
private void LoadList() { ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations(); 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(clsProductGroupVariation.List(Convert.ToInt64(lblGroupID.Text), SortField, sortoption)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.Search(Convert.ToInt64(lblGroupID.Text), SearchKey, SortField, sortoption)).DefaultView; } clsProductGroupVariation.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; }