예제 #1
0
    protected void btnaddjob_Click(object sender, EventArgs e)
    {
        // localhost.Service web = new localhost.Service();
        API.Service web    = new API.Service();
        XmlDocument dom1   = new XmlDocument();
        string      UserID = "";


        int sCheckedUrgent = 0;

        if (checkurgent.Checked == true)
        {
            sCheckedUrgent = 1;
        }
        DateTime todayDate = DateTime.Today;

        // txtstd_pay_rate_from.Value = (Convert.ToInt32(txtdbl_pay_rate_from.Value) * (TextBox1.Text));

        UserID = Session["UserID"].ToString();

        if (newdiv.Visible == true && markupdiv.Visible == false && permentdiv.Visible == false && divposition.Visible == true && divjobstart.Visible == false)
        {
            dom1.LoadXml("<XML>" + web.set_jobs(ddljobStatus.Value, txtjobtitle.Value, ddldepartment.Value,
                                                Session["ClientID"].ToString(), ddlpositiontype.Value, txtnumberofopning.Value, ddlvendor.Value,
                                                ddllocation.Value, txttraveltime.Value, txthoursperday.Value, txtroles_and_responsibility.Text.Replace("'", "''"),
                                                txthiremanagername.Value, txtcoordinator.Value, txtcontstart.Value.ToString(), txtendstart.Value.ToString(),
                                                txtmaxsub.Value, ddlreasonforopen.SelectedValue, ddlinterviw.SelectedValue,
                                                sCheckedUrgent.ToString(), Session["Email"].ToString(), Session["P@ss"].ToString(),
                                                "0", ddlmove.SelectedValue, "0", txtst_bill_rate_from.Value, "0", "0",
                                                "0", "0", "0", UserID, "0", "0", "0", "0").InnerXml + "</XML>");
        }
        else if (newdiv.Visible == false && markupdiv.Visible == true && permentdiv.Visible == false && divposition.Visible == true && divjobstart.Visible == false)
        {
            dom1.LoadXml("<XML>" + web.set_jobs(ddljobStatus.Value, Server.HtmlEncode(txtjobtitle.Value), ddldepartment.Value,
                                                Session["ClientID"].ToString(), ddlpositiontype.Value, txtnumberofopning.Value, ddlvendor.Value,

                                                ddllocation.Value, txttraveltime.Value,
                                                txthoursperday.Value, Server.HtmlEncode(txtroles_and_responsibility.Text.Replace("'", "''")), txthiremanagername.Value, txtcoordinator.Value, txtcontstart.Value.ToString(), txtendstart.Value.ToString(),
                                                txtmaxsub.Value, ddlreasonforopen.SelectedValue, ddlinterviw.SelectedValue,
                                                sCheckedUrgent.ToString(), Session["Email"].ToString(), Session["P@ss"].ToString(),
                                                txtstd_pay_rate_from.Value, ddlmove.SelectedValue, txtmarkup.Value,
                                                "0", "0", "0", txtvendor_pay.Value, txtvendorot_pay.Value, txtvendordbl_pay.Value, UserID, "0", "0", "0", "0").InnerXml + "</XML>");
        }
        else
        {
            dom1.LoadXml("<XML>" + web.set_jobs(ddljobStatus.Value, txtjobtitle.Value, ddldepartment.Value,
                                                Session["ClientID"].ToString(), "3", txtnumberofopning.Value, ddlvendor.Value,
                                                ddllocation.Value, txttraveltime.Value, txthoursperday.Value, txtroles_and_responsibility.Text.Replace("'", "''"),
                                                txthiremanagername.Value, txtcoordinator.Value, txtjobstart.Value.ToString(), "",
                                                txtmaxsub.Value, ddlreasonforopen.SelectedValue, ddlinterviw.SelectedValue,
                                                sCheckedUrgent.ToString(), Session["Email"].ToString(), Session["P@ss"].ToString(),
                                                "0", ddlmove.SelectedValue, "0", "0", "0", "0",
                                                "0", "0", "0", UserID, txtbouns.Value, txtbenifits.Text.Replace("'", "''"), txtbasesallary.Value, "0").InnerXml + "</XML>");
        }
        XmlNodeList Response    = dom1.SelectNodes("XML/RESPONSE");
        string      job         = Response.Item(0).SelectSingleNode("JOB_ID").InnerText;
        string      jobdetailid = Response.Item(0).SelectSingleNode("JOB_DETAIL_ID").InnerText;

        Session["jobdeailID"] = jobdetailid;
        dom1.LoadXml("<XML>" + web.insert_job_comments(Session["Email"].ToString(), Session["P@ss"].ToString(), txtcomment.Text, Convert.ToInt32(job), todayDate, Convert.ToInt32(UserID)).InnerXml + "</XML>");
        XmlNodeList Response1 = dom1.SelectNodes("XML/RESPONSE");

        if (txtQuestion1 != null)
        {
            dom1.LoadXml("<XML>" + web.Insert_Jobquestions_ratings(Session["Email"].ToString(), Session["P@ss"].ToString(), ddlvendor.Value, Session["ClientID"].ToString(), txtQuestion1.Text, txtRating1.Text, txtQuestion2.Text, txtRating2.Text, txtquestion3.Text, txtRating3.Text, txtquestion4.Text, txtRating4.Text, txtquestion5.Text, txtRating5.Text, UserID, job).InnerXml + "</XML>");

            // dom1.LoadXml("<XML>" + web.Insert_Job_Questions(Session["Email"].ToString(), Session["P@ss"].ToString(), "0",   ddlvendor.DataValueField , Session["ClientID"].ToString(), txtQuestion1.Text, txtRating1.Text, txtQuestion2.Text, txtRating2.Text, txtquestion3.Text, txtRating3.Text, txtquestion4.Text, txtRating4.Text, txtquestion5.Text, txtRating5.Text, UserID, job).InnerXml + "</XML>");
            XmlNodeList Response2 = dom1.SelectNodes("XML/RESPONSE");
            if (Response2.Item(0).SelectSingleNode("DATA").InnerText != "")
            {
                lblTableData.Text = "New Job Added succcessfully";
            }
        }
        API.Service jobInfo = new API.Service();
        XmlDocument xmldoc  = new XmlDocument();

        xmldoc.LoadXml("<XML>" + jobInfo.preview_job(job, Session["Email"].ToString(), Session["P@ss"].ToString(), Session["VendorID"].ToString(), Session["UserID"].ToString(), Session["ClientID"].ToString()).InnerXml + "</XML>");
        XmlNodeList Response7  = xmldoc.SelectNodes("XML/RESPONSE/JOBS ");
        string      jobtitle   = func.FixString(Server.HtmlDecode(Response7[iResponse].SelectSingleNode("JOB_TITLE").InnerText));
        string      location   = Response7[iResponse].SelectSingleNode("JOB_LOCATION").InnerText;
        string      noofopning = Response7[iResponse].SelectSingleNode("NO_OF_OPENINGS").InnerText;
        string      desc       = Server.HtmlDecode(Response7[iResponse].SelectSingleNode("JOB_DESC").InnerText);

        semail.sendEmail("*****@*****.**", "New job added by client " + Session["clientname"].ToString(), "<br>Client ID :" + Session["ClientID"].ToString() +
                         "<br>Client Name :" + Session["clientname"].ToString() +
                         "<br>jobId :" + job +
                         "<br>job Title :" + jobtitle +
                         "<br>job Description :" + desc +
                         // "<br>location :" + location +
                         "<br>No of Openings :" + noofopning +
                         "<br><br>******" +
                         "<br>This notification was sent by FlentisPRO.If you have any questions regarding this notice," +
                         "<br>please contact the SAP Fieldglass Helpdesk at:" +
                         "<br>mailto:[email protected]" +
                         "<br>By Phone:" +
                         "<br>US(toll free) 1 800 123 1234" +
                         "<br>Please do not respond to this email, this is an automatic email message and this mailbox is not being monitored.", "", "");

        Session["clientname"] = "";



        dom1.LoadXml("<XML>" + web.get_job_alias(Session["Email"].ToString(), Session["P@ss"].ToString(), job.ToString()).InnerXml + "</XML>");

        XmlNodeList Response3 = dom1.SelectNodes("XML/RESPONSE");
        string      jobalias  = Response3.Item(0).SelectSingleNode("JOB_ALIAS").InnerText;
        string      end       = Response3.Item(0).SelectSingleNode("JOB_ID").InnerText;

        HttpContext.Current.Response.Redirect("Preview_job.aspx?jobId=" + jobalias);
        // Response.Redirect(");

        /* ******* SMS Notification ******* */
        SqlConnection conn;
        string        readsms;

        conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);
        try
        {
            if (conn.State == System.Data.ConnectionState.Closed)
            {
                conn.Open();
                string     smsquery = "select vendors from ovms_jobs where job_id = " + job;
                SqlCommand smscmd   = new SqlCommand(smsquery, conn);
                readsms = smscmd.ExecuteReader().ToString();

                string message             = jobtitle + "\n" + desc;
                ConvertPdf.converter files = new ConvertPdf.converter();
                files.client_smsNotification(readsms, message, Session["ClientID"].ToString(), "newjob_notify");

                smscmd.Dispose();
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        finally
        {
            conn.Close();
        }
    }