/**
         * 17.员工增加订单记录
         * 参数:staffId, 这次订单的详细信息数组
         * 返回值:本次订单(需要修改stock)             //个人感觉这个不需要修改库存,在添加细节的时候再修改库存------->请注意
         */
        public order addOrderInfo(string staffId)
        {
            string newId = createNewId("order");
            string newId2 = "outBase_";
            for (int i = 6; i < newId.Length; i++)
            {
                newId2 = newId2 + newId[i];
            }
            string shopId = getShopIdByStaffId(staffId);

            using (YMDBEntities db = new YMDBEntities())
            {
                try
                {
                    staff targetStaff = findStaffByStaffId(staffId);
                    order targetOrder = new order
                    {
                        orderId = newId,
                        shopId = targetStaff.shopId,
                        totalPrice = 0,
                        orderTime = DateTime.Now,
                    };
                    db.order.Add(targetOrder);

                    outBase newOutBase = new outBase
                    {
                        outId = newId2,
                        shopId = shopId,
                        staffId = staffId,
                        outTime = DateTime.Now,
                        outType = "sell",
                    };
                    db.outBase.Add(newOutBase);

                    db.SaveChanges();
                    return targetOrder;
                }
                catch (NullReferenceException ex)
                {
                    System.Diagnostics.Debug.WriteLine("输入staffId的时候有问题,回去查!!!!!");
                    System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                    return null;
                }
            }
        }
        /**
         * 25.员工新建出库登记表
         * 参数:员工Id,出库类型
         * 返回:员工新建一个出库登记表(通过测试)
         */
        public outBase addNewOut(string outStaffId,string currentOutType)
        {
            if (!currentOutType.Equals("调货") && !currentOutType.Equals("补货"))
            {
                System.Diagnostics.Debug.WriteLine("新建出库登记表出错啦.");
                return null;
            }
            string currentShopId = getShopIdByStaffId(outStaffId);

            using (YMDBEntities db = new YMDBEntities())
            {
                try
                {
                    string newId = createNewId("outBase");
                    outBase newOutBase = new outBase
                    {
                        outId = newId,
                        shopId = currentShopId,
                        staffId = outStaffId,
                        outType = currentOutType,
                        outTime = DateTime.Now,
                    };
                    db.outBase.Add(newOutBase);
                    db.SaveChanges();
                    return newOutBase;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("出库登记表添加失败.");
                    System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                    return null;
                }
            }
        }
 /**
  * 62.增加商店出库记录(测试通过)
  * 参数:员工Id
  * 返回值:出库记录
  */
 public outBase addNewOutBaseRecord(string staffId)
 {
     string shopId = getShopIdByStaffId(staffId);
     string newId = createNewId("outBase");
     using (YMDBEntities db = new YMDBEntities())
     {
         try
         {
             outBase newOutBase = new outBase
             {
                 outId = newId,
                 shopId = shopId,
                 staffId = staffId,
                 outTime = DateTime.Now,
                 outType = "export",
             };
             db.outBase.Add(newOutBase);
             db.SaveChanges();
             return newOutBase;
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine("没找到shopId导致完整性约束不满足,拒绝插入数据库,请检查staffId.");
             System.Diagnostics.Debug.WriteLine(ex.StackTrace);
             return null;
         }
         
     }
 }