protected void btnSearch_ServerClick(object sender, EventArgs e) { vStudentRepository v = new vStudentRepository(); gvStudents.DataSource = v.searchStudentsInfo(tbxSearch.Value); gvStudents.DataBind(); }
protected void btnSabtEditProfile_Click(object sender, EventArgs e) { Student stu = new Student(); SchoolDBEntities db = new SchoolDBEntities(); Student stuu = db.Students.Where(p => p.UserName == "javad").Single(); stu.StuID = lblStuID.InnerText.ToInt(); stu.FirstName = stuu.FirstName; stu.LastName = stuu.LastName; stu.SGarde = stuu.SGarde; stu.CGrade = stuu.CGrade; stu.UserName = stuu.UserName; stu.Password = stuu.Password; stu.FatherID = stuu.FatherID; stu.MotherID = stuu.MotherID; stu.RemainedSalary = stuu.RemainedSalary; stu.StudentCode = lblStudentCode.InnerText; stu.BirthDate = string.Format("{0}{1}{2}", tbxBirthYear.Value, stuu.BirthDate.Substring(4, 2), stuu.BirthDate.Substring(6, 2)); stu.NationalCode = stuu.NationalCode; stu.PhoneNumber = tbxFixTel.Value; stu.MobileNumber = tbxMobile.Value; stu.ZipCode = tbxZipCode.Value; stu.Email = tbxEmail.Value; stu.Address = tbxAddress.InnerText; stu.ParentUser = stuu.ParentUser; stu.ParentPass = stuu.ParentPass; vStudentRepository sr = new vStudentRepository(); sr.SaveStudent(stu); Response.Redirect("http://localhost:4911/Dashboard/Dashboard.aspx"); }
private void setGrid() { vStudentRepository v = new vStudentRepository(); gvStudents.DataSource = v.getStudentsInfo(); gvStudents.DataBind(); }
public void LoadStudents() { vStudentRepository sr = new vStudentRepository(); gvStudents.DataSource = sr.GetAllStudents(); gvStudents.DataBind(); vStudent st = new vStudent(); tbxSearch.Value = ""; }
protected void btnSearch_Click(object sender, EventArgs e) { if (tbxSearch.Value != "") { vStudentRepository sr = new vStudentRepository(); gvStudents.DataSource = sr.searchStudents(tbxSearch.Value); gvStudents.DataBind(); } }
protected void btnSearch_Click(object sender, EventArgs e) { if (tbxSearch.Value != "") { vStudentRepository sr = new vStudentRepository(); gvStudents.DataSource = sr.FindByFullName(tbxSearch.Value, tbxFamilySearch.Value); gvStudents.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) {//D:\Projects\SchoolSmartSystem\New folder\OnlineSchool\WebPages\Dashboard\Images\3408.jpg string strname = FileUpload1.FileName.ToString(); string FileName = System.IO.Path.GetFileName(FileUpload1.FileName); string path = Server.MapPath("/Dashboard/Images/") + FileName; FileUpload1.PostedFile.SaveAs(path); imgUserPic.Src = "Images/" + FileName; vStudentRepository sr = new vStudentRepository(); SchoolDBEntities db = new SchoolDBEntities(); Student stuu = db.Students.Where(p => p.UserName == "javad").Single(); stuu.Image = "Images/" + strname; db.SaveChanges(); } else { } }
protected void gvStudents_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { // Retrieve the row index stored in the // CommandArgument property. int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button // from the Rows collection. GridViewRow row = gvStudents.Rows[index]; Response.Redirect("http://*****:*****@"<script type='text/javascript'>"); sb.Append("$('#modalShowDetails').modal('show');"); sb.Append(@"</script>"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModalScript", sb.ToString(), false); } } if (e.CommandName == "Delet") { // Retrieve the row index stored in the // CommandArgument property. int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button // from the Rows collection. GridViewRow row = gvStudents.Rows[index]; vStudentRepository rep = new vStudentRepository(); SchoolDBEntities db = new SchoolDBEntities(); db.Students.Remove(rep.FindByStudentCode(row.Cells[0].Text)); } }