예제 #1
0
        public Guid AddClientInformation(ClientInformation ClientInformation)
        {
            Guid          ClientInformationID = new Guid("00000000-0000-0000-0000-000000000000");
            SqlConnection con = new SqlConnection(GlobalSettings.connection);

            con.Open();
            SqlCommand Cmd = new SqlCommand("sp_AddClientInformation", con);

            Cmd.CommandType = System.Data.CommandType.StoredProcedure;
            Cmd.Parameters.AddWithValue("@Title", ClientInformation.Title);
            Cmd.Parameters.AddWithValue("@Name", ClientInformation.Name);
            Cmd.Parameters.AddWithValue("@MiddleName", ClientInformation.MiddleName);
            Cmd.Parameters.AddWithValue("@Surname", ClientInformation.Surname);
            Cmd.Parameters.AddWithValue("@Gender", ClientInformation.Gender);
            Cmd.Parameters.AddWithValue("@DateOfBirth", DataTypesConvertor.ConvertToDateTime(ClientInformation.DateOfBirth));
            Cmd.Parameters.AddWithValue("@IDNumber", ClientInformation.IDNumber);
            Cmd.Parameters.AddWithValue("@Cell", ClientInformation.Cell);
            Cmd.Parameters.AddWithValue("@TelHome", ClientInformation.TelHome);
            Cmd.Parameters.AddWithValue("@TelWork", ClientInformation.TelWork);
            Cmd.Parameters.AddWithValue("@Email", ClientInformation.Email);
            Cmd.Parameters.AddWithValue("@StreetNameAndNumber", ClientInformation.StreetNameAndNumber);
            Cmd.Parameters.AddWithValue("@Suburb", ClientInformation.Suburb);
            Cmd.Parameters.AddWithValue("@City", ClientInformation.City);
            Cmd.Parameters.AddWithValue("@PostalCode", ClientInformation.PostalCode);
            SqlDataReader dr = Cmd.ExecuteReader();

            while (dr.Read())
            {
                ClientInformationID = DataTypesConvertor.ConvertToGuid(dr["ClientInformationID"].ToString());
            }
            dr.Close();
            con.Close();
            return(ClientInformationID);
        }
예제 #2
0
        public List <ClientInformation> GetAllClientInformation()
        {
            List <ClientInformation> ClientInformationDataList = new List <ClientInformation>();

            SqlConnection con = new SqlConnection(GlobalSettings.connection);

            con.Open();
            SqlCommand Cmd = new SqlCommand("sp_GetAllClientInformation", con);

            Cmd.CommandType = System.Data.CommandType.StoredProcedure;

            SqlDataReader dr = Cmd.ExecuteReader();

            while (dr.Read())
            {
                ClientInformation ClientInformation = new ClientInformation();
                ClientInformation.ClientInformationID = DataTypesConvertor.ConvertToGuid(dr["ClientInformationID"].ToString());
                ClientInformation.Title               = dr["Title"].ToString();
                ClientInformation.Name                = dr["Name"].ToString();
                ClientInformation.MiddleName          = dr["MiddleName"].ToString();
                ClientInformation.Surname             = dr["Surname"].ToString();
                ClientInformation.Gender              = dr["Gender"].ToString();
                ClientInformation.DateOfBirth         = DataTypesConvertor.ConvertToDateTime(dr["DateOfBirth"].ToString());
                ClientInformation.IDNumber            = dr["IDNumber"].ToString();
                ClientInformation.Cell                = dr["Cell"].ToString();
                ClientInformation.TelHome             = dr["TelHome"].ToString();
                ClientInformation.TelWork             = dr["TelWork"].ToString();
                ClientInformation.Email               = dr["Email"].ToString();
                ClientInformation.StreetNameAndNumber = dr["StreetNameAndNumber"].ToString();
                ClientInformation.Suburb              = dr["Suburb"].ToString();
                ClientInformation.City                = dr["City"].ToString();
                ClientInformation.PostalCode          = dr["PostalCode"].ToString();

                ClientInformationDataList.Add(ClientInformation);
            }
            dr.Close();
            con.Close();


            return(ClientInformationDataList);
        }