Ejemplo n.º 1
0
        /// <summary>
        /// Load db data into memory
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="reader"></param>
        private static void LoadObject(ClientDocumentSet obj, MySqlDataReader reader)
        {
            obj.UID         = Convert.ToInt32(reader[FieldName.UID]);
            obj.FKClientUID = Convert.ToInt32(reader[FieldName.FKClientUID]);
            try { obj.Description = reader[FieldName.Description].ToString(); }
            catch { obj.Description = ""; }
            obj.Folder       = reader[FieldName.Folder].ToString();
            obj.FolderOnly   = reader[FieldName.FolderOnly].ToString();
            obj.StartDate    = Convert.ToDateTime(reader[FieldName.StartDate].ToString());
            obj.EndDate      = Convert.ToDateTime(reader[FieldName.EndDate].ToString());
            obj.ClientSetID  = Convert.ToInt32(reader[FieldName.ClientSetID].ToString());
            obj.SourceFolder = reader[FieldName.SourceFolder].ToString();
            obj.Status       = reader[FieldName.Status].ToString();
            obj.IsVoid       = reader[FieldName.IsVoid].ToString();

            // Derived field
            obj.CombinedIDName = obj.FKClientUID + ";" + obj.ClientSetID + "; " + obj.Description + "; " + obj.Status;

            try { obj.UpdateDateTime = Convert.ToDateTime(reader[FieldName.UpdateDateTime].ToString()); }
            catch { obj.UpdateDateTime = DateTime.Now; }
            try { obj.CreationDateTime = Convert.ToDateTime(reader[FieldName.CreationDateTime].ToString()); }
            catch { obj.CreationDateTime = DateTime.Now; }
            try { obj.IsVoid = reader[FieldName.IsVoid].ToString(); }
            catch { obj.IsVoid = "N"; }
            try { obj.UserIdCreatedBy = reader[FieldName.UserIdCreatedBy].ToString(); }
            catch { obj.UserIdCreatedBy = "N"; }
            try { obj.UserIdUpdatedBy = reader[FieldName.UserIdCreatedBy].ToString(); }
            catch { obj.UserIdCreatedBy = "N"; }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return a list of document sets for a given client.
        /// </summary>
        /// <param name="iClientUID"></param>
        /// <param name="sortOrder"></param>
        /// <returns></returns>
        public static List <ClientDocumentSet> List(int iClientUID, string sortOrder = "DESC")
        {
            List <ClientDocumentSet> documentSetList = new List <ClientDocumentSet>();

            // cds.FKClientUID + ";" + cds.ClientSetID + "; " + cds.Description + "; " +cds.Status
            //
            using (var connection = new MySqlConnection(ConnString.ConnectionString))
            {
                var commandString = string.Format(
                    " SELECT  " +
                    ClientDocumentSetFieldString() +
                    "   FROM ClientDocumentSet " +
                    " WHERE FKClientUID = '{0}' " +
                    " ORDER BY ClientSetID " +
                    sortOrder
                    ,
                    iClientUID);

                using (var command = new MySqlCommand(
                           commandString, connection))
                {
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            ClientDocumentSet _clientDocumentSet = new ClientDocumentSet();
                            LoadObject(_clientDocumentSet, reader);

                            documentSetList.Add(_clientDocumentSet);
                        }
                    }
                }
            }

            return(documentSetList);
        }
Ejemplo n.º 3
0
 public ClientDocument()
 {
     clientDocumentSet = new ClientDocumentSet();
 }