Ejemplo n.º 1
0
        private void btnInsert_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Student_Info student_info = new Student_Info();
                student_info.Name            = txtname.Text;
                student_info.Registration_No = txtr_no.Text;
                student_info.Exam            = cmbex.SelectedItem.ToString();
                student_info.Sesson          = txtson.Text;
                student_info.Board           = cmbB.SelectedItem.ToString();
                student_info.Contact_No      = txtc_on.Text;
                var result = client.InsertAsync(student_info);

                if (result.Result.Body.InsertResult > 0)
                {
                    ClearControl();
                    Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog("Insert Success");
                    mesg.ShowAsync();
                }
                else
                {
                    Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog("Insert Failed");
                    mesg.ShowAsync();
                }
            }
            catch (Exception exp)
            {
                Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog(exp.Message.ToString());
                mesg.ShowAsync();
            }
        }
Ejemplo n.º 2
0
        private void loadStudentInfo()
        {
            lblSuccessMessage.Visible  = false;
            divStudentInfo.Visible     = false;
            divCheckOutSection.Visible = false;
            btnSearchAsset.Visible     = false;
            txtTagID.Visible           = false;

            string selected_studentid = txtStudentLookup.SelectedStudentID;

            if (!isNull(selected_studentid))
            {
                txtTagID.Visible           = true;
                txtStudentLookup.Visible   = false;
                divStudentInfo.Visible     = true;
                btnSearchAsset.Visible     = true;
                divCheckOutSection.Visible = true;

                txtTagID.txtTagID.Focus();
                Student_Info.LoadStudentInfo(selected_studentid);

                LoadCurrentAssignmentDG(selected_studentid);
                LoadPendingAssignment();
            }
        }
Ejemplo n.º 3
0
        static async Task InsertStudentData(Student_Info info)
        {
            var connectionString = "mongodb://*****:*****@cluster0-shard-00-00-g55qv.mongodb.net:27017,cluster0-shard-00-01-g55qv.mongodb.net:27017,cluster0-shard-00-02-g55qv.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true";
            var client           = new MongoClient(connectionString);

            var db = client.GetDatabase("VishnuDB");

            var collection = db.GetCollection <Student_Info>("StudentData");

            var document = new Student_Info
            {
                Student_ID = info.Student_ID,
                Name       = info.Name,
                Branch     = info.Branch
            };
            //var document2 = new Student_Info
            //{
            //    Student_ID = 3,
            //    Name = "VishnuKumar",
            //    Branch = "ece"
            //};

            //await collection.InsertManyAsync(new[] { document, document2 });
            await collection.InsertOneAsync(document);
        }
Ejemplo n.º 4
0
        public void Update(Student_Info Item)
        {
            var res = data.Find(x => x.Id == Item.Id);

            data.Remove(res);
            data.Add(Item);
        }
        //3)Update a specific record.
        public IHttpActionResult UpdateStudent(int Sid, Student_Info student)
        {
            try
            {
                Student_Info students = db.Student_Info.Find(Sid);
                if (students != null)
                {
                    students.Sname  = student.Sname;
                    students.Degree = student.Degree;
                    students.City   = students.City;
                    students.Gender = students.Gender;
                    db.SaveChanges();
                    return(Content(HttpStatusCode.OK, students));
                }
                else
                {
                    return(Content(HttpStatusCode.InternalServerError, "There is no student data with Sid: '" + Sid + "'"));
                }
            }
            catch (Exception)
            {
                return(Content(HttpStatusCode.InternalServerError, "Please try again!!"));

                throw;
            }
        }
