コード例 #1
0
        public int Add(WorkCentre workCentre)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO WORKCENTRE (WorkCentre,Abbreviation) VALUES ('");
            sb.Append(workCentre.WorkCentreName + "','");
            sb.Append(workCentre.Abbreviation + "')");

            string    sql = sb.ToString();
            DBCommand db  = new DBCommand();

            return(db.ExecuteCommand(sql));
        }
コード例 #2
0
        public List <WorkCentre> GetList()
        {
            List <WorkCentre> list = new List <WorkCentre>();

            DBCommand db = new DBCommand(DBCommand.TransactionType.WithoutTransaction);
            DataTable dt = db.GetDataTable("SELECT * FROM vw_WorkCentre");

            foreach (DataRow dr in dt.Rows)
            {
                WorkCentre title = new WorkCentre
                {
                    WorkCentreId   = (int)dr["WorkCentreId"],
                    WorkCentreName = dr["WorkCentre"].ToString(),
                    Abbreviation   = dr["Abbreviation"].ToString()
                };
                list.Add(title);
            }
            return(list);
        }