Esempio n. 1
0
        public bool GetCommand(List <DbUser> user, int stream_id)
        {
            FindUser      tempUser = new FindUser();
            IWriteCommand cmd      = new WriteCommand();
            DbUser        deluser  = new DbUser();
            bool          result   = false;

            try
            {
                string username = user[0].Username;
                deluser = tempUser.GetUserByUsername(username);
                if (deluser.UserId == 0)
                {
                    return(result);
                }
                else
                {
                    string cmdString = "sp_del_user_and_constraints(" + deluser.UserId + ")";
                    cmd.SetCommand(cmdString);

                    if (cmd.Execute())
                    {
                        Console.WriteLine(cmdString);
                        result = true;
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(result);
        }
Esempio n. 2
0
        public Guid SessionStart(int userId, int typeID)
        {
            // Create the Guid for the session
            Guid g = Guid.NewGuid();

            // Insert session info into database
            try
            {
                string        qry = "INSERT INTO SESSIONS (session_id, session_guid, User_id, Type_id) VALUES ( session_id_seq.NEXTVAL, '" + g.ToString() + "', " + userId.ToString() + ", " + typeID.ToString() + ")";
                IWriteCommand cmd = new WriteCommand();

                if (cmd.Execute(qry))
                {
                    return(g);
                }
                else
                {
                    return(Guid.Empty);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(Guid.Empty);
            }
        }
Esempio n. 3
0
        private void AddJobBtn_Click(object sender, EventArgs e)
        {
            if (DescriptionTxtbox.Text == "")
            {
                DesManLbl.Visible = true;
            }

            if (TitleTxtbox.Text == "")
            {
                TitManLbl.Visible = true;
            }

            if (CompanyTxtbox.Text == "")
            {
                ComManLbl.Visible = true;
            }
            if (CompanyTxtbox.Text == "")
            {
                LocManLbl.Visible = true;
            }
            else
            {
                string stream_id = (StreamComBox.SelectedIndex + 1).ToString();
                string status_id = (StatusComBox.SelectedIndex + 1).ToString();
                string description = DescriptionTxtbox.Text;
                string title = TitleTxtbox.Text;
                string deadline = DeadlinedatePicker1.Value.ToString();
                string company = CompanyTxtbox.Text;
                string location = LocTxtbox.Text;
                DesManLbl.Visible = false;
                TitManLbl.Visible = false;
                ComManLbl.Visible = false;
                LocManLbl.Visible = false;
                string addJobQry = "INSERT INTO JobPost (Job_id, User_id, Stream_id, Status_id, Description, " +
                                        "Title, DatePosted, Deadline, Company, Location) VALUES (job_id_seq.nextval, 6, " +
                                         stream_id + ", " +
                                         status_id + ", " +
                                         description + ", " +
                                         title +
                                        ", SYSDATE, " +
                                         deadline +
                                        ", " + company + ", " +
                                        location;
                IWriteCommand cmd = new WriteCommand();
                if (cmd.Execute(addJobQry))
                {
                    DescriptionTxtbox.Text = "";
                    TitleTxtbox.Text = "";
                    CompanyTxtbox.Text = "";
                    CompanyTxtbox.Text = "";
                }
                else
                {
                    JobMsgLbl.Text = "Adding Job Failed.";
                    JobMsgLbl.ForeColor = Color.Red;
                }
                JobMsgLbl.Visible = true;
            }
        }
Esempio n. 4
0
        public bool GetCommand(List <string> skills, int skill_id)
        {
            IWriteCommand cmd = new WriteCommand();

            foreach (string skill in skills)
            {
                string cmdString = "sp_add_jobSkill(" + skill_id + ")";

                cmd.SetCommand(cmdString);
                cmd.Execute();
            }

            if (cmd.Execute() == true)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
        public bool GetCommand(List <DbJob> obj, int stream_id)
        {
            string cmdString = "UPDATE JOBPOST SET jobpost.user_id =" + obj[0].UserId
                               + " WHERE jobpost.job_id = " + obj[0].JobId;
            IWriteCommand cmd = new WriteCommand();

            if (cmd.Execute(cmdString))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
        public bool GetCommand(List <DbUser> user, int stream_id)
        {
            string cmdString = "sp_add_user(" + user[0].TypeId + ",'" + user[0].Username + "','" +
                               user[0].Password + "','" +
                               user[0].FirstName + "','" + user[0].LastName + "','" + user[0].Email + "','" +
                               user[0].Location + "'," + stream_id + ")";
            IWriteCommand cmd = new WriteCommand();

            cmd.SetCommand(cmdString);

            if (cmd.Execute())
            {
                return(true);
            }
            return(false);
        }
 public bool EndSession(Guid sessionId)
 {
     try
     {
         string qry = "DELETE FROM Sessions WHERE session_guid = '" + sessionId.ToString() + "'";
         IWriteCommand cmd = new WriteCommand();
         if (cmd.Execute(qry))
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return false;
     }
 }
Esempio n. 8
0
 public bool EndSession(Guid sessionId)
 {
     try
     {
         string        qry = "DELETE FROM Sessions WHERE session_guid = '" + sessionId.ToString() + "'";
         IWriteCommand cmd = new WriteCommand();
         if (cmd.Execute(qry))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
        public Guid SessionStart(int userId, int typeID)
        {
            // Create the Guid for the session
            Guid g = Guid.NewGuid();

            // Insert session info into database
            try
            {
                string qry = "INSERT INTO SESSIONS (session_id, session_guid, User_id, Type_id) VALUES ( session_id_seq.NEXTVAL, '" + g.ToString() + "', " + userId.ToString() + ", " + typeID.ToString() + ")";
                IWriteCommand cmd = new WriteCommand();

                if (cmd.Execute(qry))
                {
                    return g;
                }
                else
                {
                    return Guid.Empty;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return Guid.Empty;
            }
        }