Ejemplo n.º 6
0
        private void LoadStudentAssetDetails(string asset_student_transaction_id)
        {
            DataSet ds = DatabaseUtilities.DsGetByTableColumnValue(Constants.DB_VIEW_STUDENT_ASSET_SEARCH, "Asset_Student_Transaction_ID", asset_student_transaction_id, "");

            Utilities.DataBindForm(divStudentTransactionDetails, ds);

            string found_date = "";

            //load Student Info Control
            if (ds.Tables[0].Rows.Count > 0)
            {
                string studentid = ds.Tables[0].Rows[0]["Student_ID"].ToString();
                found_date = ds.Tables[0].Rows[0]["Date_Found_Formatted"].ToString();

                if (!isNull(studentid))
                {
                    Student_Info.LoadStudentInfo(studentid);
                }
            }

            bool isDisplayFoundInfo = !isNull(found_date);

            trFoundDisposition.Visible = isDisplayFoundInfo;
            trFoundCondition.Visible   = isDisplayFoundInfo;
            trFoundDate.Visible        = isDisplayFoundInfo;
        }
Ejemplo n.º 7
0
        //根据 id 删除 学生信息
        public BaseViewModel delStudentInfo(int id)
        {
            BaseViewModel baseView = new BaseViewModel();
            Student_Info  info     = _studentInfoRepository.getbyID(id);

            if (info != null)
            {
                _studentInfoRepository.RemoveInfo(info);
                int i = _studentInfoRepository.SaveChanges();
                if (i > 0)
                {
                    baseView.ResponseCode = 0;
                    baseView.Message      = "删除成功";
                }
                else
                {
                    baseView.ResponseCode = 1;
                    baseView.Message      = "删除失败";
                }
            }
            else
            {
                baseView.ResponseCode = 1;
                baseView.Message      = "删除失败";
            }

            return(baseView);
        }
Ejemplo n.º 8
0
 public static Student ToStudent(this Student_Info @this)
 {
     return(new Student
     {
         Id = @this.Id,
         Name = @this.Name,
         Surname = @this.Surname
     });
 }
Ejemplo n.º 9
0
        public ActionResult DeleteConfirmed(string id)
        {
            Student_Info studend_Info = db.Student_Infos.Find(id);

            db.Student_Infos.Remove(studend_Info);
            db.SaveChanges();
            DataCache.RemoveCache("cache_student");
            return(RedirectToAction("ViewList"));
        }
Ejemplo n.º 10
0
 public IActionResult Index(Student_Info info)
 {
     if (info.Name != null)
     {
         InsertStudentData(info).Wait();
         ModelState.Clear();
         ViewBag.Success = "Submitted Successfully...!";
     }
     return(View());
 }
Ejemplo n.º 11
0
        public ActionResult Edit([Bind(Include = "id,name,sex,birthday,photo,phone,email,school,grade,address,cardType,IdCard")] ViewModel.StudentsModel StudentsModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Student_Info student_info = db.Student_Infos.Find(StudentsModel.id);
                    if (student_info == null)
                    {
                        ViewBag.msg = "没有查到该学生信息,可能已被删除。";
                        CreateSelect();
                        return(View(StudentsModel));
                    }
                    if (db.Student_Infos.Where(x => x.stu_id != StudentsModel.id && x.stu_card_type == StudentsModel.cardType && x.stu_idCard == StudentsModel.IdCard).Count() > 0)
                    {
                        ViewBag.msg = "该证件号已存在,请勿重新添加。";
                        CreateSelect();
                        return(View(StudentsModel));
                    }
                    student_info.stu_id           = StudentsModel.id;
                    student_info.stu_card_type    = StudentsModel.cardType;
                    student_info.stu_idCard       = PageValidate.InputText(StudentsModel.IdCard, 18);
                    student_info.stu_birthday     = StudentsModel.birthday;
                    student_info.stu_email        = PageValidate.InputText(StudentsModel.email, 200);
                    student_info.stu_grade_id     = StudentsModel.grade;
                    student_info.stu_home_address = PageValidate.InputText(StudentsModel.address, 500);
                    student_info.stu_name         = PageValidate.InputText(StudentsModel.name, 50);
                    student_info.stu_phone        = PageValidate.InputText(StudentsModel.phone, 20);
                    student_info.stu_school_id    = StudentsModel.school;
                    student_info.stu_sex          = PageValidate.InputText(StudentsModel.sex, 2);

                    string up_photo = PageValidate.InputText(StudentsModel.photo, 50);
                    if (up_photo != student_info.stu_photo_path)
                    {
                        string   file_name = string.Format("{0}.jpg", student_info.stu_idCard);
                        string   save_name = string.Format(Server.MapPath(string.Format("~/images/stu/{0}", file_name)));
                        string   old_path  = string.Format(Server.MapPath(string.Format("~/images/temp/{0}", up_photo)));
                        FileInfo fi        = new FileInfo(old_path);
                        fi.CopyTo(save_name, true);
                        student_info.stu_photo_path = file_name;
                    }

                    db.Entry(student_info).State = EntityState.Modified;
                    db.SaveChanges();
                    DataCache.RemoveCache("cache_student");
                }
                catch (Exception e)
                {
                    ViewBag.msg = e.ToString();
                    CreateSelect();
                    return(View(StudentsModel));
                }
            }
            return(RedirectToAction("ViewList"));
        }
