Example #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();
            }
        }
Example #2
0
        private void BindList()
        {
            VipSoft.BLL.MemCard memCard = new BLL.MemCard();
            DataSet ds = memCard.GetList(pageSize, currentPage, out resCount, condition);
            this.dataGridView_List.DataSource = ds.Tables[0];

            for (int i = 0; i < dataGridView_List.Rows.Count; i++)
            {
                dataGridView_List.Rows[i].Cells[0].Value = false;
            }

            BindPage();
        }
        public void search_Click(object sender, EventArgs e)
        {
            String conditionStr = "";
            if (this.search_box.Text == null)
            {
                MessageBox.Show("请先录入会员卡号或者手机号。");
                search_box.Focus();
                return;
            }

            conditionStr += " cardid ='"+search_box.Text+"' or mobile ='"+search_box.Text+"' ";

            VipSoft.BLL.MemCard memCard = new BLL.MemCard();
            DataSet ds = memCard.GetList(conditionStr);
            DataTable dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {

                DataRow dr = dt.Rows[0];
                this.v_cardid.Text = dr["cardid"].ToString();
                this.name.Text = dr["name"].ToString();
                this.v_money.Text = dr["money"].ToString();
                this.totalMoney.Text = dr["totalMoney"].ToString();
                this.point.Text = dr["point"].ToString();
                this.mobile.Text = dr["mobile"].ToString();
                this.pasttime.Text = dr["pasttime"].ToString().Substring(0, 10);
                this.levelid.Text = dr["levelid"].ToString();
                this.id.Text = dr["id"].ToString();

            }
            else
            {

                this.v_cardid.Text = "";
                this.name.Text = "";
                this.v_money.Text ="";
                this.totalMoney.Text = "";
                this.point.Text = "";
                this.mobile.Text = "";
                this.pasttime.Text ="";
                this.levelid.Text = "";
                this.id.Text = "";
            }

            //SearchMem searchDlg = new SearchMem();

               // this.dataGridView_List.DataSource = ds.Tables[0];
        }
Example #4
0
        private void exportExcel_Click(object sender, EventArgs e)
        {
            String filePath = new Maticsoft.Common.INIFile().IniReadValue("config", "downloadPath");;
            String fileName = "member.xls";
            String[] title = new String[] { "会员卡号", "卡面号", "会员姓名" ,"手机号码","邮件","性别","当前等级", "当前积分", "当前余额", "累计消费", "会员卡状态" };
            int[] width = new int[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 };

            VipSoft.BLL.MemCard memCard = new BLL.MemCard();
            DataSet ds = memCard.GetExportList(condition);

            VipSoft.Common.NPOI2.ExcelInfo  ei = new VipSoft.Common.NPOI2.ExcelInfo();
            ei.filePath = filePath + fileName;
            VipSoft.Common.NPOI2.ExcelUtils.writeExcel(ds.Tables[0], ei, title, width);

            SaveFileDialog SaveFile = new SaveFileDialog();
            SaveFile.FileName = fileName;
            SaveFile.Filter = "Miscrosoft Office Excel 97-2003 工作表|*.xls|所有文件(*.*)|*.*";
            SaveFile.RestoreDirectory = true;
            if (SaveFile.ShowDialog() == DialogResult.OK)
            {
                String destFName = SaveFile.FileName;
                System.IO.File.Copy(filePath+fileName, destFName, true);//文件另存为
                MessageBox.Show("文件导出成功");
            }
        }
Example #5
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));
            }
        }