using System.Runtime.Serialization;
using System;

[DataContract]
public class ClsEmployeeListing
{

    //string varClinicID;
    //string varClinicName;
    //string varClinicAddress;
    //string varclinicOperatingHours;

    [DataMember]
    public string EmployeePhone { get; set; }
    [DataMember]
    public string EmployeeEmail { get; set; }
    [DataMember]
    public string EmployeeName { get; set; }
    [DataMember]
    public string EmployeeID { get; set; }

    public ClsEmployeeListing(Int32 Eid, string Ename, string Eemail, string Ephone)
    {
        EmployeeID = Eid.ToString(); ;
        EmployeeName = Ename;
        EmployeeEmail = Eemail;
        EmployeePhone = Ephone;
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.SqlClient;

namespace EmployeeDemo
{
     [System.ServiceModel.Activation.AspNetCompatibilityRequirements(RequirementsMode = System.ServiceModel.Activation.AspNetCompatibilityRequirementsMode.Allowed)]

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "EmployeeServices" in code, svc and config file together.
    public class EmployeeServices : IEmployeeServices
    {



         public List<ClsEmployeeListing> GetEmployeeListing()
        {
            List<ClsEmployeeListing> mylist = new List<ClsEmployeeListing>();

            using (SqlConnection conn = new SqlConnection("server=WINDOWS7PC\\SQLEXPRESS;database=EmployeeDB;Persist Security Info=True;User ID=Appuser;Password=Prasad78;"))
            {
                conn.Open();
                string cmdStr = String.Format("Select EmployeeID,EmployeeName,EmployeeEmail,EmployeePhone from Employees");
                SqlCommand cmd = new SqlCommand(cmdStr, conn);
                SqlDataReader rd = cmd.ExecuteReader();

                if (rd.HasRows)
                {
                    while (rd.Read())
                    {
                        mylist.Add(new ClsEmployeeListing(rd.GetInt32(0), rd.GetString(1), rd.GetString(2), rd.GetString(3)));

                    }
                }
                conn.Close();
            }

            return mylist;
        }




    }

}








using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;

namespace EmployeeDemo
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IEmployeeServices" in both code and config file together.
    [ServiceContract]
    public interface IEmployeeServices
    {
        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Wrapped,
            UriTemplate = "EmployeeList")]

        List<ClsEmployeeListing> GetEmployeeListing();


    }
}

http://wrvishnu.wordpress.com/category/wcf/

how can i get the inputed data from the iphone like the employeeid?

public List<ClsEmployeeListing> GetEmployeeListing()
            {
                List<ClsEmployeeListing> mylist = new List<ClsEmployeeListing>();

                using (SqlConnection conn = new SqlConnection("server=WINDOWS7PC\\SQLEXPRESS;database=EmployeeDB;Persist Security Info=True;User ID=Appuser;Password=Prasad78;"))
                {
                    conn.Open();
                    string cmdStr = String.Format("Select EmployeeID,EmployeeName,EmployeeEmail,EmployeePhone from Employees where employeeid='"+datafromiphone+"'");
                    SqlCommand cmd = new SqlCommand(cmdStr, conn);
                    SqlDataReader rd = cmd.ExecuteReader();

                    if (rd.HasRows)
                    {
                        while (rd.Read())
                        {
                            mylist.Add(new ClsEmployeeListing(rd.GetInt32(0), rd.GetString(1), rd.GetString(2), rd.GetString(3)));

                        }
                    }
                    conn.Close();
                }

                return mylist;
            }

anyone have ideas or sample that i can try on what i want is to get the data inputed from the iphone so i can use it in login i dont like inputing it on the url is there anyway?

Related posts

Recent Viewed