Ejemplo n.º 12
0
        public void Update_Info(int id, int group)
        {
            Student_Info res        = data.Find(x => x.Id == id);
            Student_Info newstudent = new Student_Info()
            {
                Id = res.Id, Name = res.Name, Surname = res.Surname, Group = group
            };

            data.Remove(res);
            data.Add(newstudent);
        }
Ejemplo n.º 13
0
        //导入老师以及员工信息
        public int InputWhiteListIntoDataBase_facultystaffInfo(string FilePath, string FileName)
        {
            Student_Info student_Info     = new Student_Info();
            var          aa               = student_Info.CreateDate;
            var          package          = new ExcelPackage(new System.IO.FileInfo(FilePath));
            var          workbook         = package.Workbook;
            var          worksheet        = workbook.Worksheets.First();
            var          facultystaffInfo = worksheet.ConvertSheetToObjects <facultystaff_Info>(FileName).ToList();

            _facultystaffInfoRepository.AddList(facultystaffInfo);
            return(_facultystaffInfoRepository.SaveChanges());
        }
Ejemplo n.º 14
0
        //根据 id 批量删除 学生信息 20200828
        public BaseViewModel batchdelStudentInfo(List <int> ids, string memo)
        {
            BaseViewModel baseView = new BaseViewModel();
            int           i = 0, j = 0;
            string        names = "";

            foreach (var id in ids)
            {
                Student_Info info = _studentInfoRepository.getbyID(id);
                if (info != null)
                {
                    // 保存到备份数据库
                    Student_Info_Delete info_Delete = new Student_Info_Delete();
                    info_Delete            = _IMapper.Map <Student_Info, Student_Info_Delete>(info);
                    info_Delete.id         = Guid.NewGuid().ToString();
                    info_Delete.Student_id = info.id;
                    info_Delete.Memo       = memo;
                    _deleteStudentInfo.Add(info_Delete);
                    int m = _deleteStudentInfo.SaveChanges();


                    _studentInfoRepository.RemoveInfo(info);
                    int n = _studentInfoRepository.SaveChanges();
                    if (n > 0)
                    {
                        i++;
                    }
                    else
                    {
                        j++;
                        names += info.Name + ",";
                    }
                }
                else
                {
                    j++;
                    names += "该id=" + id + "未找到学生信息,";
                }
            }
            if (j > 0)
            {
                baseView.ResponseCode = 1;
                baseView.Message      = "删除成功:" + i.ToString() + "条数据;删除失败:" + j + "条数据。删除失败姓名包括:" + names;
            }
            else
            {
                baseView.ResponseCode = 0;
                baseView.Message      = "全部删除成功共:" + i.ToString() + "条数据";
            }

            return(baseView);
        }
