public static bool Delete(Int32 id)
 {
     tblEmployee tblObj = new tblEmployee();
       int affectedRow = tblObj.DeleteTable(tblEmployee.PRIMARYKEY_FIELD1 + " = " + id);
       if (affectedRow != 1)
       throw new Exception("Could not find entry with id: " + id);
       else
       return true;
 }
Ejemplo n.º 2
0
 public static BOEmployee GetItem(Int32 id)
 {
     BOEmployee itemObj = null;
     tblEmployee tblObj = new tblEmployee();
     DataTable dt = tblObj.GetAllData(tblEmployee.PRIMARYKEY_FIELD1 + " = " + id);
     if (dt.Rows.Count > 1)
         throw new Exception("More than one row returned");
     if (dt.Rows.Count == 1)
         itemObj = FillDataRecord(dt.Rows[0]);
     return itemObj;
 }
Ejemplo n.º 3
0
 public static BOEmployeeList GetAllList(int startIndex, int length, string whereClause)
 {
     BOEmployeeList itemObjs = null;
     tblEmployee tblObj = new tblEmployee();
     DataTable dt = tblObj.GetAllData(startIndex, length, whereClause, null);
     if (dt.Rows.Count > 0)
     {
         itemObjs = new BOEmployeeList();
         foreach(DataRow dr in dt.Rows)
         {
             itemObjs.Add(FillDataRecord(dr));
         }
     }
     return itemObjs;
 }
Ejemplo n.º 4
0
 public static BOEmployeeList GetAllList()
 {
     BOEmployeeList itemObjs = null;
     tblEmployee tblObj = new tblEmployee();
     DataTable dt = tblObj.GetAllData();
     if (dt.Rows.Count > 0)
     {
         itemObjs = new BOEmployeeList();
         foreach(DataRow dr in dt.Rows)
         {
             itemObjs.Add(FillDataRecord(dr));
         }
     }
     return itemObjs;
 }
Ejemplo n.º 5
0
        public static BOEmployeeList GetAllList(int startIndex, int length, string whereClause)
        {
            BOEmployeeList itemObjs = null;
            tblEmployee    tblObj   = new tblEmployee();
            DataTable      dt       = tblObj.GetAllData(startIndex, length, whereClause, null);

            if (dt.Rows.Count > 0)
            {
                itemObjs = new BOEmployeeList();
                foreach (DataRow dr in dt.Rows)
                {
                    itemObjs.Add(FillDataRecord(dr));
                }
            }
            return(itemObjs);
        }
Ejemplo n.º 6
0
        public static BOEmployeeList GetAllList()
        {
            BOEmployeeList itemObjs = null;
            tblEmployee    tblObj   = new tblEmployee();
            DataTable      dt       = tblObj.GetAllData();

            if (dt.Rows.Count > 0)
            {
                itemObjs = new BOEmployeeList();
                foreach (DataRow dr in dt.Rows)
                {
                    itemObjs.Add(FillDataRecord(dr));
                }
            }
            return(itemObjs);
        }
Ejemplo n.º 7
0
        public static BOEmployee GetItem(Int32 id)
        {
            BOEmployee  itemObj = null;
            tblEmployee tblObj  = new tblEmployee();
            DataTable   dt      = tblObj.GetAllData(tblEmployee.PRIMARYKEY_FIELD1 + " = " + id);

            if (dt.Rows.Count > 1)
            {
                throw new Exception("More than one row returned");
            }
            if (dt.Rows.Count == 1)
            {
                itemObj = FillDataRecord(dt.Rows[0]);
            }
            return(itemObj);
        }
Ejemplo n.º 8
0
        public static int Save(BOEmployeeList entryList, bool adding)
        {
            tblEmployee tblObj = new tblEmployee();
            DataTable   dt     = tblObj.Table();
            int         i      = 0;

            foreach (BOEmployee entry in entryList)
            {
                DataRow newRow = tblObj.Table().NewRow();

                newRow[tblEmployee.FIRSTNAME_FIELD]    = entry.FirstName;
                newRow[tblEmployee.LASTNAME_FIELD]     = entry.LastName;
                newRow[tblEmployee.EMAILADDRESS_FIELD] = entry.EmailAddress;
                newRow[tblEmployee.PASSWORD_FIELD]     = entry.Password;
                newRow[tblEmployee.EMPLOYEETYPE_FIELD] = entry.EmployeeType;
                if (entry.CreatedOn.Equals(new DateTime()))
                {
                    newRow[tblEmployee.CREATEDON_FIELD] = DBNull.Value;
                }
                else
                {
                    newRow[tblEmployee.CREATEDON_FIELD] = entry.CreatedOn;
                }
                newRow[tblEmployee.CREATEDBYID_FIELD] = entry.CreatedByID;
                if (entry.ModifiedOn.Equals(new DateTime()))
                {
                    newRow[tblEmployee.MODIFIEDON_FIELD] = DBNull.Value;
                }
                else
                {
                    newRow[tblEmployee.MODIFIEDON_FIELD] = entry.ModifiedOn;
                }
                newRow[tblEmployee.MODIFIEDBYID_FIELD] = entry.ModifiedByID;
                newRow[tblEmployee.ISACTIVE_FIELD]     = entry.IsActive;

                dt.Rows.Add(newRow);
                i++;
            }

            //if(adding): Commented out at the moment. KS 28th Aug 2012
            return(tblObj.AddToTable(dt));
            //else
            //return tblObj.UpdateTable(dt);
        }
