Esempio n. 1
0
        //check whether user login in already
        public int checklog()
        {
            current_date = DateTime.Now;
            MyCommand2   = new OdbcCommand("select tms_logsheet.logsheet_id from tms_logsheet inner join jos_users on tms_logsheet.employee_id =jos_users.id where jos_users.username='******' and tms_logsheet.date_year='" + current_date.Year + "' and tms_logsheet.date_month='" + current_date.Month + "' and tms_logsheet.date_day=' " + current_date.Day + "' and (tms_logsheet.out_time is null or tms_logsheet.out_time='" + String.Empty + "')", Connection.MyConnection);
            if (Convert.ToInt32(MyCommand2.ExecuteScalar()) != 0)
            {
                MyCommand2.CommandText = "Select id from jos_users where username='******' ";
                userid = Convert.ToInt32(MyCommand2.ExecuteScalar());
                MyCommand2.CommandText = "Select cb_departmentid from jos_comprofiler where user_id='" + userid + "' ";
                userdepid = Convert.ToInt32(MyCommand2.ExecuteScalar());
                MyCommand2.CommandText = "Select name from jos_users where id='" + userid + "' ";
                userfname = (string)MyCommand2.ExecuteScalar();
                etimehh   = Notification.GetEndTimeHH();
                etimemm   = Notification.GetEndTimeMM();
                TaskReminderCount.TaskCount();
                if (TaskReminderCount.rid != 0)
                {
                    TaskReminderCount.startTaskRemindTimer();
                }
                git.callForIdletime();
                return(1);
            }
            MyCommand2.CommandText = "select tms_logsheet.logsheet_id from tms_logsheet inner join jos_users on tms_logsheet.employee_id =jos_users.id where jos_users.username='******' and tms_logsheet.date_year='" + current_date.Year + "' and tms_logsheet.date_month='" + current_date.Month + "' and tms_logsheet.date_day=' " + current_date.Day + "' and (tms_logsheet.out_time is not null or tms_logsheet.out_time!='" + String.Empty + "')";
            if (Convert.ToInt32(MyCommand2.ExecuteScalar()) != 0)
            {
                MessageBoxResult result = Microsoft.Windows.Controls.MessageBox.Show("Hi " + UserConfig.configlist[0] + ", our system tracked that you have already signed out for the day. Do you want to continue?", "BQuTMSWithJira Sign out Alert", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    MyCommand2.CommandText = "Select id from jos_users where username='******' ";
                    userid = Convert.ToInt32(MyCommand2.ExecuteScalar());
                    MyCommand2.CommandText = "Select name from jos_users where id='" + userid + "' ";
                    userfname = (string)MyCommand2.ExecuteScalar();
                    return(2);   //login alredy to system
                }
                else
                {
                    Connection.MyConnection.Close();
                    Environment.Exit(0);
                    return(3);
                }
            }

            MyCommand2 = new OdbcCommand("select tms_logsheet.logsheet_id from tms_logsheet inner join jos_users on tms_logsheet.employee_id =jos_users.id where jos_users.username='******' and tms_logsheet.date_year='" + current_date.Year + "' and tms_logsheet.date_month='" + current_date.Month + "' and tms_logsheet.date_day=' " + current_date.Day + "'", Connection.MyConnection);
            if (Convert.ToInt32(MyCommand2.ExecuteScalar()) == 0)
            {
                return(0);
            }
            else
            {
                return(4);
            }
        }
Esempio n. 2
0
        public void userLoginAgain()
        {
            if (checkuser(UserConfig.configlist[0], UserConfig.configlist[1]) == true)
            {
                MyCommand2.CommandText = "Select id from jos_users where username='******'";
                userid = Convert.ToInt32(MyCommand2.ExecuteScalar());
                MyCommand2.CommandText = "Select name from jos_users where id='" + userid + "' ";
                userfname = (string)MyCommand2.ExecuteScalar();

                TimeSpan timeSpentAwayFromOffice = calculateAwayTimeFromOffice(userid.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), DateTime.Now.Hour.ToString(), DateTime.Now.Minute.ToString(), DateTime.Now.Second.ToString());
                updateSignedOutTimeAndTimeSpentAwayFromOffice(userid.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), timeSpentAwayFromOffice);

                TaskReminderCount.TaskCount();
                if (TaskReminderCount.rid != 0)
                {
                    TaskReminderCount.startTaskRemindTimer(); //task reminder timer on
                }
                git.callForIdletime();                        //idle time timer on
            }
        }
Esempio n. 3
0
        //login method
        public void userLogin()
        {
            //if (checkuser(UserConfig.configlist[0], UserConfig.configlist[1]) == true)
            //{
            MyCommand2 = new OdbcCommand("Select id from jos_users where username='******'", Connection.MyConnection);

            userid = Convert.ToInt32(MyCommand2.ExecuteScalar());
            MyCommand2.CommandText = "Select name from jos_users where id='" + userid + "' ";
            userfname = (string)MyCommand2.ExecuteScalar();
            //etimehh = Notification.GetEndTimeHH();
            //etimemm = Notification.GetEndTimeMM();
            //loginReminder(1);
            //MyCommand2.CommandText = "insert into tms_logsheet(employee_id,date_year,date_month,date_day,in_time) values('" + userid + "','" + current_date.Year + "','" + current_date.Month + "','" + current_date.Day + "','" + string.Format("{0:HH:mm}", current_date) + "')";
            //MyCommand2.ExecuteNonQuery();
            TaskReminderCount.TaskCount();
            if (TaskReminderCount.rid != 0)
            {
                TaskReminderCount.startTaskRemindTimer(); //task reminder timer on
            }
            git.callForIdletime();                        //idle time timer on
            //LatearriArlyDep(Convert.ToInt32(Login.current_date.Hour), Convert.ToInt32(Login.current_date.Minute), Notification.GetStartingTimeHH(), Notification.GetStartingTimeMM(), "Late arrival");
            //}
        }
Esempio n. 4
0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //items delete code
        void DeleteSelected()
        {
            try
            {
                if (Connection.MyConnection.State == ConnectionState.Open)
                {
                    var selectedStockObject = add_lBox.SelectedItems[0] as AddTask;//select id
                    if (selectedStockObject == null)
                    {
                        return;
                    }
                    if (Microsoft.Windows.Controls.MessageBox.Show("Do you really want to delete this item?", "BQuTMSWithJira Delete confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        using (OdbcCommand MyCommand = new OdbcCommand("DELETE FROM tms_reminders WHERE rid='" + selectedStockObject.ID + "'", Connection.MyConnection))
                        {
                            MyCommand.ExecuteNonQuery();
                            tasklist.RemoveAt(add_lBox.SelectedIndex);
                            add_lBox.ItemsSource = tasklist;
                            add_lBox.Items.Refresh();
                            if (TaskReminderCount.rid != 0)
                            {
                                TaskReminderCount.TaskCount();
                            }
                        }
                    }
                }
                else
                {
                    Microsoft.Windows.Controls.MessageBox.Show("Unable to connect to the server. Please refresh (Help -> Refresh) and try again.", "BQuTMSWithJira Connection Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception)
            {
                //  MessageBox.Show(ex+"");
            }
        }