Пример #1
0
 /// <summary>
 /// Constructor with the specified initial values.
 /// </summary>
 /// <param name="designId">Internal identifier of the design.</param>
 /// <param name="userId">Internal identifier of the agent.</param>
 /// <param name="category">Category of the design.</param>
 /// <param name="type">Type of the design.</param>
 /// <param name="size">Size of the design.</param>
 /// <param name="gender">Gender of the Agent that should be used for the
 /// message on the design.</param>
 /// <param name="onDesignName">Name of the Agent that should be used for the
 /// message on the design.</param>
 /// <param name="justification">Justification of the message on the
 /// design.</param>
 /// <param name="gutter">Gutter of the message on the design.</param>
 /// <param name="messageRectangle">The rectangle in which the message should be
 /// displayed on the design.</param>
 /// <param name="lowResolutionFile">Low resolution file location of the
 /// design.</param>
 /// <param name="highResolutionFile">High resolution file location of the
 /// design.</param>
 /// <param name="extraFile">Extra file location of the design.</param>
 /// <param name="status">Status of the design.</param>
 /// <param name="createDate">Created date of the design.</param>
 /// <param name="lastModifyDate">Last modified date of the design.</param>
 /// <param name="lastModifyBy">The internal idetifier of the user that recently
 /// modified the design.</param>
 /// <param name="approveDate">Date on which the design is approved.</param>
 /// <param name="approveBy">The internal idetifier of the user that approved
 /// the design.</param>
 /// <param name="comments">Comments about the design.</param>
 /// <param name="history">History of the design.</param>
 /// <param name="used">Usage status of the design.</param>
 public DesignInfo(int designId, int userId, LookupInfo category, LookupInfo type,
                   SizeF size, string gender, string onDesignName, JustificationType justification,
                   string gutter, RectangleF messageRectangle, string lowResolutionFile,
                   string highResolutionFile, string extraFile, LookupInfo status,
                   DateTime createDate, DateTime lastModifyDate, int lastModifyBy,
                   DateTime approveDate, int approveBy, string comments, string history,
                   DesignUsed used)
 {
     this.designId           = designId;
     this.userId             = userId;
     this.category           = category;
     this.type               = type;
     this.size               = size;
     this.gender             = gender;
     this.onDesignName       = onDesignName;
     this.justification      = justification;
     this.gutter             = gutter;
     this.messageRectangle   = messageRectangle;
     this.lowResolutionFile  = lowResolutionFile;
     this.highResolutionFile = highResolutionFile;
     this.extraFile          = extraFile;
     this.status             = status;
     this.createDate         = createDate;
     this.lastModifyDate     = lastModifyDate;
     this.lastModifyBy       = lastModifyBy;
     this.approveDate        = approveDate;
     this.approveBy          = approveBy;
     this.comments           = comments;
     this.history            = history;
     this.used               = used;
 }
Пример #2
0
        /// <summary>
        /// Gets the design details of the specified design.
        /// </summary>
        /// <param name="designId">Internal identifier of the design.</param>
        /// <returns>Design details of the specified design.</returns>
        public DesignInfo Get(int designId)
        {
            DesignInfo design = null;

            SqlParameter[] parameters = SQLHelper.GetCachedParameters("SQL_GET_DESIGN");

            if (parameters == null)
            {
                parameters = new SqlParameter[] {
                    new SqlParameter("@design_id", SqlDbType.Int)
                };

                SQLHelper.CacheParameters("SQL_GET_DESIGN", parameters);
            }

            parameters[0].Value = designId;

            using (SqlDataReader reader =
                       SQLHelper.ExecuteReader(SQLHelper.CONNECTION_STRING,
                                               CommandType.Text,
                                               SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_GET_DESIGN"),
                                               parameters))
            {
                if (reader.Read())
                {
                    DesignUsed used = DesignUsed.Never;

                    if (reader.GetInt32(27) > 0)
                    {
                        used = DesignUsed.FoundActive;
                    }
                    else if (reader.GetInt32(26) > 0)
                    {
                        used = DesignUsed.Found;
                    }

                    design = new DesignInfo(reader.GetInt32(0), reader.GetInt32(1),
                                            new LookupInfo(reader.GetInt32(2), reader.GetString(3)),
                                            new LookupInfo(reader.GetInt32(4), reader.GetString(5)),
                                            new SizeF((float)reader.GetDecimal(6), (float)reader.GetDecimal(7)),
                                            reader.GetString(8), reader.GetString(9),
                                            (JustificationType)reader.GetInt32(10), reader.GetString(11),
                                            new RectangleF((float)reader.GetDecimal(12), (float)reader.GetDecimal(13), (float)reader.GetDecimal(14), (float)reader.GetDecimal(15)),
                                            reader.GetString(16), reader.GetString(17), reader.GetString(18),
                                            new LookupInfo(reader.GetInt32(19), reader.GetString(20)),
                                            reader.GetDateTime(21), reader.GetDateTime(22), reader.GetInt32(23),
                                            reader.GetDateTime(24), reader.GetInt32(25),
                                            string.Empty, string.Empty, used);
                }
            }

            using (SqlDataReader reader =
                       SQLHelper.ExecuteReader(SQLHelper.CONNECTION_STRING,
                                               CommandType.Text,
                                               SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_GET_DESIGN_HISTORY"),
                                               parameters))
            {
                string eventDetails = string.Empty;

                while (reader.Read())
                {
                    eventDetails += reader.GetDateTime(4).ToString("MM/dd/yyyy");
                    eventDetails += ": ";
                    eventDetails += reader.GetString(1);
                    eventDetails += " [" + reader.GetString(2) + "]";
                    eventDetails += Environment.NewLine;

                    eventDetails += (reader.GetString(3) == "" ? "---" : reader.GetString(3));
                    eventDetails += Environment.NewLine;

                    eventDetails += Environment.NewLine;
                }

                design.History = eventDetails;
            }

            return(design);
        }