コード例 #1
0
        public static string GetIndex()
        {
            DAL    settings = new DAL();
            string lastId   = BLANK;

            try
            {
                // get file name from config
                string fileName = settings.INDEX_STORE_FILE_NAME;
                if (!File.Exists(fileName))
                {
                    // make file, set to zero
                    FileStoreUtility.MakeFile(fileName);
                }

                // get the last id that was placed inside
                lastId = File.ReadAllText(fileName);
            }
            catch (Exception exception)
            {
                string parameters = lastId;
                Shields_Error_Logger.LogError(exception, "GetIndex()", parameters);
                return(lastId);
            }
            return(lastId);
        }
コード例 #2
0
        public static bool AppendLocalWebLog(string message)
        {
            DAL settings = new DAL();

            try
            {
                string fileName = settings.LOCAL_WEB_LOG_FILE_NAME;

                if (!File.Exists(fileName))
                {
                    if (!FileStoreUtility.MakeFile(fileName))
                    {
                        return(false);
                    }
                }

                string output = LOG_TEMPLATE
                                .Replace("[DATE_TIME]", DateTime.Now.ToShortDateString())
                                .Replace("[MESSAGE]", message) + Convert.ToChar(NEW_LINE);

                File.AppendAllText(fileName, output);
            }
            catch (Exception exception)
            {
                string parameters = message;
                Shields_Error_Logger.LogError(exception, "AppendLocalWebLog(string message)", parameters);
                return(false);
            }

            return(true);
        }
コード例 #3
0
        public static bool UpdateIndex(string lastId)
        {
            DAL settings = new DAL();

            try
            {
                // get file name from config
                string fileName = settings.INDEX_STORE_FILE_NAME;

                // if there is no file make one
                if (!File.Exists(fileName))
                {
                    if (!FileStoreUtility.MakeFile(fileName))
                    {
                        return(false);
                    }
                }
                // write the last id
                File.WriteAllText(fileName, lastId);
            }
            catch (Exception exception)
            {
                string parameters = lastId;
                Shields_Error_Logger.LogError(exception, "UpdateIndex(string lastId)", parameters);
                return(false);
            }
            return(true);
        }
コード例 #4
0
        public static void SetCanvasRows(Canvas canvas)
        {
            // get the last index
            int lastIndex = Convert.ToInt32(FileStoreUtility.GetIndex());

            // get the identities from last index
            List <Identity> identities = IdentityController.GetIdentitiesFromLastIndex(lastIndex);

            foreach (Identity ident in identities)
            {
                // new column list
                List <Canvas.Column> columns = new List <Canvas.Column>();

                // add all the necessary columns - should be in order of canvas
                columns.Add(MakeColumn(XMLController.XML_COL_IDA, ident.ida));
                columns.Add(MakeColumn(XMLController.XML_COL_IDENT_ID, ident.identId.ToString()));
                columns.Add(MakeColumn(XMLController.XML_COL_FIRST_NAME, ident.firstName));
                columns.Add(MakeColumn(XMLController.XML_COL_LAST_NAME, ident.lastName));
                columns.Add(MakeColumn(XMLController.XML_COL_BIRTH_DTTM, ident.dateOfBirth));
                columns.Add(MakeColumn(XMLController.XML_COL_SS_NUMBER, ident.socialSecurityNumber));
                // set the user group from canvas object
                columns.Add(MakeColumn(XMLController.XML_COL_USER_GROUP, canvas.UserGroup));

                // make row
                canvas.Rows.Add(MakeRow(columns));
            }
        }