private void Update() { if (MyInfoManager.Instance.Seq > 0 && BuffManager.Instance.netCafeCode == 0 && CSNetManager.Instance.Sock != null && CSNetManager.Instance.Sock.IsConnected()) { dummyTime += Time.deltaTime; if (Input.anyKeyDown) { Clear(); } if (userType == USER_TYPE.ACTIVE_USER && Mathf.Abs(timeout - dummyTime) < 60f) { userType = USER_TYPE.LAZY_USER; SystemMsgManager.Instance.ShowMessage(StringMgr.Instance.Get("SHUTDOWN_DUMMY_USER_SOON")); } if (dummyTime >= timeout) { Clear(); GlobalVars.Instance.shutdownNow = true; CSNetManager.Instance.Sock.SendCS_LOGOUT_REQ(); CSNetManager.Instance.Sock.Close(); P2PManager.Instance.Shutdown(); MessageBoxMgr.Instance.AddQuitMesssge(StringMgr.Instance.Get("SHUTDOWN_DUMMY_USER")); } } }
private TisRole[] ObtainCurrentRoles(USER_TYPE enUserType) { ArrayBuilder oRoles = new ArrayBuilder(typeof(TisRole)); foreach (KeyValuePair <string, ITisRole> kvp in m_oRoles) { TisRole oRole = (TisRole)m_oRoles[kvp.Key]; if (enUserType == USER_TYPE.USER) { if (oRole.ContainsCurrentSystemUser()) { oRoles.Add(oRole); } } else { if (oRole.ContainsCurrentSystemGroup()) { oRoles.Add(oRole); } } } return((TisRole[])oRoles.GetArray()); }
public Form1() { InitializeComponent(); UserType = USER_TYPE.CUSTOMER; controller = new Controller(); updateView(); }
public User(AppUser user) { this.Username = user.Username; this.Password = user.Password; this.FirstName = user.FirstName; this.LastName = user.LastName; this.Type = user.Type; }
private void radioButton1_CheckedChanged_1(object sender, EventArgs e) { if (radioButton1.Checked) { UserType = USER_TYPE.CUSTOMER; panel3.BringToFront(); updateView(); } }
private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) { UserType = USER_TYPE.EXECUTIVE; panel2.BringToFront(); updateView(); } }
public override List <Product> GetData(USER_TYPE userType, Boolean isSignificant, Boolean isSales, Boolean isSorted) { if (userType == USER_TYPE.EXECUTIVE) { ExecView execView = new ExecView(); return(execView.GetData(userType, isSignificant, isSales, isSorted)); } return(null); }
public override Boolean PurchaseProduct(USER_TYPE userType, string name, int quantity) { if (userType == USER_TYPE.CUSTOMER) { CustView custView = new CustView(); return(custView.PurchaseProduct(userType, name, quantity)); } return(false); }
public override bool AddProduct(USER_TYPE userType, string name, double price, int quantity) { if (userType == USER_TYPE.EXECUTIVE) { ExecView execView = new ExecView(); return(execView.AddProduct(userType, name, price, quantity)); } return(false); }
public override List <Product> GetData(USER_TYPE userType, Boolean isSignificant, Boolean isSales, Boolean isSorted) { if (userType == USER_TYPE.CUSTOMER) { CustView custView = new CustView(); return(custView.GetData(userType, isSignificant, isSales, isSorted)); } return(null); }
public void ChangeUserType(USER_TYPE userType) { if (userType == USER_TYPE.CUSTOMER) { view = new CustViewProxy(); } else { view = new ExecViewProxy(); } }
public override List <Product> GetData(USER_TYPE userType, Boolean isSignificant, Boolean isSales, Boolean isSorted) { IProductData prodData = (ProductData)productData.Clone(); prodData = new FilterProductSale(prodData); if (isSorted) { prodData = new SortProduct(prodData); } return(prodData.GetProducts()); }
public User(int id, string username, string password, string type) { this.id = id; this.username = username; this.password = password; switch (type) { case "admin": this.type = USER_TYPE.ADMIN; break; case "supporter": this.type = USER_TYPE.SUPPORTER; break; default: throw new ArgumentException("The type of this user is undefined."); } }
public override Boolean PurchaseProduct(USER_TYPE userType, string name, int quantity) { return(false); }
public UserInfo(string userid, UserAPI.USER_TYPE type) { this.userid = userid; this.type = type; }
public Boolean PurchaseProduct(USER_TYPE userType, string name, int quantity) { view.PurchaseProduct(userType, name, quantity); return(true); }
public Boolean AddProduct(USER_TYPE userType, string name, double price, int quantity) { view.AddProduct(userType, name, price, quantity); return(true); }
public List <Product> GetProducts(USER_TYPE userType, Boolean isSignificant, Boolean isSales, Boolean isSorted) { List <Product> prods = view.GetData(userType, isSignificant, isSales, isSorted); return(prods); }
//Function to check if a user has provided the right id and password to access privledges of a certain user type. public static Boolean checkAuthentication(int userID, String password, USER_TYPE userType) { //Database model object to interact with the MySQL database. DatabaseModel dbModel = new DatabaseModel(); //Calculate the password hash from the inputted password String calculatedHash = calculatePasswordHash(password); //Create MySQLParameters for the user id and password hash MySqlParameter[] Parameters = new MySqlParameter[2]; Parameters[0] = new MySqlParameter("@u_ID", userID); Parameters[1] = new MySqlParameter("@p_hash", calculatedHash); //Surrounded by a try block. Exceptions will be thrown in the case of failed authentication. try { //Execute a different stored procedure, based on the user type //This allows for querying different tables of the DB based on the user type. //If the stored procedure returns one row, the user passes authentication. //If zero rows or more than one row are returned by the stored procedure, the user fails authentication switch (userType) { case USER_TYPE.USER: DataTable users = dbModel.Execute_Data_Query_Store_Procedure("getUsers", Parameters); if (users.Rows.Count == 1) { return(true); } break; case USER_TYPE.PROPERTY_MANAGER: DataTable propertyManagers = dbModel.Execute_Data_Query_Store_Procedure("getPropertyManagers", Parameters); if (propertyManagers.Rows.Count == 1) { return(true); } break; case USER_TYPE.DISTRICT_MANAGER: DataTable districtManagers = dbModel.Execute_Data_Query_Store_Procedure("getDistrictManagers", Parameters); if (districtManagers.Rows.Count == 1) { return(true); } break; case USER_TYPE.TECHNICIAN: DataTable technicians = dbModel.Execute_Data_Query_Store_Procedure("getTechnicians", Parameters); if (technicians.Rows.Count == 1) { return(true); } break; case USER_TYPE.LANDLORD: DataTable landlords = dbModel.Execute_Data_Query_Store_Procedure("getLandlords", Parameters); if (landlords.Rows.Count == 1) { return(true); } break; case USER_TYPE.CLIENT: DataTable clients = dbModel.Execute_Data_Query_Store_Procedure("getClients", Parameters); if (clients.Rows.Count == 1) { return(true); } break; } }catch (Exception e) { //If an exception is thrown, authentication fails return(false); } //If there is no exception thrown, but the user is still not found in the correct table, authentication fails. return(false); }
public abstract List <Product> GetData(USER_TYPE userType, Boolean significant, Boolean sales, Boolean isSorted);
public abstract Boolean PurchaseProduct(USER_TYPE userType, string name, int quantity);
public abstract Boolean AddProduct(USER_TYPE userType, string name, double price, int quantity);
/// <summary> /// Negotiates a transaction with Venmo. /// </summary> /// <param name="usertype">The type of user ID which will be provided.</param> /// <param name="recipient">The user's ID, phone number, or email as indicated by usertype.</param> /// <param name="note">The note to accompany the transaction.</param> /// <param name="sendAmount">The <code>double</code> amount of the transaction.</param> /// <param name="audience">The audience ("public", "friends", or "private") to which this transaction should be visible. Defaults to public.</param> /// <exception cref="VenmoWrapper.NotLoggedInException">Throws a NotLoggedInException if the user is not logged in.</exception> /// <returns>VenmoTransaction object corresponding to the just-negotiated transaction.</returns> public static async Task<VenmoTransaction> PostVenmoTransaction(USER_TYPE usertype, string recipient, string note, double sendAmount, string audience = "public") { CheckLoginStatus(); string type = usertype == USER_TYPE.EMAIL ? "email=" : usertype == USER_TYPE.PHONE ? "phone=" : "user_id="; string postData = "access_token=" + currentAuth.userAccessToken + "&" + type + recipient + "¬e=" + note + "&amount=" + sendAmount + "&audience=" + audience; string venmoResponse = await VenmoPost(venmoPaymentUrl, postData); string paymentData = JsonConvert.DeserializeObject<Dictionary<string, object>>(venmoResponse)["data"].ToString(); Dictionary<string, object> transData = JsonConvert.DeserializeObject <Dictionary<string, object>>(paymentData); if (transData["balance"] != null) { VenmoHelper.currentAuth.currentUser.balance = double.Parse(transData["balance"].ToString()); } else { VenmoHelper.currentAuth.currentUser.balance = -1; } VenmoTransaction transaction = JsonConvert.DeserializeObject<VenmoTransaction>(transData["payment"].ToString()); return transaction; }
public override Boolean PurchaseProduct(USER_TYPE userType, string name, int quantity) { productData.PurchaseProduct(name, quantity); return(true); }
public override bool AddProduct(USER_TYPE userType, string name, double price, int quantity) { return(true); }
private void Clear() { userType = USER_TYPE.ACTIVE_USER; dummyTime = 0f; }