Example #1
0
        //添加消费记录
        public bool addModel(memberToUpModel model)
        {
            if (ID == null)
            {
                return(false);
            }
            bool result = false;

            SqlParameter[] pms = new SqlParameter[] {
                new SqlParameter("@czName", model.czName),
                new SqlParameter("@czMoney", model.czMoney),
                new SqlParameter("@czCount", model.czCount),
                new SqlParameter("@czyMoney", model.czyMoney),
                new SqlParameter("@czyCount", model.czyCount),
                new SqlParameter("@czType", model.czType),
                new SqlParameter("@czDate", SqlDbType.SmallDateTime)
                {
                    Value = model.czDate
                },
                new SqlParameter("@czSaleman", model.czSaleman),
                new SqlParameter("@czNo", model.czNo),
                new SqlParameter("@DPName", FilterClass.DianPu1.UserName.Trim())
            };
            string str = "insert into memberToUpMoney" + ID + "(czName,czMoney,czCount,czyMoney,czyCount,czType,czDate,czSaleman,czNo,DPName) values(@czName,@czMoney,@czCount,@czyMoney,@czyCount,@czType,@czDate,@czSaleman,@czNo,@DPName)";

            if (SqlHelper.ExecuteNonQuery(str, pms) > 0)
            {
                result = true;
            }
            return(result);
        }
Example #2
0
        public static void PrintToUpMoney(memberToUpModel model, string tel)
        {
            _tel      = tel;
            toupmoney = model;
            //打印预览
            PrintPreviewDialog ppd = new PrintPreviewDialog();
            PrintDocument      pd  = new PrintDocument();
            //设置边距
            Margins margin = new Margins(20, 20, 20, 20);

            //pd.PrinterSettings.PrinterName = FilterClass.MemberXF;
            pd.DefaultPageSettings.Margins = margin;
            //默认纸张
            PaperSize pageSize = new PaperSize("First custom size", getYc(58), 600);

            pd.DefaultPageSettings.PaperSize = pageSize;
            //打印事件设置
            pd.PrintPage += new PrintPageEventHandler(pd_PrintPage2);
            ppd.Document  = pd;
            ppd.ShowDialog();
            try
            {
                pd.Print();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "打印出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pd.PrintController.OnEndPrint(pd, new PrintEventArgs());
            }
        }
Example #3
0
        private void  除本条_Click(object sender, EventArgs e)
        {
            memberToUpModel model  = Alllist[dataGridView1.SelectedRows[0].Index];
            caocuofrom      caozuo = caocuofrom.Create(deletePassword, model.czId.ToString());

            caozuo.Show();
        }
