示例#1
0
文件: Order.cs 项目: Darinadmit/DSA
 public Order(GeneralInfo.OrderStatus orderStatus, double price, Manager orderManager, Client orderClient, Product orderProduct, int count)
 {
     OrderStatus  = orderStatus;
     Price        = price;
     OrderManager = orderManager;
     OrderClient  = orderClient;
     OrderProduct = orderProduct;
     Count        = count;
     Id           = GeneralInfo.DataProvider.AddNewOrder(this);
 }
示例#2
0
文件: Order.cs 项目: Darinadmit/DSA
 public Order(int newId, GeneralInfo.OrderStatus orderStatus, double price, Manager orderManager, Client orderClient, Product orderProduct, int count)
 {
     OrderStatus  = orderStatus;
     Price        = price;
     OrderManager = orderManager;
     OrderClient  = orderClient;
     OrderProduct = orderProduct;
     Count        = count;
     Id           = newId;
 }
示例#3
0
        public Order FindById(int id)
        {
            conn.Open();
            string          sql     = "SELECT `id`, `status`, `price`, `id_man`, `id_cl`, `id_prod`, `count` FROM `storedb`.`orders` WHERE id = " + id.ToString();
            MySqlCommand    command = new MySqlCommand(sql, conn);
            MySqlDataReader reader  = command.ExecuteReader();
            List <Order>    answer  = new List <Order>();

            while (reader.Read())
            {
                int newId = Convert.ToInt32(reader[0].ToString());
                GeneralInfo.OrderStatus st = (GeneralInfo.OrderStatus)Convert.ToInt32(reader[1].ToString());
                double  price = Convert.ToDouble(reader[2].ToString());
                Manager mgId  = GeneralInfo.DataProvider.GetManager(Convert.ToInt32(reader[3].ToString()));
                Client  clId  = GeneralInfo.DataProvider.GetClient(Convert.ToInt32(reader[4].ToString()));
                Product prId  = GeneralInfo.DataProvider.GetProduct(Convert.ToInt32(reader[5].ToString()));
                int     count = Convert.ToInt32(reader[6].ToString());
                answer.Add(new Order(newId, st, price, mgId, clId, prId, count));
            }
            reader.Close();
            conn.Close();
            return(answer[0]);
        }
示例#4
0
文件: Order.cs 项目: Darinadmit/DSA
 public void SetStatus(GeneralInfo.OrderStatus newStatus)
 {
     OrderStatus = newStatus;
     GeneralInfo.DataProvider.UpdateOrder(this);
 }