Example #1
0
        public ICollection <object> ParseDataMin(MySqlDataReader dataReader)
        {
            var entities = new List <object>();

            while (dataReader.Read())
            {
                var entity = new OfficeStatus
                {
                    ID = (int)dataReader["ID"],

                    Name = dataReader["Name"] as string,
                    StatusDescription = dataReader["StatusDescription"] as string,
                    StatusGrouping    = dataReader["StatusGrouping"] as string,

                    OwnerName = dataReader["OwnerName"] as string
                };

                if (int.TryParse((dataReader["OfficeID"] as int?)?.ToString(), out int officeID))
                {
                    entity.Office = new Office
                    {
                        ID         = officeID,
                        OfficeName = dataReader["OfficeName"] as string
                    };
                }

                entities.Add(entity);
            }

            return(entities);
        }
Example #2
0
        public void Post(OfficeStatus os)
        {
            Office office = Business.AppLogic.GetOffice(os.OfficeId);

            office.IsActive         = !office.IsActive;
            office.ModifiedBy       = os.LoggedInUser;
            office.ModifiedDateTime = DateTime.Now;
            Business.AppLogic.UpdateOffice(office);
        }
Example #3
0
        public static bool IsValid(OfficeStatus officeStatus, out Dictionary <string, string> validationResult)
        {
            validationResult = new Dictionary <string, string>();

            if (string.IsNullOrWhiteSpace(officeStatus.Name))
            {
                validationResult.Add("Record.Name", ValidationMessages.REQUIRED);
            }

            return(!validationResult.Any());
        }