protected void GridViewUsers_RowUpdating(object sender, GridViewUpdateEventArgs e) {//הפונקציה מעדכמת את פרטי המשתמש try { Member = new UserDetail(); Member.UserId = int.Parse(GridViewUsers.Rows[e.RowIndex].Cells[0].Text); Member.UserName = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[1].Controls[0])).Text; Member.FirstName = GridViewUsers.Rows[e.RowIndex].Cells[2].Text; Member.LastName = GridViewUsers.Rows[e.RowIndex].Cells[3].Text; Member.State = ((DropDownList)(GridViewUsers.Rows[e.RowIndex].Cells[4].FindControl("DropDownListState"))).SelectedValue; Member.birthday = DateTime.Parse(((DropDownList)GridViewUsers.Rows[e.RowIndex].Cells[5].FindControl("DropDownListYear")).SelectedValue + "." + ((DropDownList)GridViewUsers.Rows[e.RowIndex].Cells[5].FindControl("DropDownListMonth")).SelectedValue + "." + ((DropDownList)GridViewUsers.Rows[e.RowIndex].Cells[5].FindControl("DropDownListDay")).SelectedValue); Member.Email = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[6].Controls[0])).Text; Member.Password = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[7].Controls[0])).Text; Member.KindUser = int.Parse(((DropDownList)(GridViewUsers.Rows[e.RowIndex].Cells[8].FindControl("DropDownListKindUser"))).SelectedValue); Member.Status = bool.Parse(((RadioButtonList)(GridViewUsers.Rows[e.RowIndex].Cells[9].FindControl("RadioButtonListStatus"))).SelectedValue); Member.DateAdd = DateTime.Parse(GridViewUsers.Rows[e.RowIndex].Cells[10].Text); //Member.CardID = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[11].Controls[0])).Text; //Member.dateCard = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[12].Controls[0])).Text; //Member.SecurityCode = ((TextBox)(GridViewUsers.Rows[e.RowIndex].Cells[13].Controls[0])).Text; Commands = new UserServies(); Commands.UpdateUserServer(Member); this.GridViewUsers.EditIndex = -1; popGird(); } catch (Exception err) { LabelErr.Text = err.Message; } }
protected void buttonShopProfileDetails_Click(object sender, EventArgs e) { if (this.buttonShopProfileDetails.Text != "Submit") { try { string pass = this.TextBoxPass.Text; string UserName = User.UserName; int num = UserCommand.IsUserValid(UserName, pass); if (num != null) { TableDEtails.Visible = true; TableDEtails.Enabled = true; TextBoxPass.Visible = false; LabelPass.Visible = false; this.buttonShopProfileDetails.Text = "Submit"; PopText(); } } catch (Exception Err) { LabelERR.Text = Err.Message; } } else { try { User.UserName = this.TextBoxUname.Text; User.State = this.DropDownListState.SelectedValue; User.FirstName = this.TextBoxFname.Text; User.Email = this.TextBoxmail.Text; User.Password = this.TextBoxPasst.Text; User.LastName = this.TextBoxLname.Text; UserCommand.UpdateUserServer(User); TableDEtails.Visible = false; TableDEtails.Enabled = false; TextBoxPass.Visible = true; this.buttonShopProfileDetails.Text = "ShowProfileDetail"; } catch (Exception Err) { LabelERR.Text = Err.Message; } } }