Exemple #1
0
        public MemberCheckIn(MainForm mainForm, TabControl tabControl, member member)
        {
            InitializeComponent();
            this.mainForm   = mainForm;
            this.tabControl = tabControl;
            this.member     = member;
            //Show user informations
            lblLoginMemberFirstName.Text  = member.first_name;
            lblLoginMemberLastName.Text   = member.last_name;
            lblLoginMemberAttendance.Text = AttendanceDAO.getLastById(member.member_id);

            String loginSuccessText;
            Image  loginSuccessImage;

            setMemberLoginStatus(member, out loginSuccessText, out loginSuccessImage);

            lblLoginStatus.Text         = loginSuccessText;
            pictureBoxLoginStatus.Image = loginSuccessImage;

            if (String.IsNullOrEmpty(member.profile_picture))
            {
                pictureBoxMemberProfileImage.Image = Properties.Resources.user;
            }
            else
            {
                pictureBoxMemberProfileImage.Image = Image.FromFile(member.profile_picture);
            }
        }
Exemple #2
0
        private void populateAttendaceList()
        {
            var attendanceListMembers = AttendanceDAO.getAllToday();

            this.objectListView1.SetObjects(attendanceListMembers);
            lblAttendance.Text = $"Pregled trenutno prijavljenih članova ({attendanceListMembers.Count()}) ";
        }
Exemple #3
0
        public int AddAttend()
        {
            AttendanceDAO dao    = new AttendanceDAO();
            int           result = dao.Insert(this);

            return(result);
        }
Exemple #4
0
        private void ReportMembersAttendanceLoad()
        {
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable("MembersAttendances");

            dt.Columns.Add("member_id");
            dt.Columns.Add("first_name");
            dt.Columns.Add("last_name");
            dt.Columns.Add("check_in_time");

            ds.Tables.Add(dt);
            List <MemberAttendanceDTO> membersAttendance = AttendanceDAO.getMembersAttendanceInDateRange(dateFrom, dateTo);

            foreach (var memberAttendance in membersAttendance)
            {
                DataRow dr = ds.Tables[0].NewRow();
                dr["member_id"]     = memberAttendance.member_id;
                dr["first_name"]    = memberAttendance.first_name;
                dr["last_name"]     = memberAttendance.last_name;
                dr["check_in_time"] = memberAttendance.check_in_time.ToString("dd.MM.yyyy. hh:mm:ss");
                ds.Tables[0].Rows.Add(dr);
            }
            rptMembersAttendance1.SetDataSource(ds);
            rptMembersAttendance1.SetParameterValue("pDateFrom", dateFrom.ToString("dd.MM.yyyy."));
            rptMembersAttendance1.SetParameterValue("pDateTo", dateTo.ToString("dd.MM.yyyy."));
            rptMembersAttendance1.SetParameterValue("pDatum", DateTime.Now.ToString("dd.MM.yyyy."));
            crystalReportViewer.ReportSource = rptMembersAttendance1;
            crystalReportViewer.Refresh();
        }
Exemple #5
0
        public Object SaveAttendance(List <AttendanceHistoryDTO> history)
        {
            //Check this
            //List<AttendanceHistoryDTO> attHis = JsonConvert.DeserializeObject<List<AttendanceHistoryDTO>>(history);

            for (int i = 0; i < history.Count; i++)
            {
                AttendanceHistoryDTO ahd = history.ElementAt(i);
                AttendanceHistoryDAL.Save(ahd);

                AttendanceDTO atndnc = AttendanceDAO.GetAttendanceById(ahd.AttId);
                if (ahd.HisIsPresent)
                {
                    atndnc.AttPresents++;
                }
                else
                {
                    atndnc.AttAbsents++;
                }
                AttendanceDAO.Save(atndnc);
            }

            var IsSaved = true;

            return(IsSaved);
        }
Exemple #6
0
        public AttendanceDTO Save(AttendanceDTO dto)
        {
            AttendanceDAO b = new AttendanceDAO();

            dto = b.Save(dto);

            return(dto);
        }
