private void frmClient_Load(object sender, EventArgs e) { agent = new clsAgent(); admin = new clsAdmin(); if (permission == 2) { List <clsClient> temp = new List <clsClient>(); temp.Add(agent.Searched_Cleint_For_This_Agent(refagent)); gridAll.DataSource = temp; } else { gridAll.DataSource = admin.All_Client(); } gridAll.ReadOnly = true; ButtonControl(true, false, false, false, true, false); string[] status = { "Seller", "Buyer", "Inactive(Buyer)", "Inactive(Seller)" }; List <string> refhouses = new List <string>(); refhouses.Add("0"); foreach (clsHouse i in admin.Search_All_Houses()) { refhouses.Add(i.RefHouse.ToString()); } cboRefHouse.DataSource = refhouses; cboStatus.DataSource = status; }
private void gridAll_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!txtAddress.Enabled) { ButtonControl(true, true, false, false, true, false); string houseid = gridAll.Rows[e.RowIndex].Cells[0].Value.ToString(); clsAdmin admin = new clsAdmin(); clsHouse house = new clsHouse(); house = admin.Searched_by_RefHouse(Convert.ToInt32(houseid)); txtAddress.Text = house.Address; txtArea.Text = house.Area.ToString(); txtBath.Text = house.NumBath.ToString(); txtFloor.Text = house.Floor.ToString(); txtPrice.Text = house.Price.ToString(); txtRoom.Text = house.NumRoom.ToString(); if (house.Accessible) { cboAccess.SelectedItem = "Yes"; } else { cboAccess.SelectedItem = "No"; } cboStatus.Text = house.Status; } }
protected void save_Command(Object sender, CommandEventArgs e) { var userId = Request["userid"]; if (userId.HasNoText()) { message.MessageText = "Provide User ID to save user note."; message.MessageClass = MessageClassesEnum.System; } else { try { var result = new clsAdmin().SaveUserNote(userId, textareaNote.Value); if (result > 0) { message.MessageText = "Note has been saved successfully!"; message.MessageClass = MessageClassesEnum.Ok; } else { message.MessageText = "Note has not been saved! Possible reason: User ID (" + userId + ") was not found."; message.MessageClass = MessageClassesEnum.System; } } catch (Exception ex) { message.MessageText = ex.Message; message.MessageClass = MessageClassesEnum.Error; } } message.RedirectToShowMessage(); }
protected void btnChangePassword_Click(object sender, EventArgs e) { if (txtNewPassword.Text != "" && txtConfirmPassword.Text != "") { if (txtNewPassword.Text == txtConfirmPassword.Text) { DataSet ds = new DataSet(); clsAdmin objAdmin = new clsAdmin(); objAdmin.Action = "CHANGEPWD"; objAdmin.AdminId = Convert.ToInt32(Session["AdminId"]); objAdmin.Password = txtConfirmPassword.Text; ds = objAdmin.fnAdmin(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { divAlert.Visible = true; divAlert.InnerHtml = ds.Tables[0].Rows[0]["MSG"].ToString(); } } else { divAlert.Visible = true; divAlert.InnerHtml = "Password Mismatched"; } } else { divAlert.Visible = true; divAlert.InnerHtml = "Enter all fields"; } }
private void frmSales_Load(object sender, EventArgs e) { admin = new clsAdmin(); DataTable temp = new DataTable(); // fill cboHouse cboHouse.DisplayMember = "Address"; cboHouse.ValueMember = "RefHouse"; cboHouse.DataSource = admin.HouseListToDataTable(admin.Search_All_Houses()); // fill cboClient cboClient.DisplayMember = "ClientName"; cboClient.ValueMember = "RefClient"; cboClient.DataSource = admin.ClientListToDataTable(admin.All_Client()); // fill cboAgent cboAgent.DisplayMember = "AgentName"; cboAgent.ValueMember = "RefAgent"; cboAgent.DataSource = admin.AgentListToDataTable(admin.Search_All_Agents()); if (permission != 2) { gridAll.DataSource = admin.All_Sales(); } else { gridAll.DataSource = admin.Search_Sales_Belong_To_RefAgent(RefAgent); } gridAll.ReadOnly = true; ButtonControl(true, false, false, false, true, false); }
private void frmAdminAgent_Load(object sender, EventArgs e) { admin = new clsAdmin(); gridAll.DataSource = admin.Search_All_Agents(); gridAll.ReadOnly = true; ButtonControl(true, false, false, false, true, false); }
private void btnSave_Click(object sender, EventArgs e) { if (validateData.isNameValid(txtName) && validateData.isEmailValid(txtEmail) && validateData.isPhoneNumberValid(txtPhone)) { //string adminId = updatemode == false ? "ad" + (latestAdminId + 1).ToString() : txtId.Text; clsAdmin newAdmin = new clsAdmin(txtId.Text, txtName.Text, txtEmail.Text, txtPhone.Text, txtPassword.Text); if (updatemode) { if (clsAdminData.updateAdmin(newAdmin)) { MessageBox.Show("successfully updated admin : " + txtName.Text + " in the system!"); ReloadForm(); } } else { if (clsAdminData.AddAdmin(newAdmin)) { MessageBox.Show("successfully added admin : " + txtName.Text + " in the system!"); latestAdminId += 1; ReloadForm(); } else { MessageBox.Show("the admin with the email: " + txtEmail.Text + " exist in the system!"); txtEmail.Focus(); } } } }
protected void btnLogin_Click(object sender, EventArgs e) { if (txtUserName.Text != "" && txtPassword.Text != "") { DataSet ds = new DataSet(); clsAdmin objAdmin = new clsAdmin(); objAdmin.Action = "LOGIN"; objAdmin.UserName = txtUserName.Text; objAdmin.Password = txtPassword.Text; ds = objAdmin.fnAdmin(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { Session["AdminName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["IsSuperAdmin"] = ds.Tables[0].Rows[0]["IsSuperAdmin"].ToString(); Session["AdminId"] = ds.Tables[0].Rows[0]["AdminId"].ToString(); Response.Redirect("Panel/Dashboard.aspx", false); } else { //invalid user ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Invalid username or password')", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Enter username and password')", true); } //Response.Redirect("Panel/Dashboard.aspx", false); }
public void InstanceOK() { //create an instance of the class clsAdmin AAdmin = new clsAdmin(); //test to see that it exists Assert.IsNotNull(AAdmin); }
private void btnSave_Click(object sender, EventArgs e) { clsAdmin admin = new clsAdmin(); clsHouse house = new clsHouse(); house.Address = txtAddress.Text; house.Area = Convert.ToInt32(txtArea.Text); house.Price = Convert.ToDecimal(txtPrice.Text); house.Floor = Convert.ToInt32(txtFloor.Text); house.NumRoom = Convert.ToInt32(txtRoom.Text); house.NumBath = Convert.ToInt32(txtBath.Text); if (cboAccess.SelectedItem.ToString() == "Yes") { house.Accessible = true; } else { house.Accessible = false; } house.Status = cboStatus.Text; if (Addmode) { if (admin.Add_New_House(house)) { MessageBox.Show("New House on the Address : " + house.Address + " is successfully added", "New House Added"); } else { MessageBox.Show("The house of the Address " + house.Address + " is not added.", "Try Again"); } admin.Refresh_Database(); } else { house.RefHouse = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (admin.Edit_House(house)) { MessageBox.Show("House ID " + house.RefHouse + " is successfully modified", "House Modified"); } else { MessageBox.Show("House ID : " + house.RefHouse + " is not modified.", "Try Again"); } } if (permission != 2) { gridAll.DataSource = admin.Search_All_Houses(); } else { gridAll.DataSource = current.Searched_House_Belong_to_Current_Agent(RefAgent); } ButtonControl(true, true, false, false, true, false); }
public static bool AddAdmin(clsAdmin newAdminData) { if (!Exist(newAdminData.Email)) { adminData.Add(newAdminData.Email, newAdminData); return(true); } return(false); }
public static bool updateAdmin(clsAdmin newAdminData) { if (Exist(newAdminData.Email)) { adminData[newAdminData.Email] = newAdminData; return(true); } return(false); }
public clsAdminData() { adminData = new Dictionary <string, clsAdmin>(); clsAdmin admin1 = new clsAdmin("ad01", "Rahul", "*****@*****.**", "1111111111", "12345"); clsAdmin admin2 = new clsAdmin("ad02", "John", "*****@*****.**", "2222222222", "12345"); clsAdmin admin3 = new clsAdmin("ad03", "Steve", "*****@*****.**", "3333333333", "12345"); adminData.Add("*****@*****.**", admin1); adminData.Add("12345", admin2); adminData.Add("123", admin3); }
private void frmSearchAgent_Load(object sender, EventArgs e) { admin = new clsAdmin(); admin.Refresh_Database(); agent_list = new List <clsAgent>(); agent_list = admin.Search_All_Agents(); gridAll.DataSource = agent_list; // fill cboRefClient cboRefClient.DisplayMember = "RefClient"; cboRefClient.DataSource = admin.All_Client(); }
public void AdminEmailPropertyOK() { //create an instance of the class clsAdmin AAdmin = new clsAdmin(); //create some test data to test against the property string TestData = "AdminEmail"; //assign the data to the property AAdmin.AdminEmail = TestData; //test to see that the two values are equal Assert.AreEqual(AAdmin.AdminEmail, TestData); }
public void BlogPropertyOK() { //create an instance of the class clsBooking ABooking = new clsBooking(); //create some test data to test against the property clsAdmin AAdmin = new clsAdmin(); //assign the data to thw property ABooking.Blog = AAdmin; //test to see that the two values are equal Assert.AreEqual(ABooking.Blog, AAdmin); }
public void AdminNoPropertyOK() { //create an instance of the class clsAdmin AAdmin = new clsAdmin(); //create some test data string TestData = "TestData"; //assign the data to the property AAdmin.AdminNo = TestData; //test to see the that the rwo values are the same Assert.AreEqual(AAdmin.AdminNo, TestData); }
private void gridAll_CellClick(object sender, DataGridViewCellEventArgs e) { if (!txtID.Enabled) { ButtonControl(true, true, false, false, true, false); string selecteduserid = gridAll.Rows[e.RowIndex].Cells[1].Value.ToString(); clsAdmin selecteduser = admin.Current_User(selecteduserid); txtID.Text = selecteduser.UserID; txtName.Text = selecteduser.Name; txtPhone.Text = selecteduser.PhoneNumber; } }
public void FirstNamePorpertyOK() //create an instance of the class we want to create { clsAdmin AAdmin = new clsAdmin(); //create some data to test this class against string FirstName = "FirstName"; //assign the data tothe property AAdmin.FirstName = FirstName; //test to see the values are the same Assert.AreEqual(AAdmin.FirstName, FirstName); }
public void ValidMethodOK() { //create an instance of the class we want to create clsAdmin AnAddress = new clsAdmin(); //string variable to store any error message String Error = ""; //invoke the method Error = AnAddress.Valid(AdminNo, AdminEmail, FirstName, LastName, Blog); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public static bool updateAdmin(clsAdmin newAdminData) { if (Exist(newAdminData.Email)) { int index = getIndexByEmail(newAdminData.Email); tabAdmin.Rows[index]["name"] = newAdminData.Name; tabAdmin.Rows[index]["email"] = newAdminData.Email; tabAdmin.Rows[index]["phone"] = newAdminData.Phone; tabAdmin.Rows[index]["password"] = newAdminData.Password; return(true); } return(false); }
public static bool AddAdmin(clsAdmin newAdminData) { if (!Exist(newAdminData.Email)) { DataRow myRow = tabAdmin.NewRow(); myRow["name"] = newAdminData.Name; myRow["email"] = newAdminData.Email; myRow["phone"] = newAdminData.Phone; myRow["password"] = newAdminData.Password; tabAdmin.Rows.Add(myRow); return(true); } return(false); }
static public clsAdmin CurrentAdminUser(string userid)// returning current user(admin) { clsAdmin temp = new clsAdmin(); DataRow[] cadmin = mySet.Tables["Admins"].Select("UserID = '" + userid + "'"); if (cadmin.Count() != 0) { temp.RefAdmin = (int)(cadmin[0]["RefAdmin"]); temp.Name = cadmin[0]["AdminName"].ToString(); temp.UserID = cadmin[0]["UserID"].ToString(); temp.PhoneNumber = cadmin[0]["PhoneNumber"].ToString(); } return(temp); }
private void btnChange_Click(object sender, EventArgs e) { clsAdmin admin = new clsAdmin(); if (admin.Change_Password(txtID.Text, txtOldPW.Text, txtNewPW.Text)) { MessageBox.Show("Password for UserID : " + userid + " is changed.", "Successful!"); this.Close(); } else { MessageBox.Show("Password for UserID : " + userid + " is not changed.", "Check your password again!"); } }
static public clsAdmin SearchAdmin_by_RefAdmin(int refadmin) { clsAdmin temp = new clsAdmin(); DataRow[] find = mySet.Tables["Admins"].Select("RefAdmin = " + refadmin); if (find.Count() != 0) { temp.RefAdmin = (int)(find[0]["RefAdmin"]); temp.Name = find[0]["AdminName"].ToString(); temp.UserID = find[0]["UserID"].ToString(); temp.PhoneNumber = find[0]["PhoneNumber"].ToString(); } return(temp); }
public void FindMethodOK() { //create an instance of the class we want to create clsAdmin AAdmin = new clsAdmin(); //boolean variable to store the result of the value Boolean Found = false; //create some test data to use with the emthod int AdminNo = 1; //invoke the method Found = AAdmin.Find(AdminNo); //test to see the result is correct Assert.IsTrue(Found); }
public void FirstNameInvalidData() { //create an instance of the class we want to create clsAdmin AAdmin = new clsAdmin(); //string variable to store any error message String Error = ""; //set the DateAdded to a non date value string AdminEmail = "this is not a first name"; //invoke the method Error = AAdmin.Valid(AdminNo, AdminEmail, FirstName, LastName, Blog); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void AdminEmailExtremeMax() { //create an instance of the class we want to create clsAdmin AAdmin = new clsAdmin(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string AdminEmail = "*****@*****.**"; //invoke method Error = AAdmin.Valid(AdminNo, AdminEmail, FirstName, LastName, Blog); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
protected void Page_Load(object sender, EventArgs e) { if (Convert.ToInt32(Session["type"]) != 1) { Response.Redirect("AdminLogin.aspx"); } else { clsAdmin Admindata = Connections.GetData((int)Session["id"]); LabelWelcome.Text = Admindata.FirstName + " " + Admindata.LastName; } //string pass = "******"; //Label1.Text = FormsAuthentication.HashPasswordForStoringInConfigFile(pass, "MD5"); }
public void FirstNameExtremeMax() { //create an instance of the class we want to create clsAdmin AAdmin = new clsAdmin(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string FirstName = ""; FirstName = FirstName.PadRight(50, 'a'); //invoke method Error = AAdmin.Valid(AdminNo, AdminEmail, FirstName, LastName, Blog); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }