Beispiel #1
0
        private void alButton1_Click(object sender, EventArgs e)
        {
            VipSoft.BLL.MemCard mBll = new BLL.MemCard();

            //新建会员卡实体对象,保存界面录入的值
            VipSoft.Model.MemCard mCard = new Model.MemCard();
            mCard.Name = this.Name.Text.Trim();
            mCard.CardID = this.cardid.Text.Trim();
            mCard.CardMianID = this.cardmianid.Text.Trim();

            mCard.CardTypeID = int.Parse(((System.Collections.DictionaryEntry)CardTypeID.Items[0]).Value.ToString());
            mCard.CreateTime = DateTime.Parse(this.createtime.Text.Trim());
            mCard.Email = this.Email.Text.Trim();
            mCard.IsPast = this.IsPast.Checked ;
            mCard.IsPointAuto = this.IsPointAuto.Checked ;
            mCard.PastTime = DateTime.Parse(this.PastTime.Text.Trim());
            mCard.Sex = int.Parse(((System.Collections.DictionaryEntry)Sex.Items[0]).Value.ToString());
            mCard.Mobile = this.Mobile.Text.Trim();
            mCard.LevelID = int.Parse(this.LevelID.SelectedValue.ToString());
            mCard.Money = Decimal.Parse(this.Money.Text.Trim());
            mCard.Password = this.Password.Text.Trim();
            mCard.PayMoney = Decimal.Parse(this.PayMoney.Text.Trim());
            mCard.Point = Int32.Parse(this.Point.Text.Trim());
            mCard.Remark = this.Remark.Text.Trim();
            mCard.State = int.Parse(((System.Collections.DictionaryEntry)State.Items[0]).Value.ToString());
            mCard.ShopID = PublicState.Master.ShopID;
            mCard.ShopName = PublicState.Master.ShopName;
            //...

            if (this.memId == 0)
            {
                mBll.Add(mCard);
                MessageBox.Show("会员新增成功。");

                if (this.continue_add.Checked)
                {
                    this.cardid.Text = "";
                    this.cardmianid.Text = "";
                    this.CardTypeID.Text = "";
                    this.Name.Text = "";
                    //...
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                mCard.ID = memId;
                mBll.Update(mCard);
                MessageBox.Show("会员修改成功。");
                this.Close();
            }
        }
Beispiel #2
0
        // 确认结算时
        // 订单表中插入记录、订单详细表、账户金额积分处理
        // 系统日志
        void exp_ExpenseResultSelected(OrderPayType expType, decimal payMoney, decimal payCard, decimal payCash, decimal payCredit, decimal payVoucher, decimal moneyZero)
        {
            string orderCode = CreateOrderCode();
            payInfo = payCard + "|" + payCash + "|" + payCredit + "|" + payVoucher;
            // 如果修改了金额,积分需要重新计算一下的
            int point = totalPoint;

            List<VipSoft.Model.OrderDetail> ListDetail = new List<VipSoft.Model.OrderDetail>();
            VipSoft.Model.OrderDetail detail;

            foreach (TempOrderInfo temp in listOrder)
            {
                detail = new VipSoft.Model.OrderDetail();
                detail.OrderCode=orderCode;
                detail.GoodsID=temp.GInfo.ID;
                detail.GoodsCode=temp.GInfo.GoodsCode;
                detail.GoodsName=temp.GInfo.Name;
                detail.OrderCode=orderCode;
                detail.Number=temp.Number;
                detail.Percent=temp.Discount;
                detail.IsService=temp.GInfo.GoodsType==(byte)0?true:false;
                detail.Price=temp.GInfo.Price;
                detail.DiscountPrice=temp.DiscountPrice;
                ListDetail.Add(detail);
            }
            VipSoft.BLL.OrderLog oLog = new VipSoft.BLL.OrderLog();
            bool ok;
            string logStrType, logStrOk, logStrErr;
            if (IsTravelerMember)
            {
                order = new Model.OrderLog();
                order.OrderCode = orderCode;
                order.OrderType = 0;
                order.MemID = 59;
                order.MemName = "散客消费";
                order.CardID = "0";
                order.CreateDateTime = DateTime.Now;
                order.DisCountMoney = discountPrice;
                order.MasterID = PublicState.Master.ID;
                order.MasterName = PublicState.Master.Name;
                order.PayInfo = payInfo;
                order.PayType = (int)expType;
                order.Point = totalPoint;
                order.ShopID = PublicState.Master.ShopID;
                order.ShopName = PublicState.Master.ShopName;
                order.TotalMoney = totalPrice;
                order.TotalNumber = totalNumber;

                ok = oLog.Add(order, ListDetail);

                logStrType = "散客消费";
                logStrOk = string.Format("消费成功,订单号:{0}消费金额:{1}", order.OrderCode, order.DisCountMoney);
                logStrErr = string.Format("消费失败,消费金额:{0}", order.DisCountMoney);
            }
            else
            {
                order = new Model.OrderLog();
                order.OrderCode = orderCode;
                order.OrderType = 0;
                order.MemID = memInfo.ID;
                order.MemName = memInfo.Name;
                order.CardID = memInfo.CardID;
                order.CreateDateTime = DateTime.Now;
                order.DisCountMoney = discountPrice;
                order.MasterID = PublicState.Master.ID;
                order.MasterName = PublicState.Master.Name;
                order.PayInfo = payInfo;
                order.PayType = (int)expType;
                order.Point = totalPoint;
                order.TotalMoney = totalPrice;
                order.TotalNumber = totalNumber;
                order.ShopID = PublicState.Master.ShopID;
                order.ShopName = PublicState.Master.ShopName;

                ok = oLog.Add(order, ListDetail);
                if (ok)
                {
                    VipSoft.BLL.MemCard bllMemCard = new BLL.MemCard();
                    VipSoft.BLL.PointLog bllPointLog = new BLL.PointLog();
                    memInfo.Point += totalPoint;
                    memInfo.TotalMoney += discountPrice;
                    memInfo.LastTime = DateTime.Now;
                    memInfo.Money -= payCard;
                    bllMemCard.Update(memInfo);
                    memInfo = bllMemCard.GetModel(memInfo.ID);

                    VipSoft.Model.PointLog modelPointLog = new Model.PointLog();
                    modelPointLog.CardID = memInfo.CardID;
                    modelPointLog.CreateDateTime = DateTime.Now;
                    modelPointLog.MemName = memInfo.Name;
                    modelPointLog.Point = totalPoint;
                    modelPointLog.ShopID = PublicState.Master.ShopID;
                    modelPointLog.ShopName = PublicState.Master.ShopName;
                    modelPointLog.Type = (int)PointLogType.OrderPoint;
                    bllPointLog.Add(modelPointLog);
                }

                logStrType = "会员消费";
                logStrOk = string.Format("消费成功,订单号:{0}会员卡号:{1}姓名:{2}消费金额:{3}所得积分:{4}付费方式:{5}",
                    order.OrderCode, order.CardID, order.MemName, order.DisCountMoney, order.Point, order.PayType.ToString());
                logStrErr = string.Format("消费失败,会员卡号:{0}姓名:{1}消费金额:{2}所得积分:{3}付费方式:{4}",
                    order.CardID, order.MemName, order.DisCountMoney, order.Point, order.PayType.ToString());
            }

            if (ok)
            {
                VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
                log.Add(new VipSoft.Model.SysLog(PublicState.Master, logStrType, logStrOk, DateTime.Now));

                // 更新当前会员的财务信息,因为打印的时候和更新等级的时候都需要显示出来
                if (!IsTravelerMember)
                {
                    memInfo = new VipSoft.BLL.MemCard().GetModel(memInfo.ID);
                    Function.UpdateMemberLevel(1, memInfo);
                }
                MessageBox.Show("消费成功。");

                // 清除数据
                this.label_OTMoney.Text = "";
                this.label_OTMoney2.Text = "";
                this.label_OTNumber.Text = "";
                this.label_OTPoint.Text = "";
                this.label_OTActivity.Text = "";
                listOrder = new List<TempOrderInfo>();
                order = null;
                this.dataGridView_List.Rows.Clear();
                ClearFormText();
                memInfo = null;
            }
            else
            {
                MessageBox.Show("系统错误导致消费失败,请重试。");
                // 记录日志
                VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog();
                log.Add(new VipSoft.Model.SysLog(PublicState.Master, logStrType,  logStrErr, DateTime.Now));
            }
        }