static void AddSalesInfo()
        {
            GoodsInfoDal GoodsInfoDal = new GoodsInfoDal();
            ProfitsInfo  salesInfo    = new ProfitsInfo();
            //salesInfo.GoodsId = 2;
            //salesInfo.Count = 3;
            //salesInfo.DisCount = 50;
            //salesInfo.GoodsInfo = GoodsInfoDal.GetEntityById(salesInfo.GoodsId);
            //salesInfo.Prices = salesInfo.GoodsInfo.PayPrice * (decimal)salesInfo.Count - salesInfo.DisCount;
            //salesInfo.CreateTime = DateTime.Now;
            //salesInfo.IsPay = true;


            ProfitsInfoDal salesInfoDal = new ProfitsInfoDal();

            bool d = salesInfoDal.Add(salesInfo);

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
 public static Frm_Payment Create(ProfitsInfo profitsInfo)
 {
     if (_form == null)
     {
         _form = new Frm_Payment();
     }
     _profitsInfo = profitsInfo;
     return(_form);
 }
Example #3
0
        private void btnOrderOK_Click(object sender, EventArgs e)
        {
            ///操作步骤: 1获取订单表数据 ,将订单表数据添加数据库
            ///2计算 利润 ,将得出利润数据 利润表添加数据
            ///3 客户是否付款登记,如未登记 则进行 客户待回收账登记
            ///4 商品库存管理
            ///关闭窗口.

            Huang_System f1 = (Huang_System)this.Owner;//将本窗体的拥有者强制设为Form1类的实例
            //获取订单表
            var OrdersInfo = f1.OrdersInfo;

            decimal allProfit   = (decimal)0;
            decimal allDisCount = (decimal)0;
            string  orderId     = OrdersInfo[0].OrderId;//个数保证大于0;

            for (int i = 0; i < OrdersInfo.Count; i++)
            {
                //下订单
                var goodsInfo    = DataManager.GoodsInfoBLL.GetEntityById(OrdersInfo[i].GoodsId);
                var salesCount   = goodsInfo.SalesCount + OrdersInfo[i].Count;   //卖出数量
                var surplusCount = goodsInfo.SurplusCount - OrdersInfo[i].Count; //剩余数量
                var isSucess     = DataManager.OrderInfoBLL.Add(OrdersInfo[i]);
                if (!isSucess)
                {
                    MessageBox.Show("下订单失败,请重试,如多次失败请联系管理员");
                    return;
                }
                //改库存
                var editSucess = DataManager.GoodsInfoBLL.EditGoodsInfoCount(goodsInfo.Id, salesCount, surplusCount);
                if (!editSucess)
                {
                    MessageBox.Show("修改失败,请重试,如多次失败请联系管理员");
                    return;
                }

                allProfit   += OrdersInfo[i].Profit;   //利润
                allDisCount += OrdersInfo[i].DisCount; //折扣
            }
            //利润信息表
            ProfitsInfo profitsInfo = new ProfitsInfo();

            profitsInfo.OrderId    = orderId;
            profitsInfo.CreateTime = DateTime.Now;
            profitsInfo.Profit     = allProfit;
            profitsInfo.DisCount   = allDisCount;
            profitsInfo.PayPrices  = decimal.Parse(_payPrice);
            profitsInfo.IsPay      = false;                  //默认为未收款
            f1.TempProfit          = profitsInfo;            //下单完成则利润表完成
            f1.OrdersInfo          = new List <OrderInfo>(); //清空订单表
            this.Close();
        }
        static void EditSalesInfo()
        {
            GoodsInfoDal GoodsInfoDal = new GoodsInfoDal();


            ProfitsInfoDal salesInfoDal = new ProfitsInfoDal();
            ProfitsInfo    salesInfo    = salesInfoDal.GetEntityById(2);

            salesInfo.Remark = "测试修改";
            salesInfo.IsPay  = false;

            var d = salesInfoDal.Edit(salesInfo);//仅能修改 备注和是否支付

            if (d)
            {
                Console.WriteLine("成功");
            }
            else
            {
                Console.WriteLine("失败");
            }
        }
Example #5
0
        /// <summary>
        /// 获取默认的表名
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name">表名</param>
        /// <param name="handText">列名</param>
        /// <param name="hideIndex">隐藏列</param>
        public static void GetHandTxtAndHideIndex(int id, ref List <string> name, ref List <string> handText, ref List <int> hideIndex)
        {
            switch (id)
            {
            case 0:
                name      = new GoodsInfo().GetTableName();
                handText  = new GoodsInfo().GetHanderTxt();
                hideIndex = new GoodsInfo().GetHideIndex();
                break;

            case 1:
                name      = new OrderInfo().GetTableName();
                handText  = new OrderInfo().GetHanderTxt();
                hideIndex = new OrderInfo().GetHideIndex();
                break;

            case 2:
                name      = new GoodsInfo().GetTableName();
                handText  = new GoodsInfo().GetHanderTxt();
                hideIndex = new GoodsInfo().GetHideIndex();
                break;

            case 3:
                name      = new OrderInfo().GetTableName();
                handText  = new OrderInfo().GetHanderTxt();
                hideIndex = new OrderInfo().GetHideIndex();
                break;

            case 4:
                name      = new ProfitsInfo().GetTableName();
                handText  = new ProfitsInfo().GetHanderTxt();
                hideIndex = new ProfitsInfo().GetHideIndex();
                break;

            case 5:
                name      = new NoReceiveMoney().GetTableName();
                handText  = new NoReceiveMoney().GetHanderTxt();
                hideIndex = new NoReceiveMoney().GetHideIndex();
                break;

            case 6:
                name      = new UnitInfo().GetTableName();
                handText  = new UnitInfo().GetHanderTxt();
                hideIndex = new UnitInfo().GetHideIndex();
                break;

            case 7:
                name      = new SortInfo().GetTableName();
                handText  = new SortInfo().GetHanderTxt();
                hideIndex = new SortInfo().GetHideIndex();
                break;

            case 8:
                name      = new WholeSalerInfo().GetTableName();
                handText  = new WholeSalerInfo().GetHanderTxt();
                hideIndex = new WholeSalerInfo().GetHideIndex();
                break;

            case 9:
                name      = new UserInfo().GetTableName();
                handText  = new UserInfo().GetHanderTxt();
                hideIndex = new UserInfo().GetHideIndex();
                break;

            default:
                break;
            }
        }
 private void Frm_Payment_FormClosing(object sender, FormClosingEventArgs e)
 {
     _profitsInfo = null;
 }