Ejemplo n.º 1
0
        private void btnUploadCW_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (openFileDialogCW.ShowDialog().Equals(DialogResult.OK))
            {
                List<string> fileDir = new List<string>(openFileDialogCW.FileNames);

                frmUpload upload = new frmUpload(string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,fileDir,"CW");
                upload.Show();
            }
        }
Ejemplo n.º 2
0
        private void Add(string actFiledir)
        {
            string fileName = Path.GetFileName(actFiledir);

            List<string> dir = new List<string>();
            dir.Add(actFiledir);

            List<MySqlParameter> param = new List<MySqlParameter>();
            param.Add(new MySqlParameter("@act_id", act_id));
            param.Add(new MySqlParameter("@fileNamewExt", fileName));

            if (!MySQLCommands.DoesExist("select concat(file_name,file_ext) from tbl_activityfile INNER JOIN tbl_files on tbl_activityfile.FID = tbl_files.FID where tbl_activityfile.activity_id = @act_id and concat(file_name,file_ext) = @fileNamewExt",param))
            {
                frmUpload uploadAct = new frmUpload(string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,act_id,string.Empty,dir,"eACTFILE");
                uploadAct.ShowDialog();
            }
            else
            {
                XtraMessageBox.Show("Duplicate of the file " + fileName + " is found","File Duplicate",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            List<MySqlParameter> param = new List<MySqlParameter>();
            param.Add(new MySqlParameter("@uid", insClass.log));
            param.Add(new MySqlParameter("@act_id", act_id));
            param.Add(new MySqlParameter("@respond_message", memoEditMessage.Text));

            if (MySQLCommands.TestConnection())
            {
                if (string.IsNullOrWhiteSpace(memoEditMessage.Text) && lstFiles.ItemCount.Equals(0))
                {
                    XtraMessageBox.Show("Please enter a valid message or enter atleast 1 file to submit","Invalid Value",MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
                else
                {
                    string val = MySQLCommands.GetValue("SELECT if (@act_id IN (SELECT tbl_respondactivity.activity_id FROM tbl_respondactivity WHERE tbl_respondactivity.respond_id IN (SELECT tbl_studentrespond.respond_id FROM tbl_studentrespond WHERE tbl_studentrespond.UID = @uid)),'TRUE',NULL) AS result", param);
                    
                    if (!hasDeadline)//if deadline is disabled
                    {
                        if (val.Equals(string.Empty))
                        {
                            if (XtraMessageBox.Show("This is a one time respond only, you are not \nallowed to edit or respond again in this activity after you click submit", "Continue ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                            {
                                //insert ang reply
                                long respond_id = MySQLCommands.Insert("insert into tbl_respond (respond_message) values (@respond_message)", param);

                                param.Add(new MySqlParameter("@respond_id", respond_id));

                                MySQLCommands.Insert("insert into tbl_studentrespond (UID,respond_id) values (@uid,@respond_id)", param);
                                MySQLCommands.Insert("insert into tbl_respondactivity (respond_id,activity_id) values (@respond_id,@act_id)", param);

                                if (lstFiles.ItemCount > 0)
                                {
                                    List<string> item = lstFiles.Items.Cast<String>().ToList();

                                    frmUpload replyFile = new frmUpload(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, act_id, respond_id.ToString(), item, "ACTREPLY");
                                    replyFile.ShowDialog();
                                }

                                closeNow = true;
                                this.Close();
                            }
                        }
                        else
                        {
                            XtraMessageBox.Show("You've already submitted this activity", "Reply Blocked", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else //deadline is enabled
                    {
                        string deadTime = MySQLCommands.GetValue("SELECT if ((time(CURRENT_TIMESTAMP)) >= (SELECT tbl_activity.activity_deadtime FROM tbl_activity WHERE tbl_activity.activity_id = @act_id),'TRUE','FALSE') AS is_deadlinetime", param);
                        string deadDate = MySQLCommands.GetValue("SELECT if ((SELECT tbl_activity.activity_deaddate FROM tbl_activity WHERE tbl_activity.activity_id = @act_id) >= (select date(CURRENT_TIMESTAMP)),'FALSE','TRUE') AS is_deadline", param);
                        string equal = MySQLCommands.GetValue("SELECT if ((SELECT tbl_activity.activity_deaddate FROM tbl_activity WHERE tbl_activity.activity_id = @act_id) > (select date(CURRENT_TIMESTAMP)),'FALSE','TRUE') AS is_Equal", param);

                        if (deadDate.Equals("FALSE"))
                        {
                            if (equal.Equals("TRUE"))
                            {
                                //check time
                                if (deadTime.Equals("TRUE"))
                                {
                                    //di na reply coz deadline na
                                    XtraMessageBox.Show("Deadline has expired", "Reply Blocked", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    if (val.Equals(string.Empty))
                                    {
                                        if (XtraMessageBox.Show("This is a one time respond, only you are not \nallowed to edit or respond again in this activity after you click submit", "Continue ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                                        {
                                            //insert ang reply
                                            long respond_id = MySQLCommands.Insert("insert into tbl_respond (respond_message) values (@respond_message)", param);

                                            param.Add(new MySqlParameter("@respond_id", respond_id));

                                            MySQLCommands.Insert("insert into tbl_studentrespond (UID,respond_id) values (@uid,@respond_id)", param);
                                            MySQLCommands.Insert("insert into tbl_respondactivity (respond_id,activity_id) values (@respond_id,@act_id)", param);

                                            if (lstFiles.ItemCount > 0)
                                            {
                                                List<string> item = lstFiles.Items.Cast<String>().ToList();

                                                frmUpload replyFile = new frmUpload(insClass.log,string.Empty,string.Empty,string.Empty,string.Empty,string.Empty,act_id,respond_id.ToString(),item,"ACTREPLY");
                                                replyFile.ShowDialog();
                                            }

                                            closeNow = true;
                                            this.Close();
                                        }
                                    }
                                    else
                                    {
                                        XtraMessageBox.Show("You've already submitted this activity", "Reply Blocked", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    }
                                }
                            }
                            else
                            {
                                if (val.Equals(string.Empty))
                                {
                                    if (XtraMessageBox.Show("This is a one time respond, only you are not \nallowed to edit or respond again in this activity after you click submit", "Continue ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                                    {
                                        //insert ang reply
                                        long respond_id = MySQLCommands.Insert("insert into tbl_respond (respond_message) values (@respond_message)", param);

                                        param.Add(new MySqlParameter("@respond_id", respond_id));

                                        MySQLCommands.Insert("insert into tbl_studentrespond (UID,respond_id) values (@uid,@respond_id)", param);
                                        MySQLCommands.Insert("insert into tbl_respondactivity (respond_id,activity_id) values (@respond_id,@act_id)", param);

                                        if (lstFiles.ItemCount > 0)
                                        {
                                            List<string> item = lstFiles.Items.Cast<String>().ToList();

                                            frmUpload replyFile = new frmUpload(insClass.log, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, act_id, respond_id.ToString(), item, "ACTREPLY");
                                            replyFile.ShowDialog();
                                        }

                                        closeNow = true;
                                        this.Close();
                                    }
                                }
                                else
                                {
                                    XtraMessageBox.Show("You've already submitted this activity", "Reply Blocked", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            
                        }
                        else
                        {
                            //di na reply coz deadline na
                            XtraMessageBox.Show("Deadline has expired", "Reply Blocked", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Can't connect to the remote server", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 4
0
        private void btnUpload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (ownerUserlvl.Equals("STUDENT"))
            {
                if (barEditItemArea.EditValue == null)
                {
                    XtraMessageBox.Show("Please select an area","No area selected",MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
                else
                {
                    if (openFileDialogMain.ShowDialog().Equals(DialogResult.OK))
                    {
                        List<string> fileDir = new List<string>(openFileDialogMain.FileNames);
                        string area = barEditItemArea.EditValue.ToString();
                        frmUpload upload = new frmUpload(ownerUID, ownerUserlvl, area, editorUID, editorUserlvl, string.Empty, string.Empty, string.Empty, fileDir, "USERFILE");
                        upload.Show();
                    }
                }
            }
            else
            {
                if (openFileDialogMain.ShowDialog().Equals(DialogResult.OK))
                {
                    List<string> fileDir = new List<string>(openFileDialogMain.FileNames);

                    frmUpload upload = new frmUpload(ownerUID, ownerUserlvl, ownerArea, editorUID, editorUserlvl, string.Empty, string.Empty, string.Empty, fileDir, "USERFILE");
                    upload.Show();
                }
            }
        }
Ejemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            ValidateControls();
            
            if (!errProv.HasErrors)
            {
                if (MySQLCommands.TestConnection())
                {
                    List<MySqlParameter> param = new List<MySqlParameter>();
                    param.Add(new MySqlParameter("@activity_title",txtTitle.Text));
                    param.Add(new MySqlParameter("@activity_message",memoEditMessage.Text));
                    param.Add(new MySqlParameter("@CID", CID));

                    if (!MySQLCommands.DoesExist("SELECT tbl_activity.activity_title FROM tbl_classactivity INNER JOIN tbl_activity ON tbl_classactivity.activity_id = tbl_activity.activity_id WHERE tbl_classactivity.CID = @CID and tbl_activity.activity_title = @activity_title and tbl_activity.status = 1", param))
                    {
                        long activity_id = new long();

                        if (cboDeadLine.Checked)
                        {
                            param.Add(new MySqlParameter("@deadtime", timeEditDeadline.Time.ToString("HH:mm:ss")));
                            param.Add(new MySqlParameter("@deaddate", dateEditDeadline.DateTime.ToString("yyyy-MM-dd")));

                            activity_id = MySQLCommands.Insert("insert into tbl_activity (activity_title,activity_message,activity_deadtime,activity_deaddate) values (@activity_title,@activity_message,@deadtime,@deaddate)", param);
                            param.Add(new MySqlParameter("@activity_id", activity_id));

                            MySQLCommands.Insert("insert into tbl_classactivity (activity_id,CID) values (@activity_id,@CID)", param);
                        }
                        else
                        {
                            activity_id = MySQLCommands.Insert("insert into tbl_activity (activity_title,activity_message) values (@activity_title,@activity_message)", param);
                            param.Add(new MySqlParameter("@activity_id", activity_id));

                            MySQLCommands.Insert("insert into tbl_classactivity (activity_id,CID) values (@activity_id,@CID)", param);
                        }

                        if (lstFiles.ItemCount > 0)
                        {
                            List<string> item = lstFiles.Items.Cast<String>().ToList();

                            frmUpload actFile = new frmUpload(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, activity_id.ToString(), string.Empty, item, "ACTFILE");
                            actFile.ShowDialog();
                        }
                        this.Close();
                    }
                    else
                    {
                        errProv.SetError(txtTitle, "This activity title is currently in use");
                    }
                }
                else
                {
                    XtraMessageBox.Show("Can't connect to the remote server", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Ejemplo n.º 6
0
        private void btnUpload_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (openFileDialogMain.ShowDialog().Equals(DialogResult.OK))
            {
                List<string> fileDir = new List<string>(openFileDialogMain.FileNames);

                frmUpload upload = new frmUpload(ownerUID, ownerUserlvl, ownerArea, editorUID, editorUserlvl, string.Empty, string.Empty, string.Empty, fileDir, "FILE");
                upload.Show();
            }
        }