/// <summary> /// 绑定树形菜单 /// </summary> private void BindTree() { VipSoft.BLL.CardLevel level = new VipSoft.BLL.CardLevel(); listLevel = level.GetList(""); TreeNode rootNode = new TreeNode("所有会员"); rootNode.Name = "all_Level"; foreach (DataRow dr in listLevel.Tables[0].Rows) { TreeNode node = new TreeNode(dr["LevelName"].ToString()); node.Name = "level_" + dr["ID"].ToString(); rootNode.Nodes.Add(node); } this.treeView_Class.Nodes.Add(rootNode); TreeNode rootNode_State = new TreeNode("所有会员"); rootNode_State.Name = "all_state"; TreeNode node1 = new TreeNode("正常"); node1.Name = "state_" + ((int)CardState.Normal); rootNode_State.Nodes.Add(node1); TreeNode node2 = new TreeNode("锁定"); node2.Name = "state_" + ((int)CardState.Locked); rootNode_State.Nodes.Add(node2); TreeNode node3 = new TreeNode("挂失"); node3.Name = "state_" + ((int)CardState.Lossed); rootNode_State.Nodes.Add(node3); this.treeView_Class.Nodes.Add(rootNode_State); this.treeView_Class.ExpandAll(); }
private void button_Delete_Click(object sender, EventArgs e) { if (this.dataGridView_List.SelectedRows.Count != 1) { MessageBox.Show("删除记录,请先选择需要删除的行。"); return; } VipSoft.BLL.CardLevel level = new VipSoft.BLL.CardLevel(); DataGridViewRow row = this.dataGridView_List.SelectedRows[0]; string ID = row.Cells["ID"].Value.ToString(); DataTable lst = level.GetListC(int.Parse(ID)); if (lst.Rows.Count > 0) { MessageBox.Show("对不起,当前等级已有会员信息,不能删除此等级!"); return; } else { DialogResult res = MessageBox.Show("确定要删除当前等级么?删除可能会影响到该等级会员卡的使用。", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (res.ToString() == "OK") { level.Delete(int.Parse(row.Cells["ID"].Value.ToString())); // 记录日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master,"会员等级管理", string.Format("删除会员等级(ID:{0}名称:{1}所需积分:{2}兑换比例:{3}折扣比例:{4})", row.Cells["ID"].Value.ToString(), row.Cells["LevelName"].Value.ToString(), row.Cells["NeedPoint"].Value.ToString(), row.Cells["Point"].Value.ToString(), row.Cells["Percent"].Value.ToString()),DateTime.Now)); // 提示 MessageBox.Show("数据已成功删除。"); // 重新绑定 BindList(); } } }
private void RechargeMoneyReport_Load(object sender, EventArgs e) { this.dateTimePicker_Start.Text = DateTime.Now.ToShortDateString(); this.comboBox_Sign_Money.SelectedIndex = 0; // 会员等级 DataTable dtLevel = new VipSoft.BLL.CardLevel().GetAllList().Tables[0]; this.comboBox_Level.Items.Add(new DictionaryEntry("所有等级", "0")); foreach (DataRow dr in dtLevel.Rows) this.comboBox_Level.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString())); this.comboBox_Level.DisplayMember = "Key"; this.comboBox_Level.ValueMember = "Value"; this.comboBox_Type.Items.Add(new DictionaryEntry("所有类型", "-1")); this.comboBox_Type.Items.Add(new DictionaryEntry("卡片付费初始化", "0")); this.comboBox_Type.Items.Add(new DictionaryEntry("储值卡现金充值", "1")); this.comboBox_Type.Items.Add(new DictionaryEntry("储值卡银联充值", "6")); this.comboBox_Type.Items.Add(new DictionaryEntry("记次卡现金充次", "2")); this.comboBox_Type.Items.Add(new DictionaryEntry("记次卡银联充次", "7")); this.comboBox_Type.Items.Add(new DictionaryEntry("储值卡扣款", "3")); this.comboBox_Type.Items.Add(new DictionaryEntry("积分返余额", "4")); this.comboBox_Type.Items.Add(new DictionaryEntry("卡片余额初始化", "5")); this.comboBox_Type.DisplayMember = "Key"; this.comboBox_Type.ValueMember = "Value"; this.comboBox_Sign_Money.SelectedIndex = 0; }
void BindList() { this.dgvRechargeList.Rows.Clear(); DataTable dt = new VipSoft.BLL.RechargeLog().GetReportList(QueryCondition()).Tables[0]; foreach (DataRow dr in dt.Rows) { VipSoft.Model.CardLevel LevelModel=new VipSoft.BLL.CardLevel().GetModel(int.Parse(dr["LevelID"].ToString())); this.dgvRechargeList.Rows.Add(dr["CardID"].ToString(), dr["MemName"].ToString(), LevelModel.LevelName, dr["Type"].ToString() == "0" ? "卡片付费初始化" : dr["Type"].ToString() == "1" ? "储值卡现金充值" : dr["Type"].ToString() == "2" ? "记次卡现金充次" : dr["Type"].ToString() == "3" ? "储值卡扣款" : dr["Type"].ToString() == "5" ? "卡片余额初始化" : dr["Type"].ToString() == "6" ? "储值卡银联充值" : dr["Type"].ToString() == "7" ? "计次卡银联充次" : "积分返余额", dr["Money"].ToString(), dr["CreateTime"].ToString(), dr["GiveMoney"].ToString(), dr["Remark"].ToString()); } }
/// <summary> /// 加载卡片等级 /// </summary> private void LoadCardLevel() { VipSoft.BLL.CardLevel level = new VipSoft.BLL.CardLevel(); DataSet ds = level.GetAllList(); this.LevelID.DataSource = ds.Tables[0]; this.LevelID.DisplayMember = "LevelName"; this.LevelID.ValueMember = "ID"; }
private void button_Manage_Click(object sender, EventArgs e) { if (!CheckInput()) return; VipSoft.BLL.CardLevel cardL = new VipSoft.BLL.CardLevel(); string needP = this.textBox_needpoint.Text; VipSoft.Model.CardLevel level = new VipSoft.Model.CardLevel(); level.LevelName=this.textBox_LevelName.Text; level.NeedPoint=int.Parse(needP); level.Point=int.Parse(this.textBox_Point.Text); level.Percent=decimal.Parse(this.textBox_Percent.Text); if (this.label_Flag.Text == "add") { if (cardL.Exists(this.textBox_LevelName.Text)) { MessageBox.Show("等级名称重复,请重新输入!"); this.textBox_LevelName.Text = ""; this.textBox_LevelName.Focus(); return; } cardL.Add(level); // 记录日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master,"会员等级管理", string.Format("新增会员等级(名称{0}:所需积分{1}:兑换比例{2}:折扣比例{3}:)", this.textBox_LevelName.Text, needP, this.textBox_Point.Text, this.textBox_Percent.Text), DateTime.Now)); // 提示 MessageBox.Show("新等级录入成功。"); // 文本框数据清空 this.textBox_LevelName.Text = ""; this.textBox_Percent.Text = ""; this.textBox_Point.Text = ""; this.textBox_needpoint.Text = ""; } // 编辑 else { level.ID = int.Parse(this.label_Flag.Text); cardL.Update(level); // 记录日志 VipSoft.BLL.SysLog log = new VipSoft.BLL.SysLog(); log.Add(new VipSoft.Model.SysLog(PublicState.Master,"会员等级管理", string.Format("编辑会员等级(ID:{0}名称:{1}所需积分:{2}兑换比例:{3}折扣比例:{4})", this.label_Flag.Text, this.textBox_LevelName.Text, needP, this.textBox_Point.Text, this.textBox_Percent.Text), DateTime.Now)); // 提示 MessageBox.Show("等级修改成功。"); } // 绑定数据 BindList(); }
private void OrderReport_Load(object sender, EventArgs e) { this.comboBox_PayType.Items.Add(new DictionaryEntry("所有类型", "")); this.comboBox_PayType.Items.Add(new DictionaryEntry("储值卡余额消费", "1")); this.comboBox_PayType.Items.Add(new DictionaryEntry("现金消费", "2")); this.comboBox_PayType.Items.Add(new DictionaryEntry("信用卡支付", "3")); this.comboBox_PayType.Items.Add(new DictionaryEntry("代金券支付", "4")); this.comboBox_PayType.Items.Add(new DictionaryEntry("联合支付", "5")); this.comboBox_PayType.DisplayMember = "Key"; this.comboBox_PayType.ValueMember = "Value"; this.comboBox_G_PayType.Items.Add(new DictionaryEntry("所有类型", "")); this.comboBox_G_PayType.Items.Add(new DictionaryEntry("储值卡余额消费", "1")); this.comboBox_G_PayType.Items.Add(new DictionaryEntry("现金消费", "2")); this.comboBox_G_PayType.Items.Add(new DictionaryEntry("联合消费", "3")); this.comboBox_G_PayType.DisplayMember = "Key"; this.comboBox_G_PayType.ValueMember = "Value"; // 会员等级 DataTable dtLevel = new VipSoft.BLL.CardLevel().GetAllList().Tables[0]; this.comboBox_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0")); foreach (DataRow dr in dtLevel.Rows) this.comboBox_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString())); this.comboBox_CardLevel.DisplayMember = "Key"; this.comboBox_CardLevel.ValueMember = "Value"; this.comboBox_B_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0")); foreach (DataRow dr in dtLevel.Rows) this.comboBox_B_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString())); this.comboBox_B_CardLevel.DisplayMember = "Key"; this.comboBox_B_CardLevel.ValueMember = "Value"; this.comboBox_P_CardLevel.Items.Add(new DictionaryEntry("所有等级", "0")); foreach (DataRow dr in dtLevel.Rows) this.comboBox_P_CardLevel.Items.Add(new DictionaryEntry(dr["LevelName"].ToString(), dr["ID"].ToString())); this.comboBox_P_CardLevel.DisplayMember = "Key"; this.comboBox_P_CardLevel.ValueMember = "Value"; DataTable dtClass; // 产品分类 dtClass = new VipSoft.BLL.GoodsClass().GetList("ShopID="+PublicState.Master.ShopID).Tables[0]; Function.BindGoodsClass(this.comboBox_G_Class, dtClass); Function.BindGoodsClass(this.comboBox_M_Class, dtClass); DataTable dt = (DataTable)this.comboBox_G_Class.DataSource; this.comboBox_G_Class.DataSource = dt; this.comboBox_M_Class.DataSource = dt; this.comboBox_Sign.SelectedIndex = 0; this.comboBox_B_Sign.SelectedIndex = 0; this.comboBox_OrderType.SelectedIndex = 0; this.comboBox_PayType.SelectedIndex = 0; this.comboBox_G_Sign.SelectedIndex = 0; this.comboBox_G_OrderType.SelectedIndex = 0; this.comboBox_G_PayType.SelectedIndex = 0; this.comboBox_G_Class.SelectedIndex = 0; this.comboBox_M_Sign.SelectedIndex = 0; this.comboBox_M_OrderType.SelectedIndex = 0; this.comboBox_M_Class.SelectedIndex = 0; this.comboBox_P_Sign.SelectedIndex = 0; this.dateTimePicker_Start.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_End.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_G_Start.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_G_End.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_M_Start.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_M_End.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_B_Start.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_P_Start.Text = DateTime.Now.ToShortDateString(); this.dateTimePicker_P_End.Text = DateTime.Now.ToShortDateString(); this.maskedTextBox_B_Start.Text = "00:00:00"; this.maskedTextBox_P_Start.Text = "00:00:00"; this.maskedTextBox_P_End.Text = "00:00:00"; this.maskedTextBox_B_End.Text = "23:59:59"; this.maskedTextBox_End.Text = "23:59:59"; this.maskedTextBox_G_Start.Text = "00:00:00"; this.maskedTextBox_G_End.Text = "23:59:59"; this.maskedTextBox_M_Start.Text = "00:00:00"; this.maskedTextBox_M_End.Text = "23:59:59"; this.maskedTextBox5.Text = "00:00:00"; }
/// <summary> /// 根据等级编号得到该等级的折扣率(1表示不打折) /// </summary> public static int LevelIDToPoint(int levelID) { List<VipSoft.Model.CardLevel> listLevel = new VipSoft.BLL.CardLevel().GetModelList(""); foreach (VipSoft.Model.CardLevel level in listLevel) { if (level.ID == levelID) return (int)level.Point; } return 0; }
/// <summary> /// 根据等级编号得到该等级的折扣率(1表示不打折) /// </summary> public static decimal LevelIDToPercent(int levelID) { List<VipSoft.Model.CardLevel> listLevel = new VipSoft.BLL.CardLevel().GetModelList(""); foreach (VipSoft.Model.CardLevel level in listLevel) { if (level.ID == levelID) return (decimal)level.Percent; } return 1M; }
/// <summary> /// 将等级编号转换为名称 /// </summary> public static string LevelIDToName(int levelID) { List<VipSoft.Model.CardLevel> listLevel = new VipSoft.BLL.CardLevel().GetModelList(""); foreach (VipSoft.Model.CardLevel level in listLevel) { if (level.ID == levelID) return level.LevelName; } return ""; }