/// <summary> /// Finds and return cEmpLeave objects matching the specified criteria /// </summary> /// <param name="i_oFilter">Filter criteria (WHERE clause)</param> /// <returns>cEmpLeave objects</returns> public static List <cEmpLeave> Find(cFilter i_oFilter) { DataTable dt = Find_DataTable(i_oFilter, null); List <cEmpLeave> l = new List <cEmpLeave>(); cEmpLeave oObj; for (int i = 0; i < dt.Rows.Count; i++) { oObj = new cEmpLeave(); oObj.m_iID = Convert.ToInt32(dt.Rows[i]["iID"]); oObj.m_sName = dt.Rows[i]["sName"].ToString(); oObj.m_dtCreatedOn = Convert.ToDateTime(dt.Rows[i]["dtCreatedOn"]); oObj.m_dtLastUpdatedOn = Convert.ToDateTime(dt.Rows[i]["dtLastUpdatedOn"]); oObj.m_dtFromDate = Convert.ToDateTime(dt.Rows[i]["dtFromDate"]); oObj.m_dtToDate = Convert.ToDateTime(dt.Rows[i]["dtToDate"]); oObj.m_sReason = Convert.ToString(dt.Rows[i]["sReason"]); oObj.m_objLeaveType.iObjectID = Convert.ToInt32(dt.Rows[i]["objLeaveType"].ToString()); oObj.m_objEmpLogin.iObjectID = Convert.ToInt32(dt.Rows[i]["objEmpLogin"].ToString()); oObj.m_sLeaveStatus = Convert.ToString(dt.Rows[i]["sLeaveStatus"]); oObj.m_bIsActive = Convert.ToBoolean(dt.Rows[i]["bIsActive"]); oObj.m_iReportingHead = Convert.ToInt32(dt.Rows[i]["iReportingHead"]); oObj.m_bInvalid = false; l.Add(oObj); } return(l); }
/// <summary> /// Creates a cEmpLeave object. It will be saved in permanent storage only /// on calling Save() /// </summary> /// <returns>cEmpLeave object</returns> public static cEmpLeave Create() { cEmpLeave oObj = new cEmpLeave(); SecurityCheck((int)enEmpLeave_Action.Create); // Create an object in memory, will be saved to storage on calling Save() oObj.m_bCreating = true; oObj.m_bInvalid = false; return(oObj); }
/// <summary> /// Ensures that an object with the specified name exists, while creating other properties are set to their default values /// </summary> /// <param name="i_sName">Name</param> /// <returns>cEmpLeave object</returns> public static cEmpLeave CreateIfRequiredAndGet(string i_sName) { cEmpLeave oObj = cEmpLeave.Get_Name(i_sName); if (oObj == null) { oObj = cEmpLeave.Create(); oObj.sName = i_sName; oObj.Save(); } return(oObj); }
using System;