/// <summary> ///check if the user is exsit /// </summary> /// <param name="client"></param> /// <returns></returns> public String CheckUser(BE.Client client) { using (var db = new BE.AppContext()) { foreach (var item in db.Users) { if (item.Id == client.Id && item.Password == client.password) { return(item.Id); } } } return(null); }
public void del_client(BE.Client cli) { try { (from item in xml_control.Client_Root.Elements() where item.Element("ID").Value == cli.Id1.ToString() select item).Remove(); xml_control.Client_Root.Save(xml_control.Client_Path); } catch (Exception e) { throw new Exception(e.Message); } }
public void add_client(BE.Client cli) { if (is_client_exist(cli.Id1)) { throw new Exception("קימת תעודת זהות"); } else if (cli.Id1 == 0) { cli.Id1 = create_new_id(); } xml_control.Client_Root.Add(cli.ToXml()); xml_control.Client_Root.Save(xml_control.Client_Path); }
public String CheckUser(BE.Client client) { return(dal.CheckUser(client)); }
public void update_client(BE.Client cli, BE.update t, object obj) { switch (t) { case update.vatek: if (obj is int) { del_client(cli); cli.Vatk = (int)obj; } else { throw new Exception("לא נשלח מספר של וטק"); } break; case update.vip: if (obj is bool) { del_client(cli); cli.isVip = (bool)obj; } else { throw new Exception("האוביקט שנשלח אינו מסוג בוליאן"); } break; case update.address: { if (obj is addres) { del_client(cli); cli.Address1 = (addres)obj; } else { throw new Exception("this objet is not an addres"); } } break; case update.cradit_card: { if (obj is CreditCard) { del_client(cli); cli.Card_dit = (CreditCard)obj; } else { throw new Exception("this objet is not a credit card"); } } break; case update.age: { if (obj is int) { del_client(cli); cli.Age = (int)obj; } else { throw new Exception("this objet is not a age"); } } break; case update.rishion_nahg: if (obj is rishion) { del_client(cli); cli.rishoi = (rishion)obj; } else { throw new Exception("this objet is not a age"); } break; default: throw new Exception(string.Format("this {0} is not an updat option", t.ToString())); } add_client(cli); }