Demo entry 6799616

py

   

Submitted by anonymous on May 21, 2019 at 04:29
Language: Java. Code size: 3.0 kB.

 btn_OK.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(mAdapter.getCount()==rglist.size())
                {
                    for(int i=0;i<mAdapter.getCount();i++)
                    {
                        if(rglist.get(i)==0)
                        {
                    mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                            1,attendant_time,true,false,false,false);
                        }
                        if(rglist.get(i)==1)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,true,false,false);
                        }
                        if(rglist.get(i)==2)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,false,true,false);
                        }
                        if(rglist.get(i)==3)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,false,false,true);
                        }
                    }

                }
                else{
                    for(int i=0;i<rglist.size();i++)
                    {
                        if(rglist.get(i)==0)
                        {
                    mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                            1,attendant_time,true,false,false,false);
                        }
                        if(rglist.get(i)==1)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,true,false,false);
                        }
                        if(rglist.get(i)==2)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,false,true,false);
                        }
                        if(rglist.get(i)==3)
                        {
                        mDBA.insertAttendantRecord(courseId,mData.get(i).getStudentID(),classId,
                                1,attendant_time,false,false,false,true);
                        }
                    }
                    for(int j=0;j<mAdapter.getCount()-rglist.size();j++)
					{
                        mDBA.insertAttendantRecord(courseId,mData.get(j).getStudentID(),classId,
                            1,attendant_time,true,false,false,false);
                    }

                }

                Toast.makeText(AttendantActivity.this,"插入成功",Toast.LENGTH_LONG);
            }
        });
    }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).