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) { ChargeType clsChargeType = new ChargeType(); clsChargeType.Delete(stIDs.Substring(0, stIDs.Length - 1)); clsChargeType.CommitAndDispose(); } return(boRetValue); }
protected void cboChargeType_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboChargeType.Items.Count != 0) { ChargeType clsChargeType = new ChargeType(); ChargeTypeDetails clsDetails = clsChargeType.Details(Convert.ToInt32(cboChargeType.SelectedItem.Value)); clsChargeType.CommitAndDispose(); txtChargeAmount.Text = clsDetails.ChargeAmount.ToString("#,##0.#0"); chkInPercent.Checked = Convert.ToBoolean(clsDetails.InPercent); } }
private void SaveRecord() { ChargeType clsChargeType = new ChargeType(); ChargeTypeDetails clsDetails = new ChargeTypeDetails(); clsDetails.ChargeTypeCode = txtChargeTypeCode.Text; clsDetails.ChargeType = txtChargeType.Text; clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text); clsDetails.InPercent = chkInPercent.Checked; clsDetails.ChargeTypeID = Convert.ToInt32(lblChargeTypeID.Text); clsChargeType.Update(clsDetails); clsChargeType.CommitAndDispose(); }
private void LoadRecord() { Int32 iID = Convert.ToInt32(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); ChargeType clsChargeType = new ChargeType(); ChargeTypeDetails clsDetails = clsChargeType.Details(iID); clsChargeType.CommitAndDispose(); lblChargeTypeID.Text = clsDetails.ChargeTypeID.ToString(); txtChargeTypeCode.Text = clsDetails.ChargeTypeCode; txtChargeType.Text = clsDetails.ChargeType; txtChargeAmount.Text = clsDetails.ChargeAmount.ToString("#,##0.#0"); chkInPercent.Checked = Convert.ToBoolean(clsDetails.InPercent); }
private Int32 SaveRecord() { ChargeType clsChargeType = new ChargeType(); ChargeTypeDetails clsDetails = new ChargeTypeDetails(); clsDetails.ChargeTypeCode = txtChargeTypeCode.Text; clsDetails.ChargeType = txtChargeType.Text; clsDetails.ChargeAmount = Convert.ToDecimal(txtChargeAmount.Text); clsDetails.InPercent = chkInPercent.Checked; Int32 id = clsChargeType.Insert(clsDetails); clsChargeType.CommitAndDispose(); return(id); }
protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); string stParam = string.Empty; switch (e.CommandName) { case "imgItemDelete": ChargeType clsChargeType = new ChargeType(); clsChargeType.Delete(chkList.Value); clsChargeType.CommitAndDispose(); LoadList(); break; case "imgItemEdit": stParam = "?task=" + Common.Encrypt("edit", Session.SessionID) + "&id=" + Common.Encrypt(chkList.Value, Session.SessionID); Response.Redirect("Default.aspx" + stParam); break; } }
private void LoadList() { ChargeType clsChargeType = new ChargeType(); DataClass clsDataClass = new DataClass(); string SortField = "ChargeTypeID"; 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 = clsChargeType.ListAsDataTable(SearchKey, SortField, sortoption).DefaultView; clsChargeType.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; }