Пример #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            TestOnlineDataContext db = new TestOnlineDataContext();

            if (txtFullName.Text == "" || txtMail.Text == "" || txtPassword.Text == "" || txtPassword2.Text == "" || txtUsername.Text == "" || ddlCity.SelectedIndex == 0 || ddlDay.SelectedIndex == 0 || ddlMonth.SelectedIndex == 0 || ddlYear.SelectedIndex == 0)
            {
                lblThongBao.Text    = "Bạn chưa nhập đầy đủ thông tin";
                lblThongBao.Visible = true;
            }
            else
            {
                if (KtrEmail(txtMail.Text) == false)
                {
                    lblThongBao.Text    = "Email không đúng";
                    lblThongBao.Visible = true;
                }
                else
                {
                    if (txtPassword.Text.ToLower() != txtPassword2.Text.ToLower())
                    {
                        lblThongBao.Text    = "Mật khẩu không trùng nhau";
                        lblThongBao.Visible = true;
                    }
                    else
                    {
                        if (TestEmail() == false)
                        {
                            lblThongBao.Text    = "Email đã tồn tại";
                            lblThongBao.Visible = true;
                        }
                        else
                        {
                            if (TestCodeUserName() == false)
                            {
                                lblThongBao.Text    = "Tài khoản đã tồn tại";
                                lblThongBao.Visible = true;
                            }
                            else
                            {
                                tblStudent tbl = new tblStudent();
                                tbl.StudentID   = txtUsername.Text;
                                tbl.StudentName = txtFullName.Text;
                                string s = ddlDay.Text.Trim() + "/" + ddlMonth.Text.Trim() + "/" + ddlYear.Text.Trim();
                                tbl.Birthday = s;
                                tbl.City     = ddlCity.SelectedItem.Text;
                                tbl.Email    = txtMail.Text;
                                tbl.Password = txtPassword.Text;
                                db.tblStudents.InsertOnSubmit(tbl);
                                db.SubmitChanges();
                                Response.Redirect("ThanhCong.aspx");
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        public String PostStudent(tblStudent student)
        {
            sdb.tblStudents.Add(student);
            String data = "Insert Student Data on" + DateTime.Now.ToString();

            sdb.SaveChanges();
            File.AppendAllText(HttpContext.Current.Server.MapPath("~/Log.txt"), data + "\n");

            return("Data Added Successfully");
        }
Пример #3
0
 public ActionResult Edit([Bind(Include = "id,Name,Email,Phone")] tblStudent tblStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblStudent));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "STD_ID,STD_NAME,STD_ENROLL,STD_PWD")] tblStudent tblStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblStudent));
 }
Пример #5
0
 public ActionResult Delete(int id)
 {
     using (Entities db = new Entities())
     {
         tblStudent sm = db.tblStudents.Where(x => x.StudentId == id).FirstOrDefault();
         db.tblStudents.Remove(sm);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }
Пример #6
0
    public string UserRegistration(string DAID, int Gender, string UserName, string Password)
    {
        var DC  = new DataClassesDataContext();
        int cnt = (from obj in DC.tblPrograms
                   where obj.ProgramCode == DAID.Substring(4, 2)
                   select obj).Count();

        if (cnt > 0)
        {
            int cnt1 = (from obj in DC.tblDAIICTStudentDatas
                        where obj.StudentID == DAID
                        select obj).Count();
            if (cnt1 > 0)
            {
                int cnt2 = (from obj in DC.tblStudents
                            where obj.DAID == DAID
                            select obj).Count();
                if (cnt2 > 0)
                {
                    return("Already Exist");
                }
                else
                {
                    tblDAIICTStudentData Data = (from obj in DC.tblDAIICTStudentDatas
                                                 where obj.StudentID == DAID
                                                 select obj).SingleOrDefault();
                    tblStudent student = new tblStudent();
                    student.DAID      = Data.StudentID;
                    student.FirstName = Data.FirstName;
                    student.LastName  = Data.LastName;
                    student.EmailID   = Data.EmailID;
                    student.ContactNo = Data.ContactNo;
                    student.Gender    = Gender;
                    student.UserName  = UserName;
                    student.Password  = Encryptdata(Password);
                    student.IsVerify  = false;
                    student.IsBlocked = false;
                    student.CreatedOn = DateTime.Now;
                    student.LastLogin = DateTime.Now;
                    DC.tblStudents.InsertOnSubmit(student);
                    DC.SubmitChanges();
                    SendLink(Data.EmailID, "http://localhost:49818/Default.aspx", "user");
                    return("Available");
                }
            }
            else
            {
                return("Your Detail Not Available, Please Contact to Admin.");
            }
        }
        else
        {
            return("Invalied Progarm");
        }
    }
        public IHttpActionResult GettblStudent(string id)
        {
            tblStudent tblStudent = db.tblStudents.Find(id);

            if (tblStudent == null)
            {
                return(NotFound());
            }

            return(Ok(tblStudent));
        }
Пример #8
0
        public void WhenStudentSet_shouldFullNameNotNull()
        {
            tblStudent student = new tblStudent();

            Assert.IsNotNull(student);

            student.firstName = "Nick";
            student.lastName  = "Anderson";

            Assert.AreEqual("Nick Anderson", student.fullName);
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "STD_ID,STD_NAME,STD_ENROLL,STD_PWD")] tblStudent tblStudent)
        {
            if (ModelState.IsValid)
            {
                db.tblStudents.Add(tblStudent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblStudent));
        }
