//管理员——用户信息查找(查找指定用户) public List <User_BJ> User_Search(String search_model)//String search_info)//int BREAKTIME, String FORBID, String AWARD, String BREAKBJ) { User_BJ usersearch = new User_BJ(); IQuery <User_BJ> usersearch_query = chloe_connect.Query <User_BJ>(); List <User_BJ> user_list = new List <User_BJ>(); switch (search_model) { case "查找普通用户": user_list = usersearch_query.Where(a => a.Permissions == 2).ToList(); break; case "查找违约用户": user_list = usersearch_query.Where(a => a.BreakBJ.Contains("YES")).ToList(); break; case "查找禁用用户": user_list = usersearch_query.Where(a => a.Forbid.Contains("YES")).ToList(); break; case "查找奖励用户": user_list = usersearch_query.Where(a => a.Award.Contains("YES")).ToList(); break; case "查找违约次数为3的用户": user_list = usersearch_query.Where(a => a.BreakTime == 3).ToList(); break; } return(user_list); }
private void button3_Click(object sender, EventArgs e) { //退出页面时,修改对应用户在User_BJ表中的BreakBJ和Award值(修改为"NO") Start RR = new Start(); String EE = Start.CUser; User_BJ bj = new User_BJ(); chloe_control_all chloe_obj = new chloe_control_all("Data Source=DESKTOP-O4C25KM;Initial Catalog=场馆预约系统;Integrated Security=True"); chloe_obj.XG_BJ(EE); this.Hide(); YH yh2 = new YH(); yh2.Show(); }
public int User_checkkkkk(String personid) { //检测是否为奖励用户 User_BJ user_CHECK_jiangli = new User_BJ(); IQuery <User_BJ> user_CHECK_jiangli_query = chloe_connect.Query <User_BJ>(); user_CHECK_jiangli = user_CHECK_jiangli_query.Where(b => b.UserName == personid).FirstOrDefault(); if (user_CHECK_jiangli.Award.ToString() == "YES") { return(3); } else { return(4); } }
//用户——费用结算 public int USER_CHECK(String personid) { //检测是否为违约用户 User_BJ user_CHECK_weiyue = new User_BJ(); IQuery <User_BJ> user_CHECK_weiyue_query = chloe_connect.Query <User_BJ>(); user_CHECK_weiyue = user_CHECK_weiyue_query.Where(a => a.UserName == personid).FirstOrDefault(); if (user_CHECK_weiyue.BreakBJ.ToString() == "YES") { return(0); } else { return(1); } }
//结算完成修改用户标记 public User_BJ XG_BJ(String id) { try { User_BJ bj_xg = new User_BJ(); IQuery <User_BJ> change_user = chloe_connect.Query <User_BJ>(); bj_xg = change_user.Where(a => a.UserName == id).FirstOrDefault(); bj_xg.Award = "NO"; bj_xg.BreakBJ = "NO"; chloe_connect.Update <User_BJ>(bj_xg); MessageBox.Show("修改成功!"); return(bj_xg); } catch (Exception e) { Console.WriteLine(e.ToString()); MessageBox.Show("修改失败!"); return(null); } }
//管理员——删除用户 public bool del_YH(String userid) { try { Login Del_yh1 = new Login(); Del_yh1.UserName = userid; chloe_connect.Delete(Del_yh1); User_BJ Del_yh2 = new User_BJ(); Del_yh2.UserName = userid; chloe_connect.Delete(Del_yh2); MessageBox.Show("删除成功!"); return(true); } catch (Exception e) { Console.WriteLine(e.ToString()); MessageBox.Show("删除失败!"); return(false); } }
//用户——用户注册(表User_BJ) public bool YH_insert_user2(String username)//String forbid,String award,String breakbj,int breaktime,int permissions { try { User_BJ YH_insert2 = new User_BJ(); YH_insert2.UserName = username; YH_insert2.Permissions = 2; YH_insert2.Award = "NO"; YH_insert2.BreakBJ = "NO"; YH_insert2.BreakTime = 0; YH_insert2.Forbid = "NO"; chloe_connect.Insert(YH_insert2); return(true); } catch (Exception e) { Console.WriteLine(e.ToString()); return(false); } }
//管理员——用户注册(表User_BJ) public bool insert_user2(String username, int per) { try { User_BJ userBJ_to_insert = new User_BJ(); userBJ_to_insert.UserName = username; userBJ_to_insert.Permissions = per; userBJ_to_insert.Award = "NO"; userBJ_to_insert.BreakBJ = "NO"; userBJ_to_insert.BreakTime = 0; userBJ_to_insert.Forbid = "NO"; chloe_connect.Insert(userBJ_to_insert); return(true); } catch (Exception e) { Console.WriteLine(e.ToString()); return(false); } }
//登录检测 public int login_check(String User_id, String User_password) { Login user_result = new Login(); IQuery <Login> user_check_query = chloe_connect.Query <Login>(); user_result = user_check_query.Where(a => a.UserName == User_id).Where(a => a.Password == User_password).FirstOrDefault(); if (user_result == null) { return(0); } else//判断用户权限,实现跳转页面 //判断用户是否为禁用用户 { User_BJ user_permissons = new User_BJ(); User_BJ user_forbid = new User_BJ(); IQuery <User_BJ> user_permissions_check_query = chloe_connect.Query <User_BJ>(); IQuery <User_BJ> user_forbid_check = chloe_connect.Query <User_BJ>(); user_permissons = user_permissions_check_query.Where(a => a.UserName == User_id).FirstOrDefault(); user_forbid = user_forbid_check.Where(a => a.UserName == User_id).FirstOrDefault(); if (user_forbid.Forbid.ToString() == "YES") { return(3); } else { if (user_permissons.Permissions == 1) { return(1); } else { return(2); } } } }
//管理员——修改用户信息 public bool XG_YH(String id, int quanxian, int breaktime, String forbid, String award, String breakbj) { try { User_BJ YH_xg = new User_BJ(); YH_xg.UserName = id; YH_xg.Permissions = quanxian; YH_xg.BreakTime = breaktime; YH_xg.Forbid = forbid; YH_xg.Award = award; YH_xg.BreakBJ = breakbj; chloe_connect.Update <User_BJ>(YH_xg); MessageBox.Show("修改成功!"); return(true); } catch (Exception e) { Console.WriteLine(e.ToString()); MessageBox.Show("修改失败!"); return(false); } }
private void button1_Click_1(object sender, EventArgs e) { //选择好场地id和日期后,点击支付按钮,先判断其有无奖励或者违规标记,有奖励,弹窗提示免单,然后将该条数据保存在PAY表,然后删除该条数据 //将用户的免单标记值修改为NO //有违规,弹窗显示其为存在违规,需加收违约金,然后弹窗显示支付金额,进入扫码支付界面进行支付,正常付钱,将数据写进PAY表,删除Booking表中该条数据 //支付不正常,将数据写进PAY表,Booking表对应数据不删除 //返回时,还原其标记值 //为普通用户,弹窗显示支付金额,进入扫码支付界面进行支付,后面如上。 //判断用户 Start NE21 = new Start(); String NE22 = Start.CUser; chloe_control_all chloe_obj1 = new chloe_control_all("Data Source=DESKTOP-O4C25KM;Initial Catalog=场馆预约系统;Integrated Security=True"); Booking BigBang = new Booking(); BigBang = chloe_obj1.See_BOOK_CD(comboBox1.SelectedValue.ToString()); int BJ_check_result; BJ_check_result = chloe_obj1.User_checkkkkk(NE22); if (BJ_check_result == 3) //该值为3时是奖励用户 { MessageBox.Show("您为奖励用户,已为您本次消费免单!"); String pay_id, pay_name, yard_id, begin_time, over_time, book_time, real_time, pay_money; DateTime pay_time; pay_id = BigBang.Book_personid.ToString(); pay_name = BigBang.Book_person.ToString(); yard_id = comboBox1.SelectedValue.ToString(); begin_time = BigBang.OpenTime.ToString(); over_time = BigBang.CloseTime.ToString(); book_time = BigBang.BookDate.ToString(); real_time = BigBang.REALDate.ToLongDateString().ToString(); pay_money = (Paymoney).Trim().ToString(); pay_time = DateTime.Now; chloe_control_all chloe_obj2 = new chloe_control_all("Data Source=DESKTOP-O4C25KM;Initial Catalog=场馆预约系统;Integrated Security=True"); chloe_obj2.UserPay(pay_id, pay_name, yard_id, begin_time, over_time, book_time, real_time, pay_money, pay_time); Booking del = new Booking(); User_BJ bj = new User_BJ(); chloe_control_all chloe_del = new chloe_control_all("Data Source=DESKTOP-O4C25KM;Initial Catalog=场馆预约系统;Integrated Security=True"); chloe_obj2.QUXIAO_YD(comboBox1.SelectedValue.ToString()); chloe_del.XG_BJ(NE22); } else { //违规用户 int bj_result; bj_result = chloe_obj1.USER_CHECK(NE22); if (bj_result == 0) { countmoney(); MessageBox.Show("系统检测到您为违约用户,需在本次消费中收取违约金"); MessageBox.Show("您需要支付:" + MMMM.ToString() + "元"); Count_pay2 br = new Count_pay2(); CHANGDI = comboBox1.SelectedValue.ToString(); this.Hide(); br.Show(); } //正常用户 countmoney(); MessageBox.Show("您需要支付:" + MMMM.ToString() + "元"); Count_pay2 nor = new Count_pay2(); CHANGDI = comboBox1.SelectedValue.ToString(); this.Hide(); nor.Show(); } }