コード例 #1
0
        public bool insertData(RegisterProjectData entity)
        {
            StringBuilder sql = new StringBuilder("INSERT INTO ");

            sql.Append(TableNameRegisterProject);
            sql.Append(" (" + GetSqlColumns() + ") VALUES ('");
            sql.Append(dbEncode(entity.Name) + "','");
            sql.Append(dbEncode(entity.Location) + "','");
            sql.Append(dbEncode(entity.Description) + "','");
            sql.Append(dbEncode(entity.ContactPerson) + "','");
            sql.Append(dbEncode(entity.Email) + "','");
            sql.Append(dbEncode(entity.Telephone) + "','");
            sql.Append(dbEncode(entity.Cellphone) + "','");
            sql.Append(dbEncode(entity.Website) + "','");
            sql.Append(dbEncode(entity.FundingSource) + "',");
            sql.Append(dbEncode(entity.CreatedDateTime) + ",'");
            sql.Append(dbEncode(entity.ClientIp) + "');");

            int newId = this.RunInsertQuery(sql.ToString());

            if (newId > -1)
            {
                entity.Id = newId;
                return(true);
            }
            return(false);
        }
コード例 #2
0
 protected void rowToData(DataRow dr, RegisterProjectData entity)
 {
     entity.Id              = Convert.ToInt32(dr["ProjectId"]);
     entity.Name            = dr["Name"].ToString();
     entity.Location        = dr["Location"].ToString();
     entity.Description     = dr["Description"].ToString();
     entity.ContactPerson   = dr["ContactPerson"].ToString();
     entity.Email           = dr["Email"].ToString();
     entity.Telephone       = dr["Telephone"].ToString();
     entity.Cellphone       = dr["Cellphone"].ToString();
     entity.Website         = dr["Website"].ToString();
     entity.FundingSource   = dr["FundingSource"].ToString();
     entity.CreatedDateTime = Convert.ToDateTime(dr["CreatedDateTime"]);
     entity.ClientIp        = dr["ClientIp"].ToString();
 }
コード例 #3
0
        public List <RegisterProjectData> fetchAll()
        {
            List <RegisterProjectData> list = new List <RegisterProjectData>();
            DataSet ds = fetchAllAsDataSet();

            if (this.hasRows(ds) == false)
            {
                return(list);
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                RegisterProjectData entity = new RegisterProjectData();
                rowToData(dr, entity);
                list.Add(entity);
            }
            return(list);
        }