public string Add(JObject pagerParas) { var id = HttpContext.Current.Request.QueryString["id"]; //var form = HttpContext.Current.Request.Form; StudentBLL studentBLL = new StudentBLL(); if (id != null && Int32.Parse(id) > 0) { studentBLL.Updata(pagerParas, Int32.Parse(id)); } else { try { pagerParas.Remove("ID"); } catch (Exception ex) { } studentBLL.Add(pagerParas); } return("1"); }
protected void Zhuce_Click(object sender, EventArgs e) { Student stu = new Student(); if (!HeFaXingJianCe()) { HeFa.Text = "该ID非法"; return; } setInFor(stu); Admin a = new Admin(); a.Id = Xuehao.Text; a.Password = "******"; a.Privilege = 0; AdminBLL.Add(a); bool bo = StudentBLL.Add(stu); SystemLog sl = new SystemLog(System.Environment.UserName, "AddStudent", "successed", Page.Request.UserHostAddress); BLLSaveLog.AddSL(sl); if (stu.Main) { YiChang.Text = "赋值成功"; } else { YiChang.Text = bo.ToString(); } //YiChang.Text = bo.ToString(); Response.Redirect("StuInforShow.aspx?id=" + stu.Id); }
public JObject Edit(JObject pagerParas) { StudentBLL studentBLL = new StudentBLL(); studentBLL.Add(pagerParas); return(new JObject()); }
protected void New_Click(object sender, EventArgs e) { Student stu = new Student(); if (!HeFaXingJianCe()) { HeFa.Text = " 该学号已存在!"; } setInFor(stu); Admin a = new Admin(); a.Id = Xuehao.Text; a.Password = "******"; a.Privilege = 0; AdminBLL.Add(a); bool bo = StudentBLL.Add(stu); if (stu.Main) { Jianche.Text = "录入成功"; } else { Jianche.Text = bo.ToString(); } }
public ActionResult Edit(Student student) { if (student.Id != 0) { student.Login.Id = student.Id; _studentBLL.Update(student); TempData["ResultMessage"] = "Yaptığınız Değişiklikler Başarıyla Gerçekleşmiştir."; } else { int id = 2; List <Student> studentList = _studentBLL.GetAll(); if (studentList.Count != 0) { id = studentList[studentList.Count - 1].Id + 2; } student.Id = id; student.IsOnline = false; student.EducationGrouoStatus = false; student.Status = true; student.DateOfRegistration = DateTime.Now.Date; student.Login.Id = student.Id; if (_studentBLL.Add(student)) { if (MailHelper.SentMail(student.Login.Mail, "Sisteme Kaydınız ile İlgili", string.Format("Merhaba : {0} {1}\n\n Sisteme giriş bilgileriniz aşağıda verilmiştir. \n\n\n\nKullanıcı Adınız : {2}\nParolanız :{3} \n\nGiriş bilgilerinizi kimseyle paylaşmayınız", student.FirstName, student.LastName, student.Login.UserName, student.Login.Password))) { TempData["ResultMessage"] = "Kaydetme İşleminiz Başarıyla Gerçekleşmiştir."; } } } return(RedirectToAction("Index")); }
public JsonResult Add(Student entity = null) { if (entity == null) { return(Json("参数为空")); } return(Json(bll.Add(entity))); }
public JsonResult Add(Student entity = null) { if (entity == null) { throw new ArgumentNullException(); } return(Json(bll.Add(entity))); }
public ActionResult Add(DAL.Student std) { var Result = _Bll.Add(std); return(View(std)); }
private void btnAdd_Click(object sender, EventArgs e) { bll.Add(new Student(txtName.Text, txtAddress.Text)); Load(); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { List <string> errors = new List <string>(); if (string.IsNullOrEmpty(txtFirstName.Text)) { errors.Add("First Name is required."); } ; if (string.IsNullOrEmpty(txtLastName.Text)) { errors.Add("Last Name is required."); } ; if (string.IsNullOrEmpty(txtLastName.Text)) { errors.Add("Email Address is required."); } ; if (string.IsNullOrEmpty(txtDepartmentName.Text)) { errors.Add("Department Name is required."); } ; if (string.IsNullOrEmpty(txtContactNumber.Text)) { errors.Add("Contact Number is required."); } ; if (cboGender.SelectedValue == null) { errors.Add("Please select a Gender."); } if (errors.Count > 0) { foreach (var error in errors) { txtbErrors.Text = txtbErrors.Text + error + "\n"; } return; } Gender gender = Gender.Male; if (cboGender.SelectedValue.ToString().ToLower() == "Female") { gender = Gender.Female; } var op = StudentBLL.Add(new Student() { Id = Guid.NewGuid(), FirstName = txtFirstName.Text, LastName = txtLastName.Text, EmailAddress = txtEmailAddress.Text, DepartmentName = txtDepartmentName.Text, ContactNumber = txtContactNumber.Text, Gender = gender }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Employee is successfully added to table"); } myParentWindow.showData(); this.Close(); }