Пример #10
0
        //Constructor when editing student.
        public PeopleView(tblStudent student) : this()
        {
            //Send it to the view model.
            peopleViewModel  = new PeopleViewModel(student);
            this.DataContext = peopleViewModel;

            //Show the edit student controls.
            studentGrid.Visibility = Visibility.Visible;
            this.Title             = "Edit student :";
            labelHeader.Content    = "Editing student " + student.fullName;
        }
Пример #11
0
 /// <summary>
 /// Takes the course and student
 /// Then loops threw each student in the selected class
 /// returns true if the student already exists
 /// </summary>
 /// <param name="cours">The selected course from the dropdown list</param>
 /// <param name="student">The selected student from the dropdown list</param>
 /// <returns></returns>
 public bool checkIfExists(tblCours cours, tblStudent student)
 {
     foreach (var item in cours.tblStudents)
     {
         if (item.studentID == student.studentID)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #12
0
        public ActionResult Create([Bind(Include = "id,Name,Email,Phone")] tblStudent tblStudent)
        {
            if (ModelState.IsValid)
            {
                db.tblStudents.Add(tblStudent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblStudent));
        }
        public JsonResult GetStudentById(int StudentId)
        {
            tblStudent model = db.tblStudents.Where(x => x.StudentId == StudentId).SingleOrDefault();
            string     value = string.Empty;

            value = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
Пример #14
0
        public tblStudent UpdateStudentData(int sid, tblStudent s)
        {
            tblStudent sdata = sdb.tblStudents.Find(sid);

            sdata.sname   = s.sname;
            sdata.scity   = s.scity;
            sdata.sdegree = s.sdegree;
            sdata.gender  = s.gender;
            sdb.SaveChanges();
            return(sdata);
        }
Пример #15
0
 public ActionResult Edit([Bind(Include = "StudentID,FirstName,LastName,Grade,SchoolID")] tblStudent tblStudent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblStudent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SchoolID = new SelectList(db.tblSchools, "SchoolID", "Name", tblStudent.SchoolID);
     return(View(tblStudent));
 }
Пример #16
0
        public ActionResult DeleteConfirmed(string id)
        {
            tblStudent tblStudent = db.tblStudents.Find(id);

            // Instead of actually deleting student, the Active field is set to False.
            // This way, the user appears deleted, but can be recovered if need be.
            tblStudent.StudentActive = false;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Пример #17
0
        public ActionResult ManageStudent(int id)
        {
            tblStudent student = new tblStudent();

            student.tblContactDetail = new tblContactDetail();
            if (id != 0)
            {
                student = new StudentBL().GetById(id);
            }

            return(PartialView("_ManageStudent", student));
        }
Пример #18
0
        private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            studentid = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
            tblStudent tb = db.tblStudents.Where(a => a.StudentId == studentid).FirstOrDefault();

            txtStudentName.Text    = tb.StudentName;
            txtStudentAddress.Text = tb.Address;
            txtEmail.Text          = tb.Email;
            txtContact.Text        = tb.Contact;
            cboFacultyId.Text      = tb.tblFaculty.FacultyDescription;
            cboSessionId.Text      = tb.tblSession.SessionName;
        }
Пример #19
0
 public void getStudentNames()
 {
     using (RegistarDbContext dbInfo = new RegistarDbContext())
     {
         //Fetech the students.
         //var context = this.DataContext;
         var query = from st in dbInfo.tblStudents
                     where st.userID == userinfo.userID
                     select st;
         this.student = query.FirstOrDefault <tblStudent>();
     }
 }
Пример #20
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            tblStudent tb = db.tblStudents.Where(a => a.StudentId == studentid).FirstOrDefault();

            db.tblStudents.Remove(tb);
            if (db.SaveChanges() > 0)
            {
                MessageBox.Show("Student Details Deleted");
                LoadGrid();
                ClearData();
            }
        }
Пример #21
0
        public JsonResult GetStudentByID(int StudentId)
        {
            tblStudent obj = db.tblStudents.Where(s => s.IsDeleted == false && s.StudentId == StudentId)
                             .SingleOrDefault();
            string value = "";

            value = JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });
            return(Json(value, JsonRequestBehavior.AllowGet));
        }
