コード例 #1
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);
        }
コード例 #2
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));
            }
        }
コード例 #3
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);
      }
コード例 #4
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);
      }