コード例 #1
0
        notificationsResponse INotificationBinding.notifications(notifications notifications1)
        {
            try
            {

                SforceService.SforceService client = new SforceService.SforceService();
                client.Url = notifications1.EnterpriseUrl;
                client.SessionHeaderValue = new SforceService.SessionHeader();
                client.SessionHeaderValue.sessionId = notifications1.SessionId;

                List<SforceService.Opportunity> Opps = new List<SforceService.Opportunity>();
                foreach (OpportunityNotification item in notifications1.Notification)
                {
                    SforceService.Opportunity Opp = new SforceService.Opportunity();
                    Opp.Id = item.sObject.Id;
                    Opp.TrackingNumber__c = "Tracking Number (WF .NET) - " + item.Id;
                    Opps.Add(Opp);
                }

                if (Opps.Count > 0)
                {
                    client.update(Opps.ToArray());
                }

            }
            catch (Exception Ex)
            {
                ddebug("Exception: " + Ex.Message);
            }
            notificationsResponse response = new notificationsResponse();
            response.Ack = true;
            return response;
        }
コード例 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "";

            if (string.IsNullOrWhiteSpace(OppID.ID)) {
                Label1.Text = "Please provide a Salesforce Opportunity ID";
                return;
            }

            try
            {
                // A valid SFDC Session needs to exist
                SforceService.SforceService sfdc = new SforceService.SforceService();
                SforceService.LoginResult lr = sfdc.login("", "");

                ApexTracker.TrackerService client = new ApexTracker.TrackerService();
                client.SessionHeaderValue = new ApexTracker.SessionHeader();
                client.SessionHeaderValue.sessionId = lr.sessionId;
                string Tracker = client.GetTrackingNbr(OppID.Text);
                Label1.Text = "Tracking number is " + Tracker;
            }
            catch (Exception Ex)
            {
                Label1.Text = "Something went wrong... (" + Ex.Message + ")";
            }
        }
コード例 #3
0
ファイル: ApexWS.aspx.cs プロジェクト: Qalander/Salesforce
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "";

            if (string.IsNullOrWhiteSpace(OppID.ID))
            {
                Label1.Text = "Please provide a Salesforce Opportunity ID";
                return;
            }

            try
            {
                // A valid SFDC Session needs to exist
                SforceService.SforceService sfdc = new SforceService.SforceService();
                SforceService.LoginResult   lr   = sfdc.login("", "");

                ApexTracker.TrackerService client = new ApexTracker.TrackerService();
                client.SessionHeaderValue           = new ApexTracker.SessionHeader();
                client.SessionHeaderValue.sessionId = lr.sessionId;
                string Tracker = client.GetTrackingNbr(OppID.Text);
                Label1.Text = "Tracking number is " + Tracker;
            }
            catch (Exception Ex)
            {
                Label1.Text = "Something went wrong... (" + Ex.Message + ")";
            }
        }
コード例 #4
0
ファイル: Tracker.asmx.cs プロジェクト: Qalander/Salesforce
        notificationsResponse INotificationBinding.notifications(notifications notifications1)
        {
            try
            {
                SforceService.SforceService client = new SforceService.SforceService();
                client.Url = notifications1.EnterpriseUrl;
                client.SessionHeaderValue           = new SforceService.SessionHeader();
                client.SessionHeaderValue.sessionId = notifications1.SessionId;

                List <SforceService.Opportunity> Opps = new List <SforceService.Opportunity>();
                foreach (OpportunityNotification item in notifications1.Notification)
                {
                    SforceService.Opportunity Opp = new SforceService.Opportunity();
                    Opp.Id = item.sObject.Id;
                    Opp.TrackingNumber__c = "Tracking Number (WF .NET) - " + item.Id;
                    Opps.Add(Opp);
                }

                if (Opps.Count > 0)
                {
                    client.update(Opps.ToArray());
                }
            }
            catch (Exception Ex)
            {
                ddebug("Exception: " + Ex.Message);
            }
            notificationsResponse response = new notificationsResponse();

            response.Ack = true;
            return(response);
        }