Ejemplo n.º 15
0
        public ActionResult Create([Bind(Include = "name,sex,birthday,photo,phone,email,school,grade,address,cardType,IdCard")] ViewModel.StudentsModel StudentsModel)
        {
            if (ModelState.IsValid)
            {
                if (db.Student_Infos.Where(x => x.stu_card_type == StudentsModel.cardType && x.stu_idCard == StudentsModel.IdCard).Count() > 0)
                {
                    ViewBag.msg = "该证件号已存在,请勿重新添加。";
                    CreateSelect();
                    return(View(StudentsModel));
                }
                Student_Info student_info = new Student_Info();
                student_info.stu_card_type    = StudentsModel.cardType;
                student_info.stu_idCard       = PageValidate.InputText(StudentsModel.IdCard, 18);
                student_info.stu_birthday     = StudentsModel.birthday;
                student_info.stu_email        = PageValidate.InputText(StudentsModel.email, 200);
                student_info.stu_grade_id     = StudentsModel.grade;
                student_info.stu_home_address = PageValidate.InputText(StudentsModel.address, 500);
                student_info.stu_name         = PageValidate.InputText(StudentsModel.name, 50);
                student_info.stu_phone        = PageValidate.InputText(StudentsModel.phone, 20);
                student_info.stu_photo_path   = PageValidate.InputText(StudentsModel.photo, 50);
                student_info.stu_school_id    = StudentsModel.school;
                student_info.stu_sex          = PageValidate.InputText(StudentsModel.sex, 2);

                string up_photo = PageValidate.InputText(StudentsModel.photo, 50);
                if (!string.IsNullOrEmpty(up_photo))
                {
                    string   file_name = string.Format("{0}.jpg", student_info.stu_idCard);
                    string   save_name = string.Format(Server.MapPath(string.Format("~/images/stu/{0}", file_name)));
                    string   old_path  = string.Format(Server.MapPath(string.Format("~/images/temp/{0}", up_photo)));
                    FileInfo fi        = new FileInfo(old_path);
                    fi.CopyTo(save_name, true);
                    student_info.stu_photo_path = file_name;
                }
                if (db.Student_Infos.Count() == 0)
                {
                    student_info.stu_id = DateTime.Now.ToString("yyyy") + "100001";
                }
                else
                {
                    string strNum = db.Student_Infos.OrderByDescending(x => x.stu_id).First().stu_id.Substring(4, 6);
                    int    Num    = Int32.Parse(strNum) + 1;
                    student_info.stu_id = DateTime.Now.ToString("yyyy") + Num.ToString();
                }
                db.Student_Infos.Add(student_info);
                db.SaveChanges();
                ViewBag.msg = "添加成功。";
                DataCache.RemoveCache("cache_student");
                //return RedirectToAction("Index");
            }
            CreateSelect();
            return(View(StudentsModel));
        }
        private void LoadStudentInfo(string studentid)
        {
            divStudentInfo.Visible       = false;
            divCurrentlyAssigned.Visible = false;

            if (!isNull(studentid))
            {
                divStudentInfo.Visible       = true;
                divCurrentlyAssigned.Visible = true;
                Student_Info.LoadStudentInfo(studentid);
                LoadCurrentAssignmentDG(studentid, "", "", false);
            }
        }
Ejemplo n.º 17
0
        public void Create(Student_Info Item)
        {
            bool res = _studentRepository.Exist(Item.Id);

            if (res == true)
            {
                _studentRepository.Create(Item);
            }
            else
            {
                _studentRepository.Create_New(Item);
            }
        }
Ejemplo n.º 18
0
        public HttpResponseMessage Put(int id, [FromBody] Student_Info value)
        {
            bool result = students.Update(id, value);

            if (result)
            {
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
        }
Ejemplo n.º 19
0
        public bool Update(int id, Student_Info Item)
        {
            bool res = _studentRepository.Exist(id);

            if (res == true)
            {
                _studentRepository.Update(Item);
                return(res);
            }
            else
            {
                return(res);
            }
        }
Ejemplo n.º 20
0
        // GET: Student/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Student_Info studend_Info = db.Student_Infos.Find(id);

            if (studend_Info == null)
            {
                return(HttpNotFound());
            }
            return(View(studend_Info));
        }
