private Int32 SaveRecord() { Discount clsDiscount = new Discount(); DiscountDetails clsDetails = new DiscountDetails(); clsDetails.DiscountCode = txtDiscountCode.Text; clsDetails.DiscountType = txtDiscountType.Text; clsDetails.DiscountPrice = Convert.ToDecimal(txtDiscountPrice.Text); clsDetails.InPercent = Convert.ToBoolean(chkInPercent.Checked); int id = clsDiscount.Insert(clsDetails); clsDiscount.CommitAndDispose(); return id; }
private void SaveRecord() { Discount clsDiscount = new Discount(); DiscountDetails clsDetails = new DiscountDetails(); clsDetails.DiscountID = Convert.ToInt16(lblDiscountID.Text); clsDetails.DiscountCode = txtDiscountCode.Text; clsDetails.DiscountType = txtDiscountType.Text; clsDetails.DiscountPrice = Convert.ToDecimal(txtDiscountPrice.Text); clsDetails.InPercent = Convert.ToBoolean(chkInPercent.Checked); clsDiscount.Update(clsDetails); clsDiscount.CommitAndDispose(); }
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) { Discount clsDiscount = new Discount(); clsDiscount.Delete( stIDs.Substring(0,stIDs.Length-1)); clsDiscount.CommitAndDispose(); } return boRetValue; }
private void LoadRecord() { Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"],Session.SessionID)); Discount clsDiscount = new Discount(); DiscountDetails clsDetails = clsDiscount.Details(iID); clsDiscount.CommitAndDispose(); lblDiscountID.Text = Convert.ToString(clsDetails.DiscountID); txtDiscountCode.Text = clsDetails.DiscountCode; txtDiscountType.Text = clsDetails.DiscountType; txtDiscountPrice.Text = clsDetails.DiscountPrice.ToString(); chkInPercent.Checked = Convert.ToBoolean(clsDetails.InPercent); }
private void LoadList() { Discount clsDiscount = new Discount(); DataClass clsDataClass = new DataClass(); string SortField = "DiscountID"; 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); } string SearchKey = ""; if (Request.QueryString["Search"]!=null) { SearchKey = Common.Decrypt((string)Request.QueryString["search"], Session.SessionID); } PageData.DataSource = clsDiscount.ListAsDataTable(SearchKey, SortField, sortoption).DefaultView; clsDiscount.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; }