コード例 #5
0
        protected void fnSearch()
        {
            string strSearchString = "Jeff";

            String strActivityTable = "";
            String strContactTable = "";

            if (strSearchString != "")
            {
                try
                {
                    using (SforceService.SforceService sfs = new SforceService.SforceService())
                    {
                        var login = sfs.login("*****@*****.**", sfsecret);

                        if (login.passwordExpired)
                        {
                            Response.Write("Salesforce password expired!");
                        }
                        else
                        {
                            sfs.Url = login.serverUrl;
                            sfs.SessionHeaderValue = new SforceService.SessionHeader();
                            sfs.SessionHeaderValue.sessionId = login.sessionId;
                            var userinfo = login.userInfo;

                            String soqlQuery = "";
                            SforceService.QueryResult qResult = null;
                            soqlQuery = "SELECT Id, FirstName, LastName, Phone, Email FROM Contact WHERE FirstName='" + strSearchString + "'";

                            qResult = sfs.query(soqlQuery);
                            Boolean done = false;

                            if (qResult.size > 0)
                            {
                                strContactTable = strContactTable + ("<div style=\"position:absolute; left: 400px; top: 190px;\">");
                                strContactTable = strContactTable + ("<table border=1 bgcolor=silver style=\"border-collapse:collapse;\">");
                                //Response.Write("<th>Id</th>");
                                strContactTable = strContactTable + ("<th>First Name</th>");
                                strContactTable = strContactTable + ("<th>Last Name</th>");
                                strContactTable = strContactTable + ("<th>Phone</th>");
                                strContactTable = strContactTable + ("<th>Email</th>");
                                while (!done)
                                {
                                    SforceService.sObject[] records = qResult.records;
                                    for (int i = 0; i < records.Length; ++i)
                                    {

                                        SforceService.Contact con = (SforceService.Contact)records[i];
                                        strContactTable = strContactTable + ("<tr>");

                                        //Response.Write("<td>");
                                        //Response.Write(con.Id);
                                        //Response.Write("</td>");

                                        //#####################################################################

                                        /*if (i == 0)
                                        {

                                            //Looking at this i dont think i need to actually even run this? I should just be able to drop con.ID in the fnActivitySelect below and it should work? I'm going to piggy back off this query though to put customer ID into session state
                                            String strSqlId = fnSqlSelect(con.Id)[0].ToString();
                                            Session["sfID"] = con.Id;
                                            if (strSqlId != "")
                                            {

                                                strActivityTable = strActivityTable + (fnActivitySelect(strSqlId));

                                            }
                                        }*/

                                        //#######################################################
                                        strContactTable = strContactTable + ("<td>");
                                        strContactTable = strContactTable + (con.FirstName);
                                        strContactTable = strContactTable + ("</td>");
                                        strContactTable = strContactTable + ("<td>");
                                        strContactTable = strContactTable + (con.LastName);
                                        strContactTable = strContactTable + ("</td>");
                                        strContactTable = strContactTable + ("<td>");
                                        strContactTable = strContactTable + (con.Phone);
                                        strContactTable = strContactTable + ("</td>");
                                        strContactTable = strContactTable + ("<td>");
                                        strContactTable = strContactTable + (con.Email);
                                        strContactTable = strContactTable + ("</td");
                                        strContactTable = strContactTable + ("</tr>");

                                    }
                                    if (qResult.done)
                                    {
                                        done = true;
                                    }
                                    else
                                    {
                                        //qResult = sfs.queryMore(qResult.queryLocator);
                                    }
                                }
                                strContactTable = strContactTable + ("</table>");
                                strContactTable = strContactTable + ("</div>");

                                Response.Write(strContactTable);
                                Response.Write(strActivityTable);
                                Session["strContactTable"] = strContactTable;
                                Session["strActivityTable"] = strActivityTable;

                            }
                            else
                            {
                                Response.Write("No records found.");
                            }
                            //Response.Write("\nQuery succesfully executed.");

                        }
                    }
                }
                catch
                {
                    Response.Write("Query Finally!");
                }

                /*catch (k)
                {
                    Response.Write("Query Failed!");
                    throw k;
                }*/
            }
            else
            {
                Response.Write("Search Field Empty!");
            }
        }
