Exemplo n.º 1
0
        public int Insert(ProductJob info, List <ProductJobRecord> records)
        {
            try
            {
                //string commandText = @"insert into Users(userName,userPassword,userLevel,userPhone,userAddress) values (
                //?userName,?userPassword,?userLevel,?userPhone,?userAddress)";

                string commandText = string.Format("insert into ProductJob(name, jobTime, comment, status) values('{0}', '{1}', '{2}', '{3}')", info.Name, info.JobTime, info.Comment, info.Status);

                DbHelperAccess.executeNonQuery(commandText);

                int ProductJobID = DbHelperAccess.executeMax("ID", "ProductJob");

                ProductJobRecordDao dao = new ProductJobRecordDao();
                foreach (ProductJobRecord record in records)
                {
                    record.JobID = ProductJobID;
                    dao.Insert(record);
                }
                return(ProductJobID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public static ProductJobRecordDao getInstance()
 {
     if (dao == null)
     {
         dao = new ProductJobRecordDao();
     }
     return(dao);
 }
Exemplo n.º 3
0
        public void Update(ProductJob info, List <ProductJobRecord> records)
        {
            string commandText = string.Format("update ProductJob set name='{0}', jobTime='{1}', comment='{2}' where ID={3}",
                                               info.Name, info.JobTime, info.Comment, info.ID);

            DbHelperAccess.executeNonQuery(commandText);

            ProductJobRecordDao.getInstance().DeleteByJobID(info.ID);

            foreach (ProductJobRecord record in records)
            {
                record.JobID = info.ID;
                ProductJobRecordDao.getInstance().Insert(record);
            }
        }