protected void btnaddjob_Click(object sender, EventArgs e)
    {
        string UserID         = "";
        int    sCheckedUrgent = 0;

        if (checkurgent.Checked.ToString() == "true")
        {
            sCheckedUrgent = 1;
        }
        else
        {
            sCheckedUrgent = 0;
        }
        int jobID = 0;

        if (Request.QueryString["jobID"] != "")
        {
            jobID = Int32.Parse(Request.QueryString["jobID"].Substring(Request.QueryString["jobID"].Length - 7));
        }

        // string UserID = "";
        API.Service web = new API.Service();
        // API.Service web = new API.Service();
        XmlDocument dom1 = new XmlDocument();

        UserID = Session["UserID"].ToString();
        dom1.LoadXml("<XML>" + web.get_job_detail_id(Session["Email"].ToString(), Session["P@ss"].ToString(), jobID.ToString()).InnerXml + "</XML>");

        XmlNodeList Response1 = dom1.SelectNodes("XML/RESPONSE");
        string      detailid  = Response1.Item(0).SelectSingleNode("JOB_DETAIL_ID").InnerText;

        if (newdiv.Visible == true && markupdiv.Visible == false && permentdiv.Visible == false && divposition.Visible == true && divjobstart.Visible == false)
        {
            dom1.LoadXml("<XML>" + web.update_job(jobID.ToString(), detailid, ddljobStatus.Text,
                                                  txtjobtitle.Value, ddldepartment.Text, Convert.ToString(Session["ClientID"]),
                                                  ddlpositiontype.Text, txtnumberofopning.Value,
                                                  ddlvendor.Text, ddllocation.Text, txttraveltime.Value, txthoursperday.Value,
                                                  txtroles_and_responsibility.Text, txthiremanagername.Value, txtcoordinator.Value,
                                                  txtcontstart.Value, txtendstart.Value, 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", txtcomment.Text, "0", "0", "0", UserID, "0", "0", "0", "1").InnerXml + "</XML>");
        }
        else if (newdiv.Visible == false && markupdiv.Visible == true && permentdiv.Visible == false && divposition.Visible == true && divjobstart.Visible == false)
        {
            dom1.LoadXml("<XML>" + web.update_job(jobID.ToString(), detailid, ddljobStatus.Text,
                                                  txtjobtitle.Value, ddldepartment.Text, Convert.ToString(Session["ClientID"]),
                                                  ddlpositiontype.Text, txtnumberofopning.Value,
                                                  ddlvendor.Text, ddllocation.Text, txttraveltime.Value, txthoursperday.Value,
                                                  txtroles_and_responsibility.Text, txthiremanagername.Value, txtcoordinator.Value,
                                                  txtcontstart.Value, txtendstart.Value, 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",
                                                  txtcomment.Text, txtvendor_pay.Value, txtvendorot_pay.Value, txtvendordbl_pay.Value,
                                                  UserID, "0", "0", "0", "1").InnerXml + "</XML>");
        }
        else
        {
            dom1.LoadXml("<XML>" + web.update_job(jobID.ToString(), detailid, ddljobStatus.Text,
                                                  txtjobtitle.Value, ddldepartment.Text, Convert.ToString(Session["ClientID"]),
                                                  ddlpositiontype.Text, txtnumberofopning.Value,
                                                  ddlvendor.Text, ddllocation.Text, txttraveltime.Value, txthoursperday.Value,
                                                  txtroles_and_responsibility.Text, txthiremanagername.Value, txtcoordinator.Value,
                                                  txtjobstart.Value, "", 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",
                                                  txtcomment.Text, txtvendor_pay.Value, txtvendorot_pay.Value, txtvendordbl_pay.Value,
                                                  UserID, txtbouns.Value, txtbenifits.Text.Replace("'", "''"), txtbasesallary.Value, "1").InnerXml + "</XML>");
        }

        XmlNodeList Response = dom1.SelectNodes("XML/RESPONSE");

        if (Response.Item(0).SelectSingleNode("UPDATE_VALUE").InnerText == "1")
        {
            if (txtQuestion1.Text != "")
            {
                API.Service web1 = new API.Service();
                // localhost.Service web1 = new localhost.Service();
                XmlDocument dom2 = new XmlDocument();
                dom2.LoadXml("<XML>" + web1.update_jobrating(Session["Email"].ToString(), Session["P@ss"].ToString(), ddlvendor.Text, Session["ClientID"].ToString(), txtQuestion1.Text, txtRating1.Text, txtQuestion2.Text, txtRating2.Text, txtquestion3.Text, txtRating3.Text, txtquestion4.Text, txtRating4.Text, txtquestion5.Text, txtRating5.Text, UserID, jobID.ToString()).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 = dom2.SelectNodes("XML/RESPONSE");
                if (Response2.Item(0).SelectSingleNode("STATUS").InnerText == "1")
                {
                    lblTableData.Text = "New Job Added succcessfully";

                    //   lblTableData.Text = " Job updated succcessfully";
                    API.Service jobInfo = new API.Service();
                    XmlDocument xmldoc  = new XmlDocument();
                    xmldoc.LoadXml("<XML>" + jobInfo.get_Jobs(jobID.ToString(), Session["Email"].ToString(), Session["P@ss"].ToString(), ddlvendor.Text, Session["UserID"].ToString(), Session["ClientID"].ToString()).InnerXml + "</XML>");
                    XmlNodeList Response7  = xmldoc.SelectNodes("XML/RESPONSE/JOBS ");
                    string      jobtitle   = 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("*****@*****.**", " job upated by client " + Session["clientname"].ToString(), "<br>Client ID :" + Session["ClientID"].ToString() +
                                     "<br>Client Name :" + Session["clientname"].ToString() +
                                     "<br>jobId :" + jobID +
                                     "<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.", "", "");



                    HttpContext.Current.Response.Redirect("Client_Job_Details.aspx?jopen=Y&p=JV&jobID=" + Request.QueryString["jobID"] + "&u=y");
                }
            }
            else
            {
                lblTableData.Text = " rating not updated ";
            }
        }
        else
        {
            lblTableData.Text = " Job not updated ";
        }
    }