Пример #22
0
        public PartialViewResult GetDetailsStudentRecord(int StudentId)
        {
            tblStudent obj = db.tblStudents.SingleOrDefault(s => s.IsDeleted == false &&
                                                            s.StudentId == StudentId);
            StudentViewModel vObj = new StudentViewModel();

            vObj.StudentId      = obj.StudentId;
            vObj.StudentName    = obj.StudentName;
            vObj.DepartmentName = obj.tblDepartment.DepartmentName;
            vObj.Email          = obj.Email;
            return(PartialView("_StudentDetails", vObj));
        }
Пример #23
0
        public JsonResult SaveStudent(tblStudent data)
        {
            data.Active          = (Request.Form["Active"] == "on");
            data.subsidy         = (Request.Form["subsidy"] == "on");
            data.siblingAtSchool = (Request.Form["siblingAtSchool"] == "on");
            data.GetAlertByEmail = (Request.Form["GetAlertByEmail"] == "on");
            data.GetAlertByCell  = (Request.Form["GetAlertByCell"] == "on");
            data.specialRequest  = (Request.Form["specialRequest"] == "on");
            if (data.pk == 0)
            {
                tblStudentLogic.create(data);
            }
            else
            {
                using (var logic = new tblStudentLogic())
                {
                    var st = logic.getStudentByPk(data.pk);
                    if (st.city != data.city || st.street != data.street || st.houseNumber != data.houseNumber)
                    {
                        //address changed
                        st.Lat = null;
                        st.Lng = null;
                        st.distanceFromSchool = 0;
                    }

                    st.familyId        = data.familyId;
                    st.siblingAtSchool = data.siblingAtSchool;
                    st.firstName       = data.firstName;
                    st.lastName        = data.lastName;
                    st.@class          = data.@class;
                    st.Shicva          = data.Shicva;
                    st.city            = data.city;
                    st.street          = data.street;
                    st.houseNumber     = data.houseNumber;
                    st.zipCode         = data.zipCode;
                    st.Email           = data.Email;
                    st.GetAlertByEmail = data.GetAlertByEmail;
                    st.CellPhone       = data.CellPhone;
                    st.GetAlertByCell  = data.GetAlertByCell;
                    st.specialRequest  = data.specialRequest;
                    st.request         = data.request;
                    st.Active          = data.Active;
                    st.subsidy         = data.subsidy;
                    st.streetId        = data.streetId;
                    st.cityId          = data.cityId;

                    tblStudentLogic.update(st);
                }
            }

            return(null);
        }
