예제 #1
0
        /// <summary>
        /// Bind IDataReader to Entity
        /// </summary>
        /// <param name="dataReader"></param>
        /// <param name="count">Projects' count and Clients' count</param>
        /// <returns></returns>
        public static CompanysEntity ReaderBind(IDataReader dataReader, bool count)
        {
            CompanysEntity model = new CompanysEntity();
            object         ojb;

            ojb = dataReader["ComID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ComID = (int)ojb;
                model.ID    = model.ComID;
            }
            model.CompanyName       = dataReader["CompanyName"].ToString();
            model.Phone             = dataReader["Phone"].ToString();
            model.Fax               = dataReader["Fax"].ToString();
            model.Website           = dataReader["Website"].ToString();
            model.AssignedSystemUrl = dataReader["AssignedSystemUrl"].ToString();
            model.Address1          = dataReader["Address1"].ToString();
            model.Address2          = dataReader["Address2"].ToString();
            model.City              = dataReader["City"].ToString();
            model.State             = dataReader["State"].ToString();
            model.Logo              = dataReader["Logo"].ToString();
            model.Status            = dataReader["Status"].ToString();
            ojb = dataReader["CreatedOn"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreatedOn = (DateTime)ojb;
            }
            ojb = dataReader["CreatedBy"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreatedBy = (int)ojb;
            }
            model.CreateUserName = dataReader["CreateUserName"].ToString();
            ojb = dataReader["ModifiedOn"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ModifiedOn = (DateTime)ojb;
            }
            ojb = dataReader["ModifiedBy"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ModifiedBy = (int)ojb;
            }
            if (count)
            {
                ojb = dataReader["ProjectsCount"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.ProjectsCount = (int)ojb;
                }
                ojb = dataReader["ClientsCount"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.ClientsCount = (int)ojb;
                }
            }
            return(model);
        }
예제 #2
0
        public static CompanysEntity Create(int createUserID, ISystemDateTime datetimeProvider)
        {
            CompanysEntity companyEntity = new CompanysEntity();

            companyEntity.ID         = 0;
            companyEntity.CreatedBy  = createUserID;
            companyEntity.CreatedOn  = datetimeProvider.Now;
            companyEntity.ModifiedBy = createUserID;
            companyEntity.ModifiedOn = datetimeProvider.Now;

            companyEntity.Address1          = string.Empty;
            companyEntity.Address2          = string.Empty;
            companyEntity.AssignedSystemUrl = string.Empty;
            companyEntity.City        = string.Empty;
            companyEntity.CompanyName = string.Empty;
            companyEntity.Fax         = string.Empty;
            companyEntity.Logo        = string.Empty;
            companyEntity.Phone       = string.Empty;
            companyEntity.State       = string.Empty;
            companyEntity.Status      = string.Empty;
            companyEntity.Website     = string.Empty;

            return(companyEntity);
        }