public Order(int iId, User iPurchaser, string iItemsDescription, int iAmount) { Id = iId; Purchaser = iPurchaser; ItemsDescription = iItemsDescription; Amount = iAmount; }
public PatientsHistory(int iId, User iDoctor, Patient iPat, string iDiseaseName, DateTime iDate) { Id = iId; Doctor = iDoctor; Pat = iPat; DiseaseName = iDiseaseName; Date = iDate; }
public static int UpdateUser(User iUsrOld, User iUsrNew) { RemoveUser(iUsrOld.Id); AddUser(iUsrNew); return 0; }
public static int AddUser(User iUser) { if (GlobalVars.LoggedInUser.AccessLvl == AccessLevel.Admin) { GlobalVars.UsersList.Add(new User(++GlobalVars.UsersIdCounter, iUser.Login, iUser.Passwd, iUser.AccessLvl)); DBManager.Serialize(GlobalVars.UsersList, GlobalVars.UsersDbName); CreatingDatabaseSelects.UserInsert(iUser); return 0; } return 1; //access lvl error }
public static void UserInsert(User iU) { if (GlobalVars.ConnectedToDatabase) { MySqlConnection con = new MySqlConnection(MyConnectionString); con.Open(); try { MySqlCommand cmd = con.CreateCommand(); cmd.CommandText = "insert into users(id, login, passwd, accesslvl) values(" + iU.Id + ",'" + iU.Login + "','" + iU.Passwd + "','" + iU.AccessLvl+ "');"; cmd.ExecuteNonQuery(); } catch (Exception) { } finally { if (con.State == ConnectionState.Open) { con.Close(); } } } }
/* -- User -- */ public static void UserUpdate(User iU) { if (GlobalVars.ConnectedToDatabase) { UserDelete(iU.Id); UserInsert(iU); } }