Пример #24
0
        public int UpdateUser(UserDetails ud)
        {
            tblStudent tb = _db.tblStudents.Where(u => u.UserId == ud.UserId).FirstOrDefault();

            tb.Username = ud.Username;
            tb.Password = ud.Password;
            tb.Usertype = ud.Usertype;
            tb.Fullname = ud.Fullname;

            int i = _db.SaveChanges();

            return(i);
        }
        public JsonResult DeleteStudentRecord(int StudentId)
        {
            bool       result = false;
            tblStudent Stu    = db.tblStudents.SingleOrDefault(x => x.IsDeleted == false && x.StudentId == StudentId);

            if (Stu != null)
            {
                Stu.IsDeleted = true;
                db.SaveChanges();
                result = true;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #26
0
        public ActionResult Delete(int id)
        {
            tblStudent       obj  = db.TblStudents.SingleOrDefault(u => u.StudentId == id);
            StudentViewModel vobj = new StudentViewModel();

            vobj.StudentName = obj.StudentName;
            vobj.Email       = obj.Email;
            vobj.DOB         = obj.DOB;
            vobj.ImageName   = obj.ImageName;
            vobj.ImageUrl    = obj.ImageUrl;
            vobj.StudentId   = obj.StudentId;
            return(View(vobj));
        }
Пример #27
0
    public int SendLink(string Email, string PageName, string userType)
    {
        int cnt = 0;

        if (userType == "admin")
        {
            var DC = new DataClassesDataContext();
            cnt = (from obj in DC.tblAdmins
                   where obj.EmailID == Email.ToLower() || obj.UserName == Email
                   select obj).Count();
            tblAdmin Data = (from obj in DC.tblAdmins
                             where obj.EmailID == Email.ToLower() || obj.UserName == Email
                             select obj).SingleOrDefault();
            string userid = Encryptdata("user:admin:" + Data.AdminID);
            if (cnt > 0)
            {
                SendMail(Data.EmailID, PageName + "?UserName="******"admin1")
        {
            var DC = new DataClassesDataContext();
            cnt = (from obj in DC.tblAdmins
                   where obj.EmailID == Email.ToLower() || obj.UserName == Email
                   select obj).Count();
            tblAdmin Data = (from obj in DC.tblAdmins
                             where obj.EmailID == Email.ToLower() || obj.UserName == Email
                             select obj).SingleOrDefault();
            string userid = Encryptdata("user:admin:" + Data.AdminID);
            if (cnt > 0)
            {
                SendMail(Data.EmailID, PageName + "?SetUserName="******"user")
        {
            var DC = new DataClassesDataContext();
            cnt = (from obj in DC.tblStudents
                   where obj.EmailID == Email.ToLower() || obj.DAID == Email || obj.UserName == Email
                   select obj).Count();
            tblStudent Data = (from obj in DC.tblStudents
                               where obj.EmailID == Email.ToLower() || obj.DAID == Email || obj.UserName == Email
                               select obj).SingleOrDefault();
            string userid = Encryptdata("user:user:"******"?UserName=" + userid);
            }
        }
        return(cnt);
    }
Пример #28
0
        public ActionResult create(studentViewModel c)
        {
            if (HttpRuntime.Cache["currentYear"] == null)
            {
                using (tblSystemLogic system = new tblSystemLogic())
                {
                    string x = tblSystemLogic.getSystemValueByKey("currentRegistrationYear").ToString();
                    HttpRuntime.Cache.Insert("currentYear", x, null, Cache.NoAbsoluteExpiration, TimeSpan.FromHours(50), CacheItemPriority.High, null);
                }
            }
            int yearRegistration = int.Parse(HttpRuntime.Cache["currentYear"].ToString());

            if (tblStudentLogic.checkIfIdExist(c.EditableTblStudents.studentId, yearRegistration))
            {
                ;
                ViewBag.message = DictExpressionBuilderSystem.Translate("message.studentIsAllredyRegister");
                //ViewBag.message = "התלמיד כבר רשום במערכת לשנה זו - לא ניתן לבצע רישום ";
                return(View(c));
            }

            if (c != null)
            {
                if (!checkstreet(c.EditableTblStudents.street))
                {
                    //ViewBag.message = "יש לבחור שם רחוב מהרשימה";
                    ViewBag.message = DictExpressionBuilderSystem.Translate("message.selectStreetFromList");
                    return(View(c));
                }

                tblStudent v = new tblStudent();
                v = c.EditableTblStudents;
                Task <tblStudent> x = geoCoding(v);
                //v.Lng = x.Result.Lng;//do not nedded since lng lat will get at the admin atachment to station
                //v.Lat = x.Result.Lat;
                int familyId = (int)Session["familyId"];


                v.familyId           = familyId;
                v.yearRegistration   = yearRegistration;
                v.registrationStatus = false;
                v.Active             = true;
                v.Color = "";
                tblStudentLogic.create(v);

                return(RedirectToAction("index", "Family"));
            }
            else
            {
                return(Redirect("~/account/unAutorise"));//real check is by Js in client side- if we here there is asecurity problem!
            }
        }
Пример #29
0
        public int CreateUser(UserDetails ud)
        {
            tblStudent tb = new tblStudent();

            tb.Username = ud.Username;
            tb.Password = ud.Password;
            tb.Usertype = ud.Usertype;
            tb.Fullname = ud.Fullname;
            _db.tblStudents.Add(tb);

            int i = _db.SaveChanges();

            return(i);
        }
Пример #30
0
        // GET: tblStudents/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblStudent tblStudent = db.tblStudents.Find(id);

            if (tblStudent == null)
            {
                return(HttpNotFound());
            }
            return(View(tblStudent));
        }
Пример #31
0
 protected void btn_register_Click(object sender, EventArgs e)
 {
     tblStudent s = new tblStudent();
     s.studentVoornaam = txtVoornaam.Text;
     s.studentNaam = txtAchternaam.Text;
     s.studentNummer= txtStudentnr.Text;
     s.fk_opleidingID = Convert.ToInt16(dropOpleiding.SelectedValue);
     BLLstudent BLLstudent = new BLLstudent();
     //Wachtwoord omzetten naar md5
     var passw = BLLstudent.getMD5Hash(txtWachtwoord.Text);
     s.studentPasswoord = passw;
     //Student bewaren en doorsturen naar volgende pagina
     BLLstudent.insertStudent(s);
     Response.Redirect("procedureGoedkeuring.aspx");
 }
Пример #32
0
        public static int Add(Models.DomainModel.Student student)
        {
            using (TestEntities context = new TestEntities())
            {
                tblAddress objAddress = new tblAddress()
                    {
                        HouseNo = student.AddressDetails.HouseNo,
                        Locality = student.AddressDetails.Locality,
                        City = student.AddressDetails.City,
                        District = student.AddressDetails.District,
                        State = student.AddressDetails.State,
                        CreatedDate = DateTime.Now,
                        CreatedBy = "admin"
                    };

                tblPerson objPerson = new tblPerson()
                    {
                        Name = student.Name,
                        FatherName = student.FatherName,
                        MotherName = student.MotherName,
                        Age = student.Age,
                        Gender = 1,
                        CreatedDate = DateTime.Now,
                        CreatedBy = "admin"
                    };

                context.tblAddresses.AddObject(objAddress);
                context.tblPersons.AddObject(objPerson);
                tblStudent objStudent = new tblStudent()
                {
                    PersonID = objPerson.ID,
                    AddressID = objAddress.ID,
                    CreatedDate = DateTime.Now,
                    CreatedBy = "admin"
                };
                context.tblStudents.AddObject(objStudent);
                context.SaveChanges();
                return objStudent.ID;
            }
        }
        /// <summary>
        /// This function is used to Add and Update student
        /// </summary>
        /// <param name="studentExtend"></param>
        public void SaveStudents(StudentExt studentExtend)
        {
            using (var context = new dbTIREntities())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        tblStudent newtblStudent = new tblStudent()
                        {
                            FirstName = studentExtend.FirstName,
                            MiddleName = studentExtend.MiddleName,
                            LastName = studentExtend.LastName,
                            DistrictId = studentExtend.DistrictId,
                            StateId = studentExtend.StateId,
                            LocalId = studentExtend.LocalId,
                            LineageId = studentExtend.LineageId == -1 ? null : studentExtend.LineageId,
                            RaceId = studentExtend.RaceId == -1 ? null : studentExtend.RaceId,
                            GenderId = studentExtend.GenderId,
                            BirthDate = studentExtend.BirthDate,
                            HomeLanguageId = studentExtend.HomeLanguageId == -1 ? null : studentExtend.HomeLanguageId,
                            NativeLanguageId = studentExtend.NativeLanguageId == -1 ? null : studentExtend.NativeLanguageId,
                            ChangeDatetime = DateTime.Now
                        };
                        if (studentExtend.StudentId == 0)
                        {
                            context.tblStudents.Add(newtblStudent);
                        }
                        else
                        {
                            newtblStudent.StudentId = studentExtend.StudentId;
                            context.tblStudents.Add(newtblStudent);
                            context.Entry(newtblStudent).State = EntityState.Modified;
                        }
                        context.SaveChanges();
                        tblStudentSchoolYear newtblStudentSchoolYear = new tblStudentSchoolYear()
                        {
                            StudentId = newtblStudent.StudentId,
                            SchoolYearId = studentExtend.SchoolYearId,
                            ServingSchoolId = studentExtend.ServingSchoolId,
                            GradeLevel = studentExtend.GradeLevel,
                            StateId = studentExtend.StateId,
                            LocalId = studentExtend.LocalId,
                            LepIndicator = studentExtend.LepIndicator,
                            IepIndicator = studentExtend.IepIndicator,
                            FrlIndicator = studentExtend.FrlIndicator,
                            EnrollmentDate = studentExtend.EnrollmentDate,
                            ChangeDateTIme = DateTime.Now,
                            Hispanic = studentExtend.Hispanic
                        };

                        if (studentExtend.StudentSchoolYearId == 0)
                        {
                            context.tblStudentSchoolYears.Add(newtblStudentSchoolYear);
                        }
                        else
                        {
                            newtblStudentSchoolYear.StudentSchoolYearId = studentExtend.StudentSchoolYearId;
                            context.tblStudentSchoolYears.Add(newtblStudentSchoolYear);
                            context.Entry(newtblStudentSchoolYear).State = EntityState.Modified;
                        }

                        context.SaveChanges();
                        dbContextTransaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();
                        throw ex;
                    }
                }
            }

        }