Exemple #7
0
        public AttendanceDTO GetAttendanceById(int id)
        {
            AttendanceDTO dto = new AttendanceDTO();
            AttendanceDAO d   = new AttendanceDAO();

            dto = d.GetAttendanceById(id);

            return(dto);
        }
Exemple #8
0
 public AttendanceDAOTest()
 {
     factory = new ConnectionFactory();
     context = factory.CreateUserDbContextForInMemory();
     context.Database.EnsureDeleted();
     context.Database.EnsureCreated();
     context.SaveChanges();
     attendanceDAO = new AttendanceDAO(context);
 }
Exemple #9
0
        //Save new attendance
        private Boolean saveAttendance(member m, Boolean isPaid)                //dopuniti kada se popravi baza
        {
            var newAttendance = new attendance()
            {
                member_id     = m.member_id,
                check_in_time = DateTime.Now,
                is_staff      = false
            };

            return(AttendanceDAO.insert(newAttendance));
        }
Exemple #10
0
        private void populateCalendar(int memberId)
        {
            List <DateTime> attendances = AttendanceDAO.getAllById(memberId);

            calendarAttendance.RemoveAllBoldedDates();
            if (attendances.Count != 0)
            {
                foreach (var attendance in attendances)
                {
                    calendarAttendance.AddBoldedDate(attendance);
                }
            }
            calendarAttendance.UpdateBoldedDates();
        }
Exemple #11
0
        /// <summary>
        /// 근태기록 날짜로 검색
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = "";

            if (dateTimePicker1.Value > dateTimePicker2.Value) // 뒤날짜가 앞날짜 보다 이르면 서로 날짜 교체
            {
                var temp = dateTimePicker1.Value;
                dateTimePicker1.Value = dateTimePicker2.Value;
                dateTimePicker2.Value = temp;
            }

            ad = new AttendanceDAO();
            dataGridView1.DataSource = ad.Select2Attendance(dateTimePicker1.Value, dateTimePicker2.Value);
            ColumnSetKorean();
        }
Exemple #12
0
        private void userMemberCheckIn()
        {
            DateTime today = DateTime.Now;
            Boolean  CheckedInForCurrentDate =
                AttendanceDAO.isAlreadyCheckedIn(loggedInUser.member_id, today.Day, today.Month, today.Year);

            if (!CheckedInForCurrentDate)
            {
                var user_member   = MemberDAO.getById(loggedInUser.member_id);              //UBACITI POLJE TrUE za placen dolazak
                var newAttendance = new attendance()
                {
                    member_id     = user_member.member_id,
                    check_in_time = DateTime.Now,
                    is_staff      = true
                };
                AttendanceDAO.insert(newAttendance);
            }
        }
Exemple #13
0
        public Object IsAttendanceMarked(int CouId, string Date)
        {
            AttendanceDTO stuAtt = AttendanceDAO.GetAttendancesByCouId(CouId).First();
            List <AttendanceHistoryDTO> attHisList = AttendanceHistoryDAL.GetAttendanceHistorysByAttId(stuAtt.AttId);

            bool toReturn = false;

            foreach (AttendanceHistoryDTO ah in attHisList)
            {
                if (ah.HisDateTime == Date)
                {
                    toReturn = true;
                }
            }

            var IsMarked = new { IsSaved = toReturn };

            return(IsMarked);
        }
Exemple #14
0
        public int UpdateFeedbackByUserIdEventId(int UserId, int eventId, int feedback)
        {
            AttendanceDAO attendance = new AttendanceDAO();

            return(attendance.UpdateFeedbackByUserIdEventId(UserId, eventId, feedback));
        }
Exemple #15
0
        public List <Attendance> GetAttendanceEvent(int id)
        {
            AttendanceDAO voucher = new AttendanceDAO();

            return(voucher.SelectAllByEventId(id));
        }
Exemple #16
0
        public int UpdateAttendanceById(int id, int attend)
        {
            AttendanceDAO attendance = new AttendanceDAO();

            return(attendance.UpdateAttendance(id, attend));
        }
Exemple #17
0
        public List <Attendance> GetAttendances()
        {
            AttendanceDAO voucher = new AttendanceDAO();

            return(voucher.SelectAllByAttend());
        }