コード例 #6
0
        protected void fnSearchROE()
        {
            string strSearchString = "JeffsAwesomeBusiness";

            try
            {
                using (SforceService.SforceService sfs = new SforceService.SforceService())
                {
                    var login = sfs.login("*****@*****.**", sfsecret + "KihwNiN0uRiuKqCx8W8A0ZDBk");

                    if (login.passwordExpired)
                    {
                        Response.Write("Salesforce password expired!");
                    }
                    else
                    {
                        sfs.Url = login.serverUrl;

                        sfs.SessionHeaderValue = new SforceService.SessionHeader();
                        sfs.SessionHeaderValue.sessionId = login.sessionId;
                        var userinfo = login.userInfo;

                        String soqlQuery = "";
                        SforceService.QueryResult qResult = null;
                        soqlQuery = "SELECT Name, BillingAddress FROM Account WHERE Name='" + strSearchString + "'";

                        qResult = sfs.query(soqlQuery);
                        Boolean done = false;

                        if (qResult.size > 0)
                        {

                            while (!done)
                            {
                                SforceService.sObject[] records = qResult.records;
                                for (int i = 0; i < records.Length; ++i)
                                {

                                    SforceService.Account Acc = (SforceService.Account)records[i];

                                    //Savvis Specific

                                    Response.Write(Acc.Name);
                                    Response.Write("<br>");

                                    //Response.Write(Acc.BillingAddress.street);
                                    //Response.Write("<br>");
                                    Response.Write(Acc.BillingAddress.city);
                                    Response.Write(",");
                                    Response.Write(Acc.BillingAddress.state);
                                    //Response.Write(" ");
                                    //Response.Write(Acc.BillingAddress.postalCode);
                                    //Response.Write(Acc.BillingAddress.country);
                                    Response.Write("<br>");
                                    Response.Write("<br>");

                                }
                                if (qResult.done)
                                {
                                    done = true;
                                }
                                else
                                {
                                    //qResult = sfs.queryMore(qResult.queryLocator);
                                }
                            }

                        }
                        else
                        {
                            Response.Write("No records found.");
                        }
                    }
                }
            }
            catch (WebException k)
            {
                Response.Write(k);
            }
        }