Ejemplo n.º 21
0
        public async Task <ActionResult> ExternalLoginCallback(string returnUrl)
        {
            var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();

            if (loginInfo == null)
            {
                return(RedirectToAction("Login"));
            }

            // Sign in the user with this external login provider if the user already has a login
            var result = await SignInManager.ExternalSignInAsync(loginInfo, isPersistent : false);

            //get info user login
            var user = await UserManager.FindByNameAsync(loginInfo.Email);

            switch (result)
            {
            case SignInStatus.Success:
                //check user role stident
                if (await UserManager.IsInRoleAsync(user.Id, "Student"))
                {
                    Student_Info StuInfo = new Student_Info();
                    return(RedirectToAction("ListOfRecruitment", "Recruitment", new { area = "Student" }));
                }
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = false }));

            case SignInStatus.Failure:
            default:
                // If the user does not have an account, then prompt the user to create an account
                ViewBag.ReturnUrl     = returnUrl;
                ViewBag.LoginProvider = loginInfo.Login.LoginProvider;
                return(View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel {
                    Email = loginInfo.Email
                }));
            }
        }
 //1)Insert records into tables
 public IHttpActionResult PostData(Student_Info student)
 {
     try
     {
         if (student != null)
         {
             db.Student_Info.Add(student);
             db.SaveChanges();
             return(Ok("Data added successfully"));
         }
         else
         {
             return(Content(HttpStatusCode.NoContent, "No Data Foun!!"));
         }
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.InternalServerError, "Provide Proper Data!!"));
     }
 }
        private void LoadControlByCheckInType()
        {
            string student_id = Student_Info.lblStudentID.Text;

            Initialize_Controls();

            string check_in_type = ddlCheckInType.SelectedValue;

            switch (check_in_type)
            {
            case Constants.CHECK_IN_TYPE_CODE_UNIDENTIFIED:
            case Constants.CHECK_IN_TYPE_CODE_LOST:
            case Constants.CHECK_IN_TYPE_CODE_STOLEN:
                divStudentLookup.Visible = true;

                if (!isNull(student_id))
                {
                    divStudentInfo.Visible   = true;
                    txtStudentLookup.Visible = false;
                    Student_Info.LoadStudentInfo(student_id);
                    LoadAssignmentDG();
                }
                else
                {
                    txtStudentLookup.Visible = true;
                    txtStudentLookup.txtStudentLookup.Focus();
                }

                break;

            case Constants.CHECK_IN_TYPE_CODE_STANDARD:
            case Constants.CHECK_IN_TYPE_CODE_FOUND:
            case Constants.CHECK_IN_TYPE_CODE_RETURN:

                divSearchBy.Visible = true;
                LoadControlByRadioSearchType();
                break;
            }

            //updatePanelStudentInfo.Update();
        }
        //2)View a specific record of the table
        public IHttpActionResult GetStudent(int Sid)
        {
            try
            {
                Student_Info student = db.Student_Info.Find(Sid);
                if (student != null)
                {
                    return(Content(HttpStatusCode.OK, student));
                }
                else
                {
                    return(Content(HttpStatusCode.InternalServerError, "There is no student data with Sid: '" + Sid + "'"));
                }
            }
            catch (Exception)
            {
                return(Content(HttpStatusCode.InternalServerError, "Please try again!!"));

                throw;
            }
        }
Ejemplo n.º 25
0
        //根据id获取学生信息
        public Student_Info getbyID(int id)
        {
            Student_Info info = new Student_Info();

            //查询条件
            var predicate = WhereExtension.True <Student_Info>();//初始化where表达式

            predicate = predicate.And(p => p.id.Equals(id));

            var result = DbSet.Where(predicate).ToList();

            if (result.Count > 0)
            {
                info = result.First();
            }
            else
            {
                info = null;
            }

            return(info);
        }
Ejemplo n.º 26
0
 //create student_info
 public bool CreateStudent(ApplicationUser user)
 {
     using (EJobEntities db = new EJobEntities())
     {
         Student_Info nStudent = new Student_Info
         {
             Account_Id        = user.Id,
             Status_Id         = 1,
             Student_Name      = user.UserName,
             Student_Create_at = DateTime.Now
         };
         db.Student_Info.Add(nStudent);
         try
         {
             db.SaveChanges();
             var check = UserManager.AddToRole(user.Id, "Student");
             return(true);
         }
         catch { }
     }
     return(false);
 }
        public IHttpActionResult DeleteStudent(int Sid)
        {
            try
            {
                Student_Info students = db.Student_Info.Find(Sid);
                if (students != null)
                {
                    db.Student_Info.Remove(students);
                    db.SaveChanges();
                    return(Content(HttpStatusCode.OK, "Data Deleted Successfully"));
                }
                else
                {
                    return(Content(HttpStatusCode.InternalServerError, "There is no student data with Sid: '" + Sid + "'"));
                }
            }
            catch (Exception)
            {
                return(Content(HttpStatusCode.InternalServerError, "Please try again!!"));

                throw;
            }
        }
        private void LoadStudentInfo(string studentid)
        {
            divStudentInfo.Visible       = false;
            btnSearchTagID.Visible       = false;
            txtTagID.Visible             = false;
            txtSerialNumber.Visible      = false;
            divCurrentlyAssigned.Visible = false;
            hdnStudentID.Value           = "";
            Student_Info.Visible         = false;

            if (!isNull(studentid))
            {
                hdnStudentID.Value           = studentid;
                txtTagID.Visible             = true;
                divStudentInfo.Visible       = true;
                btnSearchTagID.Visible       = true;
                divCurrentlyAssigned.Visible = true;
                Student_Info.Visible         = true;

                txtTagID.txtTagID.Focus();
                Student_Info.LoadStudentInfo(studentid);
            }
        }
Ejemplo n.º 29
0
 private void btnSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var result = client.SearchAsync(txtr_no.Text);
         if (result.Result.Body.SearchResult != null)
         {
             Student_Info stu_info = result.Result.Body.SearchResult;
             this.DataContext = stu_info;
             Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog("Sreach Success");
             mesg.ShowAsync();
         }
         else
         {
             Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog("Sreach Faild");
             mesg.ShowAsync();
         }
     }
     catch (Exception exp)
     {
         Windows.UI.Popups.MessageDialog mesg = new Windows.UI.Popups.MessageDialog(exp.Message.ToString());
         mesg.ShowAsync();
     }
 }
Ejemplo n.º 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int           StudentID = Convert.ToInt32(Request.QueryString["StudentID"]);
            SqlConnection conn;
            SqlCommand    comm_enrollment;
            SqlDataReader reader;
            // read the connection string from Web.config
            string connectionString = ConfigurationManager.ConnectionStrings["Students"].ConnectionString;

            // Initialize connection
            conn = new SqlConnection(connectionString);
            //create command
            comm_enrollment = new SqlCommand("SELECT Courses.CourseID,Courses.Title, Enrollments.Grade  FROM Enrollments JOIN Courses on Enrollments.CourseID = Courses.CourseID WHERE Enrollments.StudentID = @StudentID", conn);
            // add parameter into command
            comm_enrollment.Parameters.Add("@StudentID", System.Data.SqlDbType.Int);
            comm_enrollment.Parameters["@StudentID"].Value = StudentID;

            try
            {
                //open connection
                conn.Open();
                //execute the command
                reader = comm_enrollment.ExecuteReader();
                // bind the reader to DataList
                Student_Info.DataSourceID = null;
                Student_Info.DataSource   = reader;
                Student_Info.DataBind();
                //Close the reader
                reader.Close();
            }
            finally
            {
                //close connection
                conn.Close();
            }
        }