Example #4
0
        //根据卡号查询所有的充值记录   应该是在查看会员信息的时候,在下面显示的充值信息
        public List <memberToUpModel> selectAllList(string cardNo)
        {
            string dpname = FilterClass.DianPu1.UserName.Trim();
            List <memberToUpModel> list = new List <memberToUpModel>();

            if (ID == null)
            {
                return(list);
            }
            memberToUpModel model;

            SqlParameter[] pms;
            int            i = 1;
            string         str;

            //if (dpname == "admin")
            //{
            pms = new SqlParameter[] {
                new SqlParameter("@czNo", cardNo)
            };
            str = "select * from memberToUpMoney" + ID + " where czNo=@czNo order by czDate";
            //}
            //else
            //{
            //    pms = new SqlParameter[]{
            //new SqlParameter("@czNo",cardNo),
            //new SqlParameter("@DPName",dpname)
            //};
            //    str = "select * from memberToUpMoney where czNo=@czNo and DPName=@DPName";
            //}
            SqlDataReader read = SqlHelper.ExecuteReader(str, pms);

            while (read.Read())
            {
                if (read.HasRows)
                {
                    model           = new memberToUpModel();
                    model.czName    = read["czName"].ToString().Trim();
                    model.czMoney   = read["czMoney"].ToString().Trim();
                    model.czCount   = read["czCount"].ToString().Trim();
                    model.czyMoney  = read["czyMoney"].ToString().Trim();
                    model.czyCount  = read["czyCount"].ToString().Trim();
                    model.czType    = read["czType"].ToString().Trim();
                    model.czDate    = read["czDate"].ToString().Trim();
                    model.czSaleman = read["czSaleman"].ToString().Trim();
                    model.czId      = Convert.ToInt32(read["czId"].ToString().Trim());
                    model.dianpu    = read["DPName"].ToString().Trim();
                    model.czXH      = i;
                    list.Add(model);
                }
                i++;
            }
            return(list);
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            memberInfoBLL   bll     = new memberInfoBLL();
            memberToUpModel model   = new memberToUpModel();
            bool            result  = false;
            bool            result1 = false;

            if (textBox9.Text.Trim() == "计次卡")
            {
                model.czMoney  = textBox6.Text.Trim();;
                model.czyMoney = "0";
                model.czCount  = textBox3.Text.Trim();
                model.czyCount = textBox2.Text.Trim();
            }
            else if (textBox9.Text.Trim() == "储值卡")
            {
                model.czCount  = textBox3.Text.Trim();
                model.czyCount = "0";
                model.czMoney  = textBox6.Text.Trim();
                model.czyMoney = textBox2.Text.Trim();
            }
            else if (textBox9.Text.Trim() == "折扣卡")
            {
                model.czCount  = textBox3.Text.Trim();
                model.czyCount = "0";
                model.czMoney  = textBox6.Text.Trim();
                model.czyMoney = textBox2.Text.Trim();
            }
            model.czNo      = textBox4.Text.Trim();
            model.czName    = textBox1.Text;
            model.czType    = textBox12.Text.Trim() + "-" + textBox9.Text.Trim();;
            model.czDate    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.czSaleman = comboBox1.Text == "" ? FilterClass.DianPu1.LoginName : comboBox1.Text;
            double m1 = Convert.ToDouble(textBox3.Text.Trim());
            double m2 = Convert.ToDouble(textBox2.Text.Trim());
            double m3 = m1 + m2;

            result  = bll.hyczMoney(textBox4.Text.Trim(), m3);
            result1 = bll1.addModel(model);
            if (result1 && result1)
            {
                MessageBox.Show("充值成功!");
                bind();
                //充值成功之后,打印小票
                PirentDocumentClass.PrintToUpMoney(model, textBox7.Text);
                this.Close();
            }
            else
            {
                MessageBox.Show("出现错误!");
            }
        }
Example #6
0
        /// <summary>
        /// 充值导出
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <param name="sheet"></param>
        /// <returns></returns>
        private static IWorkbook toupmoneypirent <T>(List <T> list, ISheet sheet)
        {
            int  rowIndex = 0;
            IRow row      = sheet.CreateRow(rowIndex);

            #region MyRegion//表头
            row.CreateCell(0).SetCellValue("会员卡号");
            row.CreateCell(1).SetCellValue("会员姓名");
            row.CreateCell(2).SetCellValue("卡类型");
            row.CreateCell(3).SetCellValue("充值日期");
            row.CreateCell(4).SetCellValue("业务员");
            row.CreateCell(5).SetCellValue("店铺名");
            row.CreateCell(6).SetCellValue("充值金额");
            row.CreateCell(7).SetCellValue("充值次数");
            row.CreateCell(8).SetCellValue("剩余金额");
            row.CreateCell(9).SetCellValue("剩余次数");
            rowIndex++;
            #endregion
            foreach (T item in list)
            {
                memberToUpModel model = item as memberToUpModel;
                //每遍历一条数据创建一行
                row = sheet.CreateRow(rowIndex);
                //创建行中的单元格
                row.CreateCell(0).SetCellValue(model.czNo);
                row.CreateCell(1).SetCellValue(model.czName);
                row.CreateCell(2).SetCellValue(model.czType);
                row.CreateCell(3).SetCellValue(model.czDate);
                row.CreateCell(4).SetCellValue(model.czSaleman);
                row.CreateCell(5).SetCellValue(model.dianpu);
                row.CreateCell(6).SetCellValue(model.czMoney);
                row.CreateCell(7).SetCellValue(model.czCount);
                row.CreateCell(8).SetCellValue(model.czyMoney);
                row.CreateCell(9).SetCellValue(model.czyCount);
                rowIndex++;
            }
            return(sheet.Workbook);
        }