コード例 #7
0
        protected void fnSearchROE(string strSoql)
        {
            if (txtPassword.Text != "")
            {
                try
                {
                    using (SforceService.SforceService sfs = new SforceService.SforceService())
                    {

                        var login = sfs.login("*****@*****.**", txtPassword.Text + "eBZ2NqwgBq5PEZx0YZT1yO64");

                        if (login.passwordExpired)
                        {
                            Response.Write("Salesforce password expired!");
                        }
                        else
                        {
                            sfs.Url = login.serverUrl;

                            sfs.SessionHeaderValue = new SforceService.SessionHeader();
                            sfs.SessionHeaderValue.sessionId = login.sessionId;
                            var userinfo = login.userInfo;

                            SforceService.QueryResult qResult = null;

                            qResult = sfs.query(strSoql);
                            Boolean done = false;

                            if (qResult.size > 0)
                            {

                                Response.Write("<table border=1>");
                                Response.Write("<tr>");
                                Response.Write("<th>Name</th><th>Status</th><th>Owner</th><th>City</th><th>State</th>");
                                Response.Write("</tr>");
                                while (!done)
                                {
                                    SforceService.sObject[] records = qResult.records;
                                    for (int i = 0; i < records.Length; ++i)
                                    {
                                        Response.Write("<tr>");
                                        SforceService.Account Acc = (SforceService.Account)records[i];
                                        Response.Write("<td>");
                                        Response.Write("<b>");
                                        Response.Write(Acc.Name);
                                        Response.Write("</td>");
                                        Response.Write("<td>");
                                        Response.Write("</b>");
                                        Response.Write(Acc.Prospecting_Status__c);
                                        Response.Write("</td>");
                                        Response.Write("<td>");
                                        Response.Write(Acc.Owner.Name);
                                        Response.Write("</td>");
                                        Response.Write("<td>");
                                        Response.Write(Acc.BillingAddress.city);
                                        Response.Write("</td>");
                                        Response.Write("<td>");
                                        Response.Write(Acc.BillingAddress.state);
                                        Response.Write("</td>");
                                        Response.Write("</tr>");
                                    }
                                    if (qResult.done)
                                    {
                                        done = true;
                                    }
                                }
                                Response.Write("</table>");

                            }
                            else
                            {
                                Response.Write("No records found.");
                            }
                        }
                    }
                }
                catch (WebException k)
                {
                    Response.Write(k);
                }
            }
            else
            {
                Response.Write("No Password!");
            }
        }
コード例 #8
0
        protected void fnSfUpdateLocalDb()
        {
            List<string> lstId = new List<string>();
            List<string> lstFName = new List<string>();
            List<string> lstLName = new List<string>();
            //List<string> lstPhone = new List<string>();
            List<string> lstDbId = new List<string>();

            try
            {
                using (SforceService.SforceService sfs = new SforceService.SforceService())
                {
                    var login = sfs.login("*****@*****.**", sfsecret);

                    if (login.passwordExpired)
                    {
                        Response.Write("Salesforce password expired!");
                    }
                    else
                    {
                        sfs.Url = login.serverUrl;
                        sfs.SessionHeaderValue = new SforceService.SessionHeader();
                        sfs.SessionHeaderValue.sessionId = login.sessionId;
                        var userinfo = login.userInfo;

                        String soqlQuery = "";
                        SforceService.QueryResult qResult = null;
                        soqlQuery = "SELECT Id, FirstName, LastName, Phone, Email FROM Contact";

                        qResult = sfs.query(soqlQuery);
                        Boolean done = false;

                        if (qResult.size > 0)
                        {
                            while (!done)
                            {
                                SforceService.sObject[] records = qResult.records;
                                for (int i = 0; i < records.Length; ++i)
                                {
                                    SforceService.Contact con = (SforceService.Contact)records[i];
                                    lstId.Add(con.Id);
                                    lstFName.Add(con.FirstName);
                                    lstLName.Add(con.LastName);
                                    //lstPhone.Add(con.Phone);
                                }
                                if (qResult.done)
                                {
                                    done = true;
                                }
                                else
                                {
                                    qResult = sfs.queryMore(qResult.queryLocator);
                                }
                            }
                        }
                        else
                        {
                            Response.Write("No records found.");
                        }
                        Response.Write("\nQuery succesfully executed.");
                    }
                }

            }
            catch (WebException k)
            {
                Response.Write("Query Failed!");
                throw k;
            }

            lstDbId = fnSqlSelect("");

            Boolean blnMatch = false;
            for (int i = 0; i < lstId.Count(); i++)
            {
                for (int ii = 0; ii < lstDbId.Count(); ii++)
                {
                    if (lstId[i].ToString() == lstDbId[ii].ToString())
                    {
                        blnMatch = true;
                    }
                }
                if (blnMatch == false)
                {
                    fnSqlInsert(lstId[i].ToString(), lstFName[i].ToString(), lstLName[i].ToString());
                    blnMatch = false;
                }
                else
                {
                    blnMatch = false;
                }
            }
        }