protected void btnSabtEditkartabl_Click(object sender, EventArgs e) { Karmand stu = new Karmand(); SchoolDBEntities db = new SchoolDBEntities(); Karmand stuu = db.Karmands.Where(p => p.UserName == "karim").Single(); stu.EID = lblID.InnerText.ToInt(); stu.FirstName = stuu.FirstName; stu.LastName = stuu.LastName; stu.PersonalCode = lblPersonalCode.InnerText; stu.UserName = stuu.UserName; stu.UserPass = stuu.UserPass; stu.BirthDate = string.Format("{0}{1}{2}", tbxBirthYear.Value, stuu.BirthDate.Substring(4, 2), stuu.BirthDate.Substring(6, 2)); stu.PhoneNumber = tbxFixTel.Value; stu.Mobile = tbxMobile.Value; stu.Email = tbxEmail.Value; KarmandRepository sr = new KarmandRepository(); sr.SaveEmployees(stu); Response.Redirect("http://localhost:4911/Dashboard/Admin/Kartabl.aspx"); }
protected void btnSearch_Click(object sender, EventArgs e) { if (tbxSearch.Value != "") { KarmandRepository sr = new KarmandRepository(); gvEmployees.DataSource = sr.FindByFullName(tbxSearch.Value, tbxFamilySearch.Value); gvEmployees.DataBind(); } }
public void LoadEmployees() { KarmandRepository sr = new KarmandRepository(); gvEmployees.DataSource = sr.GetAllEmployees(); gvEmployees.DataBind(); Karmand st = new Karmand(); tbxSearch.Value = ""; }
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 = "/Dashboard/Images/" + FileName; KarmandRepository sr = new KarmandRepository(); SchoolDBEntities db = new SchoolDBEntities(); Karmand stuu = db.Karmands.Where(p => p.UserName == "moosa").Single(); stuu.Image = "/Dashboard/Images/" + strname; db.SaveChanges(); } else { } }
protected void gvEmployees_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 = gvEmployees.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 = gvEmployees.Rows[index]; // KarmandRepository rep = new KarmandRepository(); //rep.DeleteEmployee(row.Cells[0].Text); SchoolDBEntities db = new SchoolDBEntities(); Karmand k = new Karmand(); string a = row.Cells[0].Text; k = db.Karmands.Where(p => p.PersonalCode == a).Single(); db.Karmands.Remove(k); db.SaveChanges(); LoadEmployees(); } }
public void LoadDrpDList() { LessonsRepository LR = new LessonsRepository(); KarmandRepository KR = new KarmandRepository(); vLessonGroupRepository vLR = new vLessonGroupRepository(); ddGrade.Items.Add("مقطع"); ddGrade.Items[0].Value = "0"; ddGrade.Items.Add("اول"); ddGrade.Items[1].Value = "1"; ddGrade.Items.Add("دوم"); ddGrade.Items[2].Value = "2"; ddGrade.Items.Add("سوم"); ddGrade.Items[3].Value = "3"; ddGrade.Items.Add("چهارم"); ddGrade.Items[4].Value = "4"; ddGrade.Items.Add("پنجم"); ddGrade.Items[5].Value = "5"; ddGrade.Items.Add("ششم"); ddGrade.Items[6].Value = "6"; ddGrade.Items.Add("هفتم"); ddGrade.Items[7].Value = "7"; ddGrade.Items.Add("هشتم"); ddGrade.Items[8].Value = "8"; ddGrade.Items.Add("نهم"); ddGrade.Items[9].Value = "9"; ddGrade.Items.Add("دهم"); ddGrade.Items[10].Value = "10"; ddGrade.Items.Add("یازدهم"); ddGrade.Items[11].Value = "11"; ddGrade.Items.Add("دوازدهم"); ddGrade.Items[12].Value = "12"; ///////////// Field.Items.Add("رشته تحصیلی"); Field.Items[0].Value = "0"; Field.Items.Add("ریاضی"); Field.Items[1].Value = "1"; Field.Items.Add("تجربی"); Field.Items[2].Value = "2"; Field.Items.Add("انسانی"); Field.Items[3].Value = "3"; /////////////// Day.Items.Add("روز"); Day.Items[0].Value = "0"; Day.Items.Add("شنبه"); Day.Items[1].Value = "1"; Day.Items.Add("یکشنبه"); Day.Items[2].Value = "2"; Day.Items.Add("دوشنبه"); Day.Items[3].Value = "3"; Day.Items.Add("سه شنبه"); Day.Items[4].Value = "4"; Day.Items.Add("چهار شنبه"); Day.Items[5].Value = "5"; Day.Items.Add("پنج شنبه"); Day.Items[6].Value = "6"; //////////////////////// Class.Items.Add("شماره کلاس"); Class.Items[0].Value = "0"; Class.Items.Add("101"); Class.Items[1].Value = "101"; Class.Items.Add("102"); Class.Items[2].Value = "102"; Class.Items.Add("103"); Class.Items[3].Value = "103"; Class.Items.Add("201"); Class.Items[4].Value = "201"; Class.Items.Add("202"); Class.Items[5].Value = "202"; Class.Items.Add("203"); Class.Items[6].Value = "203"; ///////////////////////////////// Time.Items.Add("ساعت"); Time.Items[0].Value = "0"; Time.Items.Add("ساعت اول"); Time.Items[1].Value = "1"; Time.Items.Add("ساعت دوم"); Time.Items[2].Value = "2"; Time.Items.Add("ساعت سوم"); Time.Items[3].Value = "3"; Time.Items.Add("ساعت چهارم"); Time.Items[4].Value = "4"; //////////////////////// List <Lesson> lessonList = LR.GetListOfAllLessons(); LessonDrpDList.Items.Add("نام درس"); LessonDrpDList.Items[0].Value = "0"; for (int i = 1; i <= lessonList.Count; i++) { LessonDrpDList.Items.Add(lessonList[i - 1].LessonTitle); LessonDrpDList.Items[i].Value = lessonList[i - 1].LessonID.ToString(); } //////////////////////////// List <Karmand> teacherList = KR.GetListOfAllEmployees(); Teacher.Items.Add("نام مدرس"); Teacher.Items[0].Value = "0"; for (int i = 1; i <= teacherList.Count; i++) { Teacher.Items.Add(teacherList[i - 1].FirstName + " " + teacherList[i - 1].LastName); Teacher.Items[i].Value = teacherList[i - 1].PersonalCode.ToString(); } ////////////////////// List <string> yearsList = vLR.GetlistOfAllYears(); Year.Items.Add("سال تحصیلی"); Year.Items[0].Value = "0"; }