Ejemplo n.º 9
0
        public static int Save(BOEmployee entry, bool adding)
        {
            tblEmployee tblObj = new tblEmployee();
            DataRow     newRow = tblObj.Table().NewRow();

            newRow[tblEmployee.EMPLOYEEID_FIELD]   = entry.EmployeeID;
            newRow[tblEmployee.FIRSTNAME_FIELD]    = entry.FirstName;
            newRow[tblEmployee.LASTNAME_FIELD]     = entry.LastName;
            newRow[tblEmployee.EMAILADDRESS_FIELD] = entry.EmailAddress;
            newRow[tblEmployee.PASSWORD_FIELD]     = entry.Password;
            newRow[tblEmployee.EMPLOYEETYPE_FIELD] = entry.EmployeeType;
            if (entry.CreatedOn.Equals(new DateTime()))
            {
                newRow[tblEmployee.CREATEDON_FIELD] = DBNull.Value;
            }
            else
            {
                newRow[tblEmployee.CREATEDON_FIELD] = entry.CreatedOn;
            }
            newRow[tblEmployee.CREATEDBYID_FIELD] = entry.CreatedByID;
            if (entry.ModifiedOn.Equals(new DateTime()))
            {
                newRow[tblEmployee.MODIFIEDON_FIELD] = DBNull.Value;
            }
            else
            {
                newRow[tblEmployee.MODIFIEDON_FIELD] = entry.ModifiedOn;
            }
            newRow[tblEmployee.MODIFIEDBYID_FIELD] = entry.ModifiedByID;
            newRow[tblEmployee.ISACTIVE_FIELD]     = entry.IsActive;

            if (adding)
            {
                return(tblObj.AddToTable(newRow));
            }
            else
            {
                return(tblObj.UpdateTable(newRow));
            }
        }
Ejemplo n.º 10
0
      public static int Save(BOEmployee entry, bool adding)
      {
          tblEmployee tblObj = new tblEmployee();
          DataRow newRow = tblObj.Table().NewRow();

              newRow[tblEmployee.EMPLOYEEID_FIELD] = entry.EmployeeID;
              newRow[tblEmployee.FIRSTNAME_FIELD] = entry.FirstName;
              newRow[tblEmployee.LASTNAME_FIELD] = entry.LastName;
              newRow[tblEmployee.EMAILADDRESS_FIELD] = entry.EmailAddress;
              newRow[tblEmployee.PASSWORD_FIELD] = entry.Password;
              newRow[tblEmployee.EMPLOYEETYPE_FIELD] = entry.EmployeeType;
              if(entry.CreatedOn.Equals(new DateTime()))
                  newRow[tblEmployee.CREATEDON_FIELD] = DBNull.Value;
              else
                  newRow[tblEmployee.CREATEDON_FIELD] = entry.CreatedOn;
              newRow[tblEmployee.CREATEDBYID_FIELD] = entry.CreatedByID;
              if(entry.ModifiedOn.Equals(new DateTime()))
                  newRow[tblEmployee.MODIFIEDON_FIELD] = DBNull.Value;
              else
                  newRow[tblEmployee.MODIFIEDON_FIELD] = entry.ModifiedOn;
              newRow[tblEmployee.MODIFIEDBYID_FIELD] = entry.ModifiedByID;
              newRow[tblEmployee.ISACTIVE_FIELD] = entry.IsActive;

          if(adding)
              return tblObj.AddToTable(newRow);
          else
              return tblObj.UpdateTable(newRow);
      }
Ejemplo n.º 11
0
 public static int GetCount(string whereClause)
 {
     tblEmployee tblObj = new tblEmployee();
     int count = tblObj.GetCount(whereClause);
     return count;
 }
Ejemplo n.º 12
0
 public static int GetCount()
 {
     tblEmployee tblObj = new tblEmployee();
     int count = tblObj.GetCount();
     return count;
 }
Ejemplo n.º 13
0
      public static int Save(BOEmployeeList entryList, bool adding)
      {
          tblEmployee tblObj = new tblEmployee();
          DataTable dt = tblObj.Table();
          int i = 0;

          foreach(BOEmployee entry in entryList)
          {
              DataRow newRow = tblObj.Table().NewRow();

              newRow[tblEmployee.FIRSTNAME_FIELD] = entry.FirstName;
              newRow[tblEmployee.LASTNAME_FIELD] = entry.LastName;
              newRow[tblEmployee.EMAILADDRESS_FIELD] = entry.EmailAddress;
              newRow[tblEmployee.PASSWORD_FIELD] = entry.Password;
              newRow[tblEmployee.EMPLOYEETYPE_FIELD] = entry.EmployeeType;
          if(entry.CreatedOn.Equals(new DateTime()))
              newRow[tblEmployee.CREATEDON_FIELD] = DBNull.Value;
          else
              newRow[tblEmployee.CREATEDON_FIELD] = entry.CreatedOn;
              newRow[tblEmployee.CREATEDBYID_FIELD] = entry.CreatedByID;
          if(entry.ModifiedOn.Equals(new DateTime()))
              newRow[tblEmployee.MODIFIEDON_FIELD] = DBNull.Value;
          else
              newRow[tblEmployee.MODIFIEDON_FIELD] = entry.ModifiedOn;
              newRow[tblEmployee.MODIFIEDBYID_FIELD] = entry.ModifiedByID;
              newRow[tblEmployee.ISACTIVE_FIELD] = entry.IsActive;

              dt.Rows.Add(newRow);
              i++;
          }

          //if(adding): Commented out at the moment. KS 28th Aug 2012
              return tblObj.AddToTable(dt);
          //else
              //return tblObj.UpdateTable(dt);
      }