Exemple #18
0
        public List <int> GetAllEventsParticipate(int id)
        {
            AttendanceDAO attend = new AttendanceDAO();

            return(attend.GetEventIdByParticipate(id));
        }
Exemple #19
0
        public string Delete(int id)
        {
            AttendanceDAO dao = new AttendanceDAO();

            return(dao.Delete(id));
        }
Exemple #20
0
        //Set users status and login image depending on user payments history
        private void setMemberLoginStatus(member m, out String text, out Image img)
        {
            //Default values
            text = "Neuspješna prijava!";
            img  = Properties.Resources.loginFAIL;

            int forMonth = DateTime.Now.Month;
            int forYear  = DateTime.Now.Year;
            int forDate  = DateTime.Now.Day;

            //Gdje ide provjera da li clan uopste POSTOJI! KADA BUDE CITAC??

            Boolean paidForCurrentMonth     = MembershipFeePaymentDAO.isPaidFor(m.member_id, forMonth, forYear);
            Boolean CheckedInForCurrentDate = AttendanceDAO.isAlreadyCheckedIn(m.member_id, forDate, forMonth, forYear);

            if (!CheckedInForCurrentDate)
            {
                if (paidForCurrentMonth)
                {
                    if (saveAttendance(m, true))
                    {
                        //CheckIn successfull - display infromation and close dialog after x seconds
                        text            = "Uspješna prijava!";
                        lblWarning.Text = "Plaćena članarina!";
                        img             = Properties.Resources.loginOK;
                        timer.Start();
                    }
                }
                else
                {   //Memeber can CheckIn with warning
                    if (DateTime.Now.Day > 5)
                    {
                        if (saveAttendance(m, false))
                        {
                            //Login successfull - display warning to pay fee
                            text            = "Uspješna prijava";
                            lblWarning.Text = "Platiti članarinu!";
                            img             = Properties.Resources.loginWRN;
                        }
                    }
                    else
                    {
                        //Members who paid fee for the last month can chekcIn regularly unitl 5th in next month
                        //Check if it's end of year
                        if (forMonth == 1)
                        {
                            forMonth = 13;
                            forYear--;
                        }
                        Boolean paidForLastMonth = MembershipFeePaymentDAO.isPaidFor(m.member_id, forMonth - 1, forYear);
                        if (paidForLastMonth)
                        {
                            if (saveAttendance(m, true))
                            {
                                //Login successfull - display infromation and remark to pay fee current month also
                                text            = "Uspješna prijava";
                                lblWarning.Text = "Platiti članarinu!";
                                img             = Properties.Resources.loginWRN;
                            }
                        }
                        else
                        {
                            if (saveAttendance(m, false))
                            {
                                //Login successfull - display warning to pay fee
                                text            = "Uspješna prijava";
                                lblWarning.Text = "Platiti članarinu!";
                                img             = Properties.Resources.loginWRN;
                            }
                        }
                    }
                }
            }
            else
            {
                //CheckIn failed - display infromation and warning - member already CheckedIn
                text = "Član već prijavljen!";
                img  = Properties.Resources.loginERR;
            }
        }
Exemple #21
0
        public List <AttendanceDTO> GetDataForAc(string term)
        {
            AttendanceDAO dao = new AttendanceDAO();

            return(dao.GetDataForAc(term));
        }
