MoveRecord IMoveRecordDao.getSingleMoveRecord(int RemoveID)
        {
            MoveRecord MoveRecord = new MoveRecord();

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                string        sql = "select * from move where moveid = :moveid";
                OracleCommand cmd = new OracleCommand(sql, con);
                cmd.Parameters.Add(":moveid", OracleDbType.Int32);

                cmd.Parameters[":moveid"].Value = RemoveID;

                OracleDataReader DataReader = cmd.ExecuteReader();
                if (DataReader.Read())
                {
                    int      id          = int.Parse(DataReader["moveid"].ToString());
                    int      numbers     = int.Parse(DataReader["numbers"].ToString());
                    DateTime time        = (DateTime)DataReader["time"];
                    int      warehouseid = int.Parse(DataReader["warehouseid"].ToString());
                    int      employeeid  = int.Parse(DataReader["employeeid"].ToString());

                    MoveRecord.RemoveID    = id;
                    MoveRecord.RemoveTotal = numbers;
                    MoveRecord.RemoveTime  = time;
                    //    MoveRecord.WareHouse.WareHouseID = warehouseid;
                    IEmployeeDao eDao = new EmployeeDao();
                    //     MoveRecord.Employee = eDao.getSingleEmployee(employeeid);
                    MoveRecord.Employee.EmployeeID = employeeid;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(MoveRecord);
        }
Esempio n. 2
0
        Shelf IShelfDao.getShelf(int ShelfID)
        {
            //throw new NotImplementedException();
            Shelf s = new Shelf();

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                string           sql        = "select * from shelf where shelfid=" + ShelfID;
                OracleCommand    cmd        = new OracleCommand(sql, con);
                OracleDataReader DataReader = cmd.ExecuteReader();
                if (DataReader.Read())
                {
                    //Shelf shelf = new Shelf();
                    int    s_id     = int.Parse(DataReader["shelfid"].ToString());
                    string name     = DataReader["name"].ToString();
                    string location = DataReader["location"].ToString();
                    int    e_id     = int.Parse(DataReader["employeeid"].ToString());
                    //      Employee e = new Employee();
                    //      e.EmployeeID = e_id;
                    s.SelfID    = s_id;
                    s.ShelfName = name;
                    s.Location  = location;
                    IEmployeeDao edao = new EmployeeDao();
                    s.Employee = edao.getSingleEmployee(e_id);                                //int型还是employee型?
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(s);
        }
Esempio n. 3
0
        //不负责初始化一条订单的每条商品销售信息,暂时就这样
        Bill IBillDao.getSingleBill(int BillID)
        {
            Bill m_bill = null;

            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                string        sql = "select * from bill where billid = :id";
                OracleCommand cmd = new OracleCommand(sql, con);
                cmd.Parameters.Add(":id", OracleDbType.Int32);
                cmd.Parameters[0].Value = BillID;
                OracleDataReader DataReader = cmd.ExecuteReader();
                if (DataReader.Read())
                {
                    m_bill                 = new Bill();
                    m_bill.BillID          = BillID;
                    m_bill.TotalPrice      = decimal.Parse(DataReader["totalprice"].ToString());
                    m_bill.PurchaseingDate = DateTime.Parse(DataReader["purchaseingdate"].ToString());
                    m_bill.Total_amount    = int.Parse(DataReader["goods_total"].ToString());
                    int          employeeId = int.Parse(DataReader["employeeid"].ToString());
                    int          customerid = int.Parse(DataReader["customerid"].ToString());
                    ICustomerDao cDao       = new CustomerDao();
                    m_bill.Customer = cDao.getSingleCustomer(customerid);
                    IEmployeeDao eDao = new EmployeeDao();
                    m_bill.Employee = eDao.getSingleEmployee(employeeId);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(m_bill);
        }
Esempio n. 4
0
        Entity.Type ITypeDao.getSingleType(int typeid)
        {
            Entity.Type   type = null;
            string        sql  = "select * from type where typeid = :id";
            OracleCommand cmd  = new OracleCommand(sql, con);

            cmd.Parameters.Add("id", OracleDbType.Int32);
            cmd.Parameters[0].Value = typeid;
            try
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }
                OracleDataReader DataReader = cmd.ExecuteReader();
                if (DataReader.Read())
                {
                    type = new Entity.Type();
                    int    id         = int.Parse(DataReader["typeid"].ToString());
                    string name       = DataReader["name"].ToString();
                    int    employeeid = int.Parse(DataReader["employeeid"].ToString());
                    //      Employee employee = new Employee();
                    // employee.EmployeeID = employeeid;
                    IEmployeeDao dao = new EmployeeDao();
                    type.Employee = dao.getSingleEmployee(employeeid);
                    type.TypeID   = id;
                    type.Name     = name;
                    //       type.Employee = employee;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                }
            }
            return(type);
        }