Esempio n. 1
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;
            }
        }
 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;
            }
        }