Example #7
0
        //统计报表中的充值记录
        public List <memberToUpModel> selectTJ(string begindate, string enddate, string yginfo, string dpna)
        {
            string dpname = FilterClass.DianPu1.UserName.Trim();
            List <memberToUpModel> list = new List <memberToUpModel>();
            memberToUpModel        model;
            string str = "";

            //SqlParameter[] pms;
            if (dpname == "admin")
            {
                if (dpna == "全部")
                {
                    if (yginfo.Trim() != "全部")
                    {
                        foreach (KeyValuePair <string, int> iteam in FilterClass.dic)
                        {
                            str += "select * from ";
                            str += "memberToUpMoney" + iteam.Value + "";
                            str += " where czDate between '" + begindate + "' and '" + enddate + "' and czSaleman='" + yginfo.Trim() + "'";
                            str += " union all ";
                        }
                        str = str.Substring(0, str.Length - 10);
                        //            str = "select * from memberToUpMoney where czSaleman=@czSaleman and czDate between '" + begindate + "' and '" + enddate + "'";
                        //            pms = new SqlParameter[]{
                        //new SqlParameter("@czSaleman",yginfo)
                        //};
                    }
                    else
                    {
                        foreach (KeyValuePair <string, int> iteam in FilterClass.dic)
                        {
                            str += "select * from ";
                            str += "memberToUpMoney" + iteam.Value + "";
                            str += " where czDate between '" + begindate + "' and '" + enddate + "'";
                            str += " union all ";
                        }
                        str = str.Substring(0, str.Length - 10);
                    }
                }
                else
                {
                    int id = FilterClass.dic[dpna.Trim()];
                    if (yginfo.Trim() != "全部")
                    {
                        str = "select * from memberToUpMoney" + id + " where czSaleman='" + yginfo.Trim() + "' and czDate between '" + begindate + "' and '" + enddate + "'";
                    }
                    else
                    {
                        str = "select * from memberToUpMoney" + id + " where czDate between '" + begindate + "' and '" + enddate + "'";
                    }
                }
            }
            else
            {
                if (yginfo.Trim() != "全部")
                {
                    str = "select * from memberToUpMoney" + ID + " where czSaleman='" + yginfo.Trim() + "' and czDate between '" + begindate + "' and '" + enddate + "'";
                }
                else
                {
                    str = "select * from memberToUpMoney" + ID + " where czDate between '" + begindate + "' and '" + enddate + "'";
                }
            }


            SqlDataReader read = SqlHelper.ExecuteReader(str);

            while (read.Read())
            {
                if (read.HasRows)
                {
                    model           = new memberToUpModel();
                    model.czName    = read["czName"].ToString().Trim();
                    model.czMoney   = read["czMoney"].ToString().Trim();
                    model.czCount   = read["czCount"].ToString().Trim();
                    model.czyMoney  = read["czyMoney"].ToString().Trim();
                    model.czyCount  = read["czyCount"].ToString().Trim();
                    model.czType    = read["czType"].ToString().Trim();
                    model.czDate    = read["czDate"].ToString().Trim();
                    model.czSaleman = read["czSaleman"].ToString().Trim();
                    model.czNo      = read["czNo"].ToString().Trim();
                    model.czId      = Convert.ToInt32(read["czId"].ToString().Trim());
                    model.dianpu    = read["DPName"].ToString();
                    list.Add(model);
                }
            }
            return(list);
        }
Example #8
0
 public bool addModel(memberToUpModel model)
 {
     return(dal.addModel(model));
 }