private void LoadRecord() { Int16 iID = Convert.ToInt16(Common.Decrypt(Request.QueryString["id"], Session.SessionID)); Positions clsPosition = new Positions(); PositionDetails clsDetails = clsPosition.Details(iID); clsPosition.CommitAndDispose(); lblPositionID.Text = clsDetails.PositionID.ToString(); txtPositionCode.Text = clsDetails.PositionCode; txtPositionName.Text = clsDetails.PositionName; }
private Int16 SaveRecord() { Positions clsPosition = new Positions(); PositionDetails clsDetails = new PositionDetails(); clsDetails.PositionCode = txtPositionCode.Text; clsDetails.PositionName = txtPositionName.Text; Int16 id = clsPosition.Insert(clsDetails); clsPosition.CommitAndDispose(); return id; }
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) { Positions clsPosition = new Positions(); clsPosition.Delete( stIDs.Substring(0,stIDs.Length-1)); clsPosition.CommitAndDispose(); } return boRetValue; }
private void LoadList() { Positions clsPosition = new Positions(); DataClass clsDataClass = new DataClass(); string SortField = "PositionID"; 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(clsPosition.List(SortField, sortoption, 0)).DefaultView; } else { string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID); PageData.DataSource = clsDataClass.DataReaderToDataTable(clsPosition.Search(SearchKey, SortField, sortoption, 0)).DefaultView; } clsPosition.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; }
protected void lstItem_ItemCommand(object sender, DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); string stParam = string.Empty; switch (e.CommandName) { case "imgItemDelete": Positions clsPosition = new Positions(); clsPosition.Delete(chkList.Value); clsPosition.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 SaveRecord() { Positions clsPosition = new Positions(); PositionDetails clsDetails = new PositionDetails(); clsDetails.PositionID = Convert.ToInt16(lblPositionID.Text); clsDetails.PositionCode = txtPositionCode.Text; clsDetails.PositionName = txtPositionName.Text; clsPosition.Update(clsDetails); clsPosition.CommitAndDispose(); }