Exemplo n.º 1
0
        public static List <LabelFormatEntry> forLabelID(SqlConnection db, int id)
        {
            List <LabelFormatEntry> entries = new List <LabelFormatEntry>();
            DataTable table = new DataTable();

            const string qFamilies = @"SELECT *
												FROM CheckInLabelEntry
												WHERE labelID = @labelID"                                                ;

            using (SqlCommand cmd = new SqlCommand(qFamilies, db)) {
                SqlParameter sizeParameter = new SqlParameter("labelID", id);

                cmd.Parameters.Add(sizeParameter);

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(table);
            }

            foreach (DataRow row in table.Rows)
            {
                LabelFormatEntry entry = new LabelFormatEntry();
                entry.populate(row);

                entries.Add(entry);
            }

            return(entries);
        }
Exemplo n.º 2
0
        public LabelEntry(LabelFormatEntry formatEntry, Attendance attendance, AttendanceGroup group = null, int index = 0)
        {
            typeID = formatEntry.typeID;

            switch (formatEntry.typeID)
            {
            case 1:
                try {
                    data = getField((LabelField)formatEntry.fieldID, formatEntry.fieldFormat, attendance, group);
                } catch (Exception) {
                    data = "Format Exception";
                }

                break;

            case 4:
            case 5:
                data = formatEntry.fieldFormat;
                break;

            default:
                data = "";
                break;
            }

            font     = formatEntry.font;
            fontSize = formatEntry.fontSize;

            start.x = formatEntry.startX;
            start.y = formatEntry.startY + (formatEntry.offset * index);

            align.x = formatEntry.alignX;
            align.y = formatEntry.alignY;

            end.x = formatEntry.endX;
            end.y = formatEntry.endY + (formatEntry.offset * index);

            size.x = formatEntry.width;
            size.y = formatEntry.height;
        }
Exemplo n.º 3
0
 public void loadEntries(SqlConnection db)
 {
     entries.Clear();
     entries.AddRange(LabelFormatEntry.forLabelID(db, id));
 }
Exemplo n.º 4
0
        public LabelEntry(AttendanceCacheSet cacheSet, LabelFormatEntry formatEntry, Attendance attendance, AttendanceGroup group = null, int index = 0)
        {
            typeID = formatEntry.typeID;

            switch (formatEntry.typeID)
            {
            case 1:
                try {
                    data = getField(cacheSet, (LabelField)formatEntry.fieldID, formatEntry.fieldFormat, attendance, group);
                } catch (Exception) {
                    data = "Format Exception";
                }

                break;

            case 4:
            case 5:
                data = formatEntry.fieldFormat;
                break;

            case 6:
                // populate box data so that it is printed if data is present
                // later we remove box entries if they are behind a blank field by querying this data prop
                try
                {
                    if (formatEntry.invert && formatEntry.fieldID != 0)
                    {
                        data = getField(cacheSet, (LabelField)formatEntry.fieldID, formatEntry.fieldFormat, attendance, group);
                    }
                    else
                    {
                        data = "print";
                    }
                }
                catch (Exception)
                {
                    data = "Format Exception";
                }

                break;

            default:
                data = "";
                break;
            }

            font     = formatEntry.font;
            fontSize = formatEntry.fontSize;

            start.x = formatEntry.startX;
            start.y = formatEntry.startY + (formatEntry.offset * index);

            align.x = formatEntry.alignX;
            align.y = formatEntry.alignY;

            end.x = formatEntry.endX;
            end.y = formatEntry.endY + (formatEntry.offset * index);

            size.x = formatEntry.width;
            size.y = formatEntry.height;

            invert = formatEntry.invert;
            order  = formatEntry.order;
        }
Exemplo n.º 5
0
        public LabelEntry(AttendanceCacheSet cacheSet, LabelFormatEntry formatEntry, Attendance attendance, AttendanceGroup group = null, int index = 0)
        {
            bool conditionalRemovedEntry = false;

            typeID = formatEntry.typeID;

            if (formatEntry.orgEV.HasValue())
            {
                Organization org = cacheSet.getOrganization(group.groupID);
                if (org != null)
                {
                    var ev = org.OrganizationExtras.SingleOrDefault(e => e.Field == formatEntry.orgEV);
                    if (ev == null)
                    {
                        conditionalRemovedEntry = true;
                    }
                }
                else
                {
                    conditionalRemovedEntry = true;
                }
            }
            if (formatEntry.personFlag.HasValue() && conditionalRemovedEntry == false)
            {
                CmsData.Person person = cacheSet.getPerson(attendance.peopleID);
                if (person != null)
                {
                    var sf = cacheSet.dataContext.ViewAllStatusFlags.SingleOrDefault(f => f.Flag == formatEntry.personFlag && f.PeopleId == person.PeopleId);
                    if (sf == null)
                    {
                        conditionalRemovedEntry = true;
                    }
                }
                else
                {
                    conditionalRemovedEntry = true;
                }
            }

            switch (formatEntry.typeID)
            {
            case 1:
                try {
                    data = getField(cacheSet, (LabelField)formatEntry.fieldID, formatEntry.fieldFormat, attendance, group);
                } catch (Exception) {
                    data = "Format Exception";
                }

                break;

            case 4:
            case 5:
                data = formatEntry.fieldFormat;
                break;

            case 6:
                // populate box data so that it is printed if data is present
                // later we remove box entries if they are behind a blank field by querying this data prop
                try
                {
                    if (formatEntry.invert && formatEntry.fieldID != 0)
                    {
                        data = getField(cacheSet, (LabelField)formatEntry.fieldID, formatEntry.fieldFormat, attendance, group);
                    }
                    else
                    {
                        data = "print";
                    }
                }
                catch (Exception)
                {
                    data = "Format Exception";
                }

                break;

            default:
                data = "";
                break;
            }

            font     = formatEntry.font;
            fontSize = formatEntry.fontSize;

            start.x = formatEntry.startX;
            start.y = formatEntry.startY + (formatEntry.offset * index);

            align.x = formatEntry.alignX;
            align.y = formatEntry.alignY;

            end.x = formatEntry.endX;
            end.y = formatEntry.endY + (formatEntry.offset * index);

            size.x = formatEntry.width;
            size.y = formatEntry.height;

            invert = formatEntry.invert;
            order  = formatEntry.order;

            if (conditionalRemovedEntry)
            {
                data = "ConditionalRemovedEntry";
            }
        }