/// <summary> /// Handles the Click event of the LinkButtonAddNew control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void LinkButtonAddNew_Click(object sender, EventArgs e) { //create a new role BusinessObjects.Role role = new BusinessObjects.Role(TextBoxRoleName.Text); bool show; try { //save the role SecurityController.CreateRole(role); //refresh the screen //Response.Redirect(Request.Path, true); GridView1.DataBind(); TextBoxRoleName.Text = ""; LiteralRoleName.Text = role.Name; GridViewUsers.DataBind(); show = true; } catch (Exception ex) { //handle error if (ExceptionPolicy.HandleException(ex, "User Interface")) { DisplayMessage(ex); } show = false; } ShowUserGrid(show); }
//Funció carregar grid usuaris private void CarregarGridUsuaris() { usuaris = ORM.retornarUsuaris(); GridViewUsers.DataSource = usuaris; GridViewUsers.DataBind(); }
private void gridViewUsers_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (!GridViewUsers.IsFilterRow(e.RowHandle)) { modified = true; } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (UsersBindingSource.Current == null) { return; } GridViewUsers.CloseEditor(); if (XtraMessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { ignoreLeaveRow = true; RemoveRecord(); errorProvider1.Clear(); if (!newRec) { context.SaveChanges(); } ignoreLeaveRow = false; modified = false; newRec = false; setReadOnly(true); panelControlStatus.Visible = true; LabelStatus.Text = "Record Deleted"; rowStatusDelete = new Timer(); rowStatusDelete.Interval = 3000; rowStatusDelete.Start(); rowStatusDelete.Tick += new EventHandler(TimedEventDelete); } currentVal = TextEditUser.Text; }
private void ExtranetSecurityForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && GridViewUsers.IsFilterRow(GridViewUsers.FocusedRowHandle)) { executeQuery(); } }
public void BindUserGrid() { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = objUserBLL.Get_UserList_Search(txtfilter.Text != "" ? txtfilter.Text : null , UDFLib.ConvertIntegerToNull(ddlCompanyFilter.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlDepartmentFilter.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlManagerFilter.SelectedValue), null, UDFLib.ConvertStringToNull(ddlUserTypeFilter.SelectedValue), null, sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { GridViewUsers.DataSource = dt; GridViewUsers.DataBind(); } else { GridViewUsers.DataSource = dt; GridViewUsers.DataBind(); } }
private void executeQuery() { this.Cursor = Cursors.WaitCursor; string colName = GridViewUsers.FocusedColumn.FieldName; string value = String.Empty; //if (!string.IsNullOrWhiteSpace(GridViewUsers.GetFocusedDisplayText())) value = GridViewUsers.GetFocusedDisplayText(); //if (!string.IsNullOrWhiteSpace(value)) //{ string query = String.Format("it.UserID like '{0}%'", GridViewUsers.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "UserID")); var results = context.ExtranetUser.Where(query); int count = results.Count(); if (count > 0) { UsersBindingSource.DataSource = results; GridViewUsers.SetRowCellValue(GridControl.AutoFilterRowHandle, colName, value); GridViewUsers.FocusedRowHandle = 0; GridViewUsers.FocusedColumn.FieldName = colName; } else { XtraMessageBox.Show("No records in database."); GridViewUsers.ClearColumnsFilter(); } //} this.Cursor = Cursors.Default; }
private void BtnDelete_Click(object sender, EventArgs e) { userId = Convert.ToInt32(GridViewUsers.GetFocusedRowCellValue("UserId")); // 4 2 : สิทธิ์ใช้งานหน้าผู้ใช้งาน ลบข้อมูลผู้ใช้งาน int AuthorizeId = 4; if (SQLAuthorized.CheckAuthorized(ClassProperty.permisRoleId, AuthorizeId) == false) { SQLAuthorized.AlertAuthorized("สิทธิ์ใช้งานหน้าผู้ใช้งาน", "ไม่มีสิทธิ์ลบข้อมูลผู้ใช้งาน"); return; } if (CheckData(userId) == true) { if (XtraMessageBox.Show(" คุณยืนยันที่จะลบข้อมูล ใช่หรือไม่?", "ยืนยัน", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (UpdateData(false) == true) { XtraMessageBox.Show("ลบข้อมูลสำเร็จ", "สถานะ", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearValues(); GetGridData(""); } } } }
protected void Page_Load(object sender, EventArgs e) { Session.Timeout = 15; if (Session["UserSession"] == null) { Response.Redirect("~/AdminPanel/AdminLogin.aspx"); } else if (Session["Admin"] == null) { Response.Redirect("~/AdminPanel/AdminLogin.aspx"); } try { string ConnectionString = WebConfigurationManager.ConnectionStrings["YahooCon"].ConnectionString; MySqlConnection viewTemplate = new MySqlConnection(ConnectionString);//explisionremoteEntities{0}", Request.QueryString["ID"]); string query = String.Format("SELECT UsersID, Username, Email FROM Users"); using (MySqlDataAdapter viewTemplateSet = new MySqlDataAdapter(query, viewTemplate)) { DataSet viewDSet = new DataSet(); viewTemplateSet.Fill(viewDSet); GridViewUsers.DataSource = viewDSet; GridViewUsers.DataBind(); //UserName.Text = viewDSet.Tables[0].Rows[0]["Username"].ToString(); } } catch (Exception ex) { Response.Write("<br>Error: <br>" + ex.Message); } }
private void BindGridView() { try { if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "Select idUser,username,password,name,idLab,idPRofile from Users;"; SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); GridViewUsers.DataSource = ds; GridViewUsers.DataBind(); lbltotalcount.Text = GridViewUsers.Rows.Count.ToString(); } catch (SqlException ex) { showMessage(ex.Message); } finally { conn.Close(); } }
public void FillGrid() { List = DataHelper.GetAllUsers(); GridViewUsers.DataSource = List; GridViewUsers.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { HttpCookie LoginCookie = Request.Cookies.Get("Credentials"); string currentUserEmail = LoginCookie["CurrentUserEmail"].ToString(); string SessionloginEmail = string.Empty; SessionloginEmail = Convert.ToString(Session["UserCurrentEmail"]); if (SessionloginEmail != currentUserEmail) { Response.Redirect("login.aspx"); } SqlConnection conn = new SqlConnection("Server=.;" + "Database= safeMeDb;" + "Integrated Security= true;"); conn.Open(); using (conn) { SqlCommand cmd = new SqlCommand("Select fullName, country from memberRegistration", conn); SqlDataReader reader = cmd.ExecuteReader(); GridViewUsers.DataSource = reader; GridViewUsers.DataBind(); //SqlDataReader reader = cmd.ExecuteReader(); //reader.Read(); //TextBoxFullName.Text = reader[1].ToString(); //TextBoxCountry1.Text = reader[2].ToString(); //TextBoxPhone.Text = reader[3].ToString(); //TextBoxEmail.Text = reader[4].ToString(); //TextBoxPassword.Text = reader[5].ToString(); } //Response.Redirect("home.aspx"); }
private void RefreshData() { var data = imsdb.UserAccounts.OrderByDescending(d => d.Id).ToList(); GridViewUsers.DataSource = data; GridViewUsers.DataBind(); }
//Paginació de la grid protected void GridViewUsers_PageIndexChanging(object sender, GridViewPageEventArgs e) { int tst = e.NewPageIndex; GridViewUsers.PageIndex = e.NewPageIndex; GridViewUsers.DataSource = usuaris; GridViewUsers.DataBind(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Show Users") { LiteralRoleName.Text = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString(); GridViewUsers.DataBind(); } }
private void setValues() { GridViewUsers.SetFocusedRowCellValue("UserID", string.Empty); GridViewUsers.SetFocusedRowCellValue("Password", string.Empty); GridViewUsers.SetFocusedRowCellValue("ReadOnly", false); GridViewUsers.SetFocusedRowCellValue("Inactive", false); GridViewUsers.SetFocusedRowCellValue("IsAgent", false); }
protected void UpdatePanel1_Load(object sender, EventArgs e) { //Populate Users grid User user = new User(); DataTable dataTable = user.ToDataTable(user.GetAllUsers()); GridViewUsers.DataSource = dataTable; GridViewUsers.DataBind(); }
protected void Cerrar_Click(object sender, EventArgs e) { GridViewUsers.Visible = true; UserDetailsView.Visible = false; Cerrar.Visible = false; Servicios.Visible = false; GridServicios.Visible = false; GridViewUsers.DataBind(); }
private void LoadUser() { List <CTUserInfo> userList = new List <CTUserInfo>(); PetCare.BLL.User user = new User(); userList = user.GetAllUserList(); GridViewUsers.DataSource = userList; GridViewUsers.DataKeyNames = new string[] { "UserID" }; GridViewUsers.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { strSQLSelectUser = "******"; command = new SqlCommand(strSQLSelectUser, connection, transaction); sqlDataAdapter = new SqlDataAdapter(command); sqlDataAdapter.Fill(dataSet); GridViewUsers.DataSource = dataSet; GridViewUsers.DataBind(); }
protected void BtnSearch_Click(object sender, EventArgs e) { string userID = TextBox1.Text.Trim().ToString(); List <CTUserInfo> userList = new List <CTUserInfo>(); PetCare.BLL.User user = new User(); userList = user.GetUserInfoByUserID(userID); GridViewUsers.DataSource = userList; GridViewUsers.DataBind(); }
protected void BtnUserSearch_Click(object sender, EventArgs e) { TestorCoreUser[] users = UserSearchHelper.FindUsers(userName.Text, TestorUserRole.NotDefined, TestorUserStatus.Any, 0, false); GridViewUsers.EmptyDataText = String.Format("Поиск: <b>{0}*</b>. Пользователи не найдены.", userName.Text); GridViewUsers.DataKeyNames = new string[] { "UserId" }; GridViewUsers.DataSource = users; GridViewUsers.DataBind(); GridViewUsers_SelectedIndexChanged(sender, e); }
//method to load data into a gridview !!****being used for testing purposes****!! void loadData() { string CS = ConfigurationManager.ConnectionStrings["myDB"].ConnectionString; using (SqlConnection conn = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("SELECT * FROM [dbo].[Register]", conn); conn.Open(); GridViewUsers.DataSource = cmd.ExecuteReader(); GridViewUsers.DataBind(); } }
void GV_Bind() { DataView dv; dv = (DataView)SqlDataSourceUsers.Select(DataSourceSelectArguments.Empty); if (dv.Count > 0) { dv.RowFilter = "UserTypeCode='" + RadioButtonList1.SelectedValue + "'"; GridViewUsers.DataSource = dv; GridViewUsers.DataBind(); } }
protected void BtnUserSearch_Click(object sender, EventArgs e) { TestorCoreUser[] users = UserSearchHelper.FindAllLocalStudents(userName.Text); GridViewUsers.EmptyDataText = String.Format("Поиск: <b>{0}*</b>. Пользователи не найдены.", userName.Text); GridViewUsers.DataKeyNames = new string[] { "UserId" }; GridViewUsers.DataSource = users; GridViewUsers.DataBind(); if (users.Count() == 1) { GridViewUsers.SelectedIndex = 0; GridViewUsers_SelectedIndexChanged(sender, e); } }
protected void BtnConsultar_Click(object sender, EventArgs e) { DateTime Fecha1 = Convert.ToDateTime(TxtFechaInicio.Text); DateTime Fecha2 = Convert.ToDateTime(TxtFechaFinal.Text); GridViewUsers.DataSource = logusers.ListUserDate(Fecha1, Fecha2); GridViewUsers.DataBind(); User userAux = (User)Session["CurrentUser"]; ReferenceWSUser.IwcfUsersClient aux = new ReferenceWSUser.IwcfUsersClient(); aux.InsertUserLog(userAux.UserID, 2, "El usuario a consultado la lista usuarios por fecha", DateTime.Now); aux.Close(); }
protected void Page_Load(object sender, EventArgs e) { User user = new User(); user = (User)Session["CurrentUser"]; if (user.RoleID != 1) { Response.Redirect("404.aspx"); } if (!Page.IsPostBack) { GridViewUsers.DataSource = logusers.ListUser(); GridViewUsers.DataBind(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { if (modified || newRec) { DialogResult select = DevExpress.XtraEditors.XtraMessageBox.Show("Do you want to confirm these changes?", Text, MessageBoxButtons.YesNoCancel); if (select == DialogResult.Cancel) { return; } if (select == DialogResult.Yes) { if (!SaveRecord()) { return; } } if (select == DialogResult.No) { if (newRec) { RemoveRecord(); } else { RefreshRecord(); } } } GridViewUsers.ClearColumnsFilter(); if (UsersBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source UsersBindingSource.DataSource = from opt in context.ExtranetUser where opt.UserID == "KJM9" select opt; } CheckEditAgent.Focus(); GridViewUsers.CloseEditor(); newRec = true; ignoreLeaveRow = true; //so that when the grid row changes it doesn't try to save again UsersBindingSource.AddNew(); if (GridViewUsers.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewUsers.FocusedRowHandle = GridViewUsers.RowCount - 1; } CheckEditAgent.Focus(); setReadOnly(false); ignoreLeaveRow = false; }
private void BindData() { SqlConnection con = new SqlConnection(strConnString); SqlCommand cmd = new SqlCommand("sp_get_cart_details_by_user_id", con); string userID = HttpContext.Current.User.Identity.Name; cmd.Parameters.Add("@user_id", SqlDbType.VarChar).Value = userID; cmd.CommandType = CommandType.StoredProcedure; cart = GetData(cmd); GridViewUsers.DataSource = cart; GridViewUsers.DataBind(); calculateTotal(); }
public void GetAllUsers() { string getAllUsersList = "Select * FROM Employee ORDER BY EMP_ID DESC "; dt = new DataTable(); dt = dbClass.ConnectDataBaseReturnDT(getAllUsersList); if (dt.Rows.Count > 0) { GridViewUsers.DataSource = dt; GridViewUsers.DataBind(); } else { GridViewUsers.DataSource = null; GridViewUsers.DataBind(); } }