コード例 #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);
        }
コード例 #2
0
ファイル: LabelEntry.cs プロジェクト: pwgoertz/bvcms
        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;
        }
コード例 #3
0
ファイル: LabelFormat.cs プロジェクト: pwgoertz/bvcms
 public void loadEntries(SqlConnection db)
 {
     entries.Clear();
     entries.AddRange(LabelFormatEntry.forLabelID(db, id));
 }
コード例 #4
0
ファイル: LabelEntry.cs プロジェクト: lightyeare/bvcms
        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;
        }
コード例 #5
0
ファイル: LabelEntry.cs プロジェクト: rastographics/bvcms
        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";
            }
        }