public static CustomList <OTSlab> GetAllOTSlab(string otSlabID) { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <OTSlab> OTSlabCollection = new CustomList <OTSlab>(); IDataReader reader = null; String sql = "select *from OTSlab where OTSlabID = " + otSlabID; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { OTSlab newOTSlab = new OTSlab(); newOTSlab.SetData(reader); OTSlabCollection.Add(newOTSlab); } return(OTSlabCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (IsPostBack.IsFalse()) { txtOTSlabID.Text = StaticInfo.NewIDString; txtOTSlabID.Enabled = false; InitializeSession(); } Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (Request["__EVENTTARGET"] == "SearchOTSlab") { ASL.Hr.DAO.OTSlab searchOTSlab = Session[ASL.STATIC.StaticInfo.SearchSessionVarName] as ASL.Hr.DAO.OTSlab; if (searchOTSlab.IsNotNull()) { txtOTSlabID.Text = searchOTSlab.OTSlabID; OTSlabList = manager.GetAllOTSlab(searchOTSlab.OTSlabID); } } } catch (Exception ex) { throw ex; } }
public static CustomList <OTSlab> GetAllOTSlab() { ConnectionManager conManager = new ConnectionManager(ConnectionName.HR); CustomList <OTSlab> OTSlabCollection = new CustomList <OTSlab>(); IDataReader reader = null; const String sql = "select Distinct OTSlabID from OTSlab"; try { conManager.OpenDataReader(sql, out reader); while (reader.Read()) { OTSlab newOTSlab = new OTSlab(); newOTSlab.SetDataOTSlab(reader); OTSlabCollection.Add(newOTSlab); } OTSlabCollection.InsertSpName = "spInsertOTSlab"; OTSlabCollection.UpdateSpName = "spUpdateOTSlab"; OTSlabCollection.DeleteSpName = "spDeleteOTSlab"; return(OTSlabCollection); } catch (Exception ex) { throw (ex); } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } } }