public List <Member> GetAllMembers() { List <Member> elements = new List <Member>(); string sql = "select * from TF_Member order by ID desc"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Member element = new Member(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.姓名 = dt.Rows[i]["姓名"].ToString(); element.性别 = (性别)Enum.ToObject(typeof(性别), Convert.ToInt32(dt.Rows[i]["性别"])); element.卡种 = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[i]["卡种"])); element.卡号 = dt.Rows[i]["卡号"].ToString(); element.开卡日 = Convert.ToDateTime(dt.Rows[i]["开卡日"]); element.到期日 = Convert.ToDateTime(dt.Rows[i]["到期日"]); element.生日 = Convert.ToDateTime(dt.Rows[i]["生日"]); element.电话 = dt.Rows[i]["电话"].ToString(); element.住址 = dt.Rows[i]["住址"].ToString(); element.备注 = dt.Rows[i]["备注"].ToString(); elements.Add(element); } } return(elements); }
public static CardTypeLogic GetInstance() { if (instance == null) { instance = new CardTypeLogic(); } return(instance); }
private void LoadCardTypes() { List <CardType> elements = CardTypeLogic.GetInstance().GetAllCardTypes(); comboBox1.Items.Clear(); foreach (CardType element in elements) { comboBox1.Items.Add(element); } dataGridView1.DataSource = CardTypeLogic.GetInstance().GetCardTypes(string.Empty); }
private void LoadCardTypes() { List <CardType> elements = CardTypeLogic.GetInstance().GetAllCardTypes(); comboBox2.Items.Clear(); comboBox2.Items.Add("--不限--"); foreach (CardType element in elements) { comboBox2.Items.Add(element); } comboBox2.SelectedIndex = 0; }
private void button3_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (MessageBox.Show("确定要删除该卡种?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { CardType cardType = (CardType)comboBox1.SelectedItem; if (CardTypeLogic.GetInstance().DeleteCardType(cardType)) { LoadCardTypes(); } } } else { MessageBox.Show("先选定要删除的卡种!"); } }
public Renew GetRenew(int id) { string sql = "select * from TF_Renew where ID=" + id; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { Renew element = new Renew(); element.ID = id; element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[0]["MemberID"])); element.卡种 = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[0]["CardType"])); element.卡号 = dt.Rows[0]["卡号"].ToString(); element.续卡时间 = Convert.ToDateTime(dt.Rows[0]["续卡时间"]); element.经手人 = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["经手人"])); element.备注 = dt.Rows[0]["备注"].ToString(); return(element); } return(null); }
public Member GetMemberByDataRow(DataRow row) { Member element = null; if (row != null) { element = new Member(); element.ID = Convert.ToInt32(row["ID"]); element.姓名 = row["姓名"].ToString(); element.性别 = (性别)Enum.Parse(typeof(性别), row["性别"].ToString()); element.卡种 = CardTypeLogic.GetInstance().GetCardTypeByName(row["卡种"].ToString()); element.卡号 = row["卡号"].ToString(); element.开卡日 = Convert.ToDateTime(row["开卡日"]); element.到期日 = Convert.ToDateTime(row["到期日"]); element.生日 = Convert.ToDateTime(row["生日"]); element.电话 = row["电话"].ToString(); element.住址 = row["住址"].ToString(); element.备注 = row["备注"].ToString(); } return(element); }
public Member GetMemberByName(string name) { string sql = "select * from TF_Member where 姓名 like '%" + name + "%'"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { Member element = new Member(); element.ID = Convert.ToInt32(dt.Rows[0]["ID"]); element.姓名 = dt.Rows[0]["姓名"].ToString(); element.性别 = (性别)Enum.ToObject(typeof(性别), Convert.ToInt32(dt.Rows[0]["性别"])); element.卡种 = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[0]["卡种"])); element.卡号 = dt.Rows[0]["卡号"].ToString(); element.开卡日 = Convert.ToDateTime(dt.Rows[0]["开卡日"]); element.到期日 = Convert.ToDateTime(dt.Rows[0]["到期日"]); element.生日 = Convert.ToDateTime(dt.Rows[0]["生日"]); element.电话 = dt.Rows[0]["电话"].ToString(); element.住址 = dt.Rows[0]["住址"].ToString(); element.备注 = dt.Rows[0]["备注"].ToString(); return(element); } return(null); }
public List <Renew> GetAllRenews() { List <Renew> elements = new List <Renew>(); string sql = "select * from TF_Renew"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Renew element = new Renew(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[i]["MemberID"])); element.卡种 = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[i]["卡种"])); element.卡号 = dt.Rows[i]["卡号"].ToString(); element.续卡时间 = Convert.ToDateTime(dt.Rows[i]["续卡时间"]); element.经手人 = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[i]["经手人"])); element.备注 = dt.Rows[i]["备注"].ToString(); elements.Add(element); } } return(elements); }
public List <Member> GetMemberList(string where) { List <Member> elements = new List <Member>(); string w = ""; if (!string.IsNullOrEmpty(where)) { w = where.Trim().ToLower(); if (!w.StartsWith("where ")) { w = "where " + w; } } string sql = "select * from TF_Member " + w + " order by ID desc"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Member element = new Member(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.姓名 = dt.Rows[i]["姓名"].ToString(); element.性别 = (性别)Enum.ToObject(typeof(性别), Convert.ToInt32(dt.Rows[i]["性别"])); element.卡种 = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[i]["卡种"])); element.卡号 = dt.Rows[i]["卡号"].ToString(); element.开卡日 = Convert.ToDateTime(dt.Rows[i]["开卡日"]); element.到期日 = Convert.ToDateTime(dt.Rows[i]["到期日"]); element.生日 = Convert.ToDateTime(dt.Rows[i]["生日"]); element.电话 = dt.Rows[i]["电话"].ToString(); element.住址 = dt.Rows[i]["住址"].ToString(); element.备注 = dt.Rows[i]["备注"].ToString(); elements.Add(element); } } return(elements); }