public JObject WebContactsList(string sConnString, int userID, int mode, int listId, int source, int pageIndex, string alphabetSort, string searchValue) { JObject responseJObj = new JObject(); DataSet ds = new DataSet(); JObject contactJobj = new JObject(); JObject listJobj = new JObject(); JObject contactListJobj = new JObject(); JArray Jarr = new JArray(); JArray JarrList = new JArray(); JArray JarrContactList = new JArray(); int returnValue = 0; string returnMessage = ""; int pageCount = 0; try { DataAccessLayer.V_1_3.Contacts_V130 contactsObj = new DataAccessLayer.V_1_3.Contacts_V130(sConnString); ds = contactsObj.WebContactsList(userID, mode, listId, source, pageIndex, alphabetSort, searchValue, out returnValue, out returnMessage, out pageCount); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow _row in ds.Tables[0].Rows) { contactJobj = new JObject(); foreach (DataColumn _column in ds.Tables[0].Columns) { contactJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); } Jarr.Add(contactJobj); } } if (mode == 1) { if (ds.Tables[1].Rows.Count > 0) { foreach (DataRow _row in ds.Tables[1].Rows) { listJobj = new JObject(); foreach (DataColumn _column in ds.Tables[1].Columns) { listJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); } JarrList.Add(listJobj); } } //if (Ds.Tables[3].Rows.Count > 0) //{ // foreach (DataRow _row in Ds.Tables[3].Rows) // { // contactListJobj = new JObject(); // foreach (DataColumn _column in Ds.Tables[3].Columns) // { // contactListJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); // } // JarrContactList.Add(contactListJobj); // } //} } responseJObj = new JObject(new JProperty("Success", true), new JProperty("Message", returnMessage), new JProperty("Status", returnValue), new JProperty("contactsData", Jarr), new JProperty("contactListDetails", JarrList), new JProperty("contactListData", JarrContactList)); } catch (Exception ex) { Logger.ExceptionLog("exception in WebContactsList Bll " + ex.ToString()); responseJObj = new JObject(new JProperty("success", false), new JProperty("message", "No contatcs found")); } return(responseJObj); }
public JObject WebContactsList(string sConnString, int userID, int listId, int pageIndex) { JObject responseJObj = new JObject(); DataSet ds = new DataSet(); JObject contactJobj = new JObject(); JObject listJobj = new JObject(); JObject contactListJobj = new JObject(); JArray Jarr = new JArray(); JArray JarrList = new JArray(); JArray JarrContactList = new JArray(); int returnValue = 0; string returnMessage = ""; int pageCount = 0, allContactsCount = 0; try { DataAccessLayer.V_1_3.Contacts_V130 contactsObj = new DataAccessLayer.V_1_3.Contacts_V130(sConnString); ds = contactsObj.WebContactsList(userID, listId, pageIndex, out returnValue, out returnMessage, out pageCount, out allContactsCount); if (returnValue == 1) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow _row in ds.Tables[0].Rows) { contactJobj = new JObject(); foreach (DataColumn _column in ds.Tables[0].Columns) { contactJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); } Jarr.Add(contactJobj); } } if (ds.Tables[1].Rows.Count > 0) { foreach (DataRow _row in ds.Tables[1].Rows) { listJobj = new JObject(); foreach (DataColumn _column in ds.Tables[1].Columns) { listJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); } JarrList.Add(listJobj); } } if (ds.Tables[3].Rows.Count > 0) { foreach (DataRow _row in ds.Tables[3].Rows) { contactListJobj = new JObject(); foreach (DataColumn _column in ds.Tables[3].Columns) { contactListJobj.Add(new JProperty(_column.ColumnName, _row[_column.ColumnName])); } JarrContactList.Add(contactListJobj); } } responseJObj = new JObject(new JProperty("Success", true), new JProperty("Message", returnMessage), new JProperty("ErrorCode", "117"), new JProperty("Status", returnValue), new JProperty("AllContactsCount", allContactsCount), new JProperty("pageCount", pageCount), new JProperty("Items", Jarr), new JProperty("ContactList", JarrList), new JProperty("Data", JarrContactList)); } } catch (Exception ex) { Logger.ExceptionLog("exception in WebContactsList Bll " + ex.ToString()); responseJObj = new JObject(new JProperty("Success", false), new JProperty("Message", "No contatcs found"), new JProperty("ErrorCode", "101")); } return(responseJObj); }