示例#1
0
        public response GetMothersHelpersTypeUsers(int id)
        {
            var dataTable = new DataTable();

            dataTable = new DataTable {
                TableName = "MothersHelpers"
            };
            //var conString1 = ConfigurationManager.ConnectionStrings["LocalEvolution"];
            //string connString = conString1.ConnectionString;
            string connString = URLInfo.GetDataBaseConnectionString();


            System.IO.StringWriter writer = new System.IO.StringWriter();
            string   returnString         = "";
            response response             = new response();

            response.result = 0;
            using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connString))
            {
                using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("GetMothersHelpersTypeUsers", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@ID", SqlDbType.NVarChar).Value = id;
                    con.Open();
                    var dataReader = cmd.ExecuteReader();
                    dataTable.Load(dataReader);
                    dataTable.WriteXml(writer, XmlWriteMode.WriteSchema, false);
                    returnString = writer.ToString();
                    int numberOfRecords = dataTable.Rows.Count;
                    response.result = numberOfRecords;



                    MothersHelpersList list = new MothersHelpersList();
                    foreach (DataRow row in dataTable.Rows)
                    {
                        mothersHelpers myprod = new mothersHelpers();
                        myprod.ID   = row["ID"].ToString();
                        myprod.Name = row["Name"].ToString();


                        list.mothersHelpersLists.Add(myprod);
                    }
                    response.AddMothersHelpersList(list);

                    response.log.Add(numberOfRecords + " Records found");
                }
            }
            return(response);
        }
示例#2
0
 public IList AddMothersHelpersList(MothersHelpersList list)
 {
     data.Add(list);
     return(data);
 }