private void LoadRecord() { ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges(); ProductGroupChargeDetails clsDetails = clsProductGroupCharge.Details(Convert.ToInt64(lblChargeID.Text)); clsProductGroupCharge.CommitAndDispose(); cboChargeType.Items.Add(new ListItem(clsDetails.ChargeType, clsDetails.ChargeTypeID.ToString())); cboChargeType.SelectedIndex = cboChargeType.Items.IndexOf(cboChargeType.Items.FindByValue(clsDetails.ChargeTypeID.ToString())); txtChargeAmount.Text = clsDetails.ChargeAmount.ToString("#,##0.#0"); chkInPercent.Checked = Convert.ToBoolean(clsDetails.InPercent); }
private void SaveRecord() { ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges(); ProductGroupChargeDetails clsDetails = new ProductGroupChargeDetails(); clsDetails.ChargeID = Convert.ToInt64(lblChargeID.Text); clsDetails.GroupID = Convert.ToInt64(lblProductGroupID.Text); clsDetails.ChargeTypeID = Convert.ToInt32(cboChargeType.SelectedItem.Value); clsDetails.ChargeType = cboChargeType.SelectedItem.Text; clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text); clsDetails.InPercent = chkInPercent.Checked; clsProductGroupCharge.Update(clsDetails); clsProductGroupCharge.CommitAndDispose(); }
private void LoadOptions() { DataClass clsDataClass = new DataClass(); lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID); ProductGroupCharges clsCharge = new ProductGroupCharges(); cboChargeType.DataTextField = "ChargeType"; cboChargeType.DataValueField = "ChargeTypeID"; cboChargeType.DataSource = clsDataClass.DataReaderToDataTable(clsCharge.AvailableCharges(Convert.ToInt64(lblProductGroupID.Text), "ChargeType",SortOption.Ascending)).DefaultView; cboChargeType.DataBind(); cboChargeType.SelectedIndex = cboChargeType.Items.Count - 1; clsCharge.CommitAndDispose(); cboChargeType_SelectedIndexChanged(null, null); }
private void LoadList() { ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges(); DataClass clsDataClass = new DataClass(); if (Request.QueryString["Search"]==null) { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.List(Convert.ToInt64(lblGroupID.Text),"ChargeType",SortOption.Ascending)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.Search(Convert.ToInt64(lblGroupID.Text),SearchKey, "ChargeType", SortOption.Ascending)).DefaultView; } clsProductGroupCharge.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; }
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) { ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges(); clsProductGroupCharge.Delete(Convert.ToInt64(lblGroupID.Text),stIDs.Substring(0,stIDs.Length-1)); clsProductGroupCharge.CommitAndDispose(); } return boRetValue; }