Exemple #22
0
        public void displayMemberInfo(member member)
        {
            panelNoMemberSelected.Hide();
            lblAddEducationLevelError.Text        = "";
            lblFirstNameProfileView.Text          = member.first_name;
            lblLastNameProfileView.Text           = member.last_name;
            lblBirthDateProfileView.Text          = String.Format("{0:dd.MM.yyyy}", member.birth_date);
            lblAddressProfileView.Text            = member.address;
            lblSexProfileView.Text                = member.sex;
            lblPhoneNumberProfileView.Text        = member.phone_number;
            lblEmailProfileView.Text              = member.email;
            lblRegistrationDateProfileView.Text   = String.Format("{0:dd.MM.yyyy}", member.registration_date);
            lblMembershipTypeProfileView.Text     = MembershipTypeDAO.getById(member.membership_type_id).name;
            lblFirstAndLastNameAttendance.Text    = member.first_name + " " + member.last_name;
            lblFirstAndLastNameMembershipFee.Text = member.first_name + " " + member.last_name;
            lblFirstAndLastNameEducation.Text     = member.first_name + " " + member.last_name;
            lblMeberIdProfileView.Text            = member.member_id.ToString();

            if (String.IsNullOrEmpty(member.profile_picture))
            {
                pictureBoxProfilePicture.Image = Properties.Resources.user;
            }
            else
            {
                pictureBoxProfilePicture.Image = Image.FromFile(member.profile_picture);
            }
            var lastAttendance = AttendanceDAO.getLastById(member.member_id);

            lblLastAttendance.Text = lastAttendance;

            populateCalendar(member.member_id);

            //You can pay for the month three days before
            var payingMonth = DateTime.Now.AddDays(3).Month;
            var payingYear  = DateTime.Now.AddDays(3).Year;

            comboBoxMonthMembershipFee.SelectedIndex = 0;
            comboBoxYearMembershipFee.SelectedIndex  = 0;

            populateMembershipFeeStatistic();
            var memberEducations = MemberEducationDAO.getById(member.member_id);

            comboBoxEducationLevel4.Items.Clear();
            comboBoxEducationLevel3.Items.Clear();
            comboBoxEducationLevel2.Items.Clear();
            comboBoxEducationLevel1.Items.Clear();

            lblEducationLevelExamDate4.Text = "/";
            lblEducationLevelExamDate3.Text = "/";
            lblEducationLevelExamDate2.Text = "/";
            lblEducationLevelExamDate1.Text = "/";

            comboBoxEducationLevel4.Enabled = false;
            comboBoxEducationLevel3.Enabled = false;
            comboBoxEducationLevel2.Enabled = false;
            comboBoxEducationLevel1.Enabled = false;


            switch (memberEducations.Count)
            {
            case 4:
                lblEducationLevelExamDate4.Text = memberEducations[3].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_1);
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_2);
                comboBoxEducationLevel4.Items.Add(memberEducations[3].commission_member_3);
                comboBoxEducationLevel4.SelectedIndex = 0;
                comboBoxEducationLevel4.Enabled       = true;
                goto case 3;

            case 3:
                lblEducationLevelExamDate3.Text = memberEducations[2].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_1);
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_2);
                comboBoxEducationLevel3.Items.Add(memberEducations[2].commission_member_3);
                comboBoxEducationLevel3.SelectedIndex = 0;
                comboBoxEducationLevel3.Enabled       = true;
                goto case 2;

            case 2:
                lblEducationLevelExamDate2.Text = memberEducations[1].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_1);
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_2);
                comboBoxEducationLevel2.Items.Add(memberEducations[1].commission_member_3);
                comboBoxEducationLevel2.SelectedIndex = 0;
                comboBoxEducationLevel2.Enabled       = true;
                goto case 1;

            case 1:
                lblEducationLevelExamDate1.Text = memberEducations[0].exam_date.ToString("dd.MM.yyyy.");
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_1);
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_2);
                comboBoxEducationLevel1.Items.Add(memberEducations[0].commission_member_3);
                comboBoxEducationLevel1.SelectedIndex = 0;
                comboBoxEducationLevel1.Enabled       = true;
                break;
            }
            int lastPayedMonth = MembershipFeePaymentDAO.getLastPaidMonth(member.member_id);

            if (lastPayedMonth == payingMonth)
            {
                comboBoxMonthMembershipFee.Enabled = false;
                comboBoxYearMembershipFee.Enabled  = false;
                btnSubmitPayment.Enabled           = false;
            }
            else
            {
                comboBoxMonthMembershipFee.Enabled = true;
                comboBoxYearMembershipFee.Enabled  = true;
                btnSubmitPayment.Enabled           = true;
            }
        }
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            AttendanceDAO dao = DAOFactory.CreateAttendanceDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }