protected void GetServiceList() { try { Reply objReply = new Reply(); WebClient client = new WebClient(); client.Headers[HttpRequestHeader.ContentType] = "text/json"; string result = client.UploadString(URL + "/GetServiceList", "POST", ""); MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result)); DataContractJsonSerializer objJsonSerRecv = new DataContractJsonSerializer(typeof(Reply)); objReply = (Reply)objJsonSerRecv.ReadObject(memstrToReceive); if (objReply.Result == true) { if (objReply.DS.Tables[0].Rows.Count != 0) { DataTable dt = new DataTable(); dt.Columns.Add("S No"); dt.Columns.Add("Service"); dt.Columns.Add("Status"); dt.Columns.Add("pk_SM_Id"); for (int i = 0; i < objReply.DS.Tables[0].Rows.Count; i++) { DataRow row = dt.NewRow(); row["Service"] = objReply.DS.Tables[0].Rows[i]["ServiceName"].ToString(); row["Status"] = objReply.DS.Tables[0].Rows[i]["Status"].ToString(); row["pk_SM_Id"] = objReply.DS.Tables[0].Rows[i]["pk_SM_Id"].ToString(); dt.Rows.Add(row); } GV_ServiceList.DataSource = dt; GV_ServiceList.DataBind(); } } } catch (Exception ex) { Log.Write("Exception in GetUserList Error :- " + ex.ToString(), ""); } }
protected void GetServiceList() { try { Reply objReply = new Reply(); WebClient client = new WebClient(); client.Headers[HttpRequestHeader.ContentType] = "text/json"; string JsonString = JsonConvert.SerializeObject("Status"); string result = client.UploadString(URL + "/GetServiceList", "POST", JsonString); MemoryStream memstrToReceive = new MemoryStream(Encoding.UTF8.GetBytes(result)); DataContractJsonSerializer objJsonSerRecv = new DataContractJsonSerializer(typeof(Reply)); objReply = (Reply)objJsonSerRecv.ReadObject(memstrToReceive); if (objReply.Result == true) { if (objReply.DS.Tables[0].Rows.Count != 0) { Reply objReply1 = new Reply(); WebClient client1 = new WebClient(); ReqServiceWithTokenStatus objReqServiceWithTokenStatus = new ReqServiceWithTokenStatus(); objReqServiceWithTokenStatus.TerminalId = TID; objReqServiceWithTokenStatus.ServiceId = ""; client1.Headers[HttpRequestHeader.ContentType] = "text/json"; string data = JsonConvert.SerializeObject(objReqServiceWithTokenStatus); string result1 = client1.UploadString(URL + "/GetServiceStatusWithTokens", "POST", data); MemoryStream memstrToReceive1 = new MemoryStream(Encoding.UTF8.GetBytes(result1)); DataContractJsonSerializer objJsonSerRecv1 = new DataContractJsonSerializer(typeof(Reply)); objReply1 = (Reply)objJsonSerRecv.ReadObject(memstrToReceive1); DataTable dt = new DataTable(); if (objReply1.Result) { dt.Columns.Add("S No"); dt.Columns.Add("Service"); dt.Columns.Add("Complete"); dt.Columns.Add("Skip"); dt.Columns.Add("Reject"); for (int i = 0; i < objReply.DS.Tables[0].Rows.Count; i++) { int skip = 0, complete = 0, reject = 0; DataRow row = dt.NewRow(); row["Service"] = objReply.DS.Tables[0].Rows[i]["ServiceName"].ToString(); string serviceId = objReply.DS.Tables[0].Rows[i]["pk_SM_Id"].ToString(); for (int j = 0; j < objReply1.DS.Tables[0].Rows.Count; j++) { string tokenServiceId = objReply1.DS.Tables[0].Rows[j]["fk_SM_Id"].ToString(); string terminalID = objReply1.DS.Tables[0].Rows[j]["fk_TID_Process"].ToString(); if (serviceId == tokenServiceId) { if (objReply1.DS.Tables[0].Rows[j]["Status"].ToString() == "Skip") { skip = skip + 1; } if (objReply1.DS.Tables[0].Rows[j]["Status"].ToString() == "Complete") { complete = complete + 1; } if (objReply1.DS.Tables[0].Rows[j]["Status"].ToString() == "Reject") { reject = reject + 1; } } } row["Skip"] = Convert.ToString(skip); row["Complete"] = Convert.ToString(complete); row["Reject"] = Convert.ToString(reject); dt.Rows.Add(row); } } GV_ServiceList.DataSource = dt; GV_ServiceList.DataBind(); } } } catch (Exception ex) { Log.Write("Exception in GetUserList Error :- " + ex.ToString(), ""); } }