public void objdelRefreshReport() { try { string SelQuery = "select uName,Campaign_Id,Group_Name,Phone_No,Status from Active_agent"; OpenConnection(); List <ActiveAgent> objActiveAgent = new List <ActiveAgent>(); DataSet ds = new DataSet(); System.Threading.Thread.Sleep(1000); SqlCeDataAdapter adp = new SqlCeDataAdapter(SelQuery, LocalSQLConn); adp.Fill(ds); //dsReport = ds; closeConnection(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataSet dsCampName = new DataSet(); System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConnectionString); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("Select Name from Campaign where ID='" + ds.Tables[0].Rows[i]["Campaign_Id"].ToString() + "'", conn); System.Data.SqlClient.SqlDataAdapter daCampName = new System.Data.SqlClient.SqlDataAdapter(cmd); daCampName.Fill(dsCampName); string status = ds.Tables[0].Rows[i]["Status"].ToString(); string Color = string.Empty; switch (status) { case "Ready": Color = "White"; break; case "InProgress": Color = "Blue"; break; case "Connected": Color = "Green"; break; case "DisConnected": Color = "Red"; break; case "Incoming": Color = "Yellow"; break; case "Hold": Color = "Brown"; break; } objActiveAgent.Add(ActiveAgent.Create(ds.Tables[0].Rows[i]["uName"].ToString(), dsCampName.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i]["Group_Name"].ToString(), ds.Tables[0].Rows[i]["Phone_No"].ToString(), ds.Tables[0].Rows[i]["Status"].ToString(), Color)); } AgentItems.ItemsSource = objActiveAgent; } catch (Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "objdelRefreshReport()", "ctlrptActiveAgent.xaml.cs"); } }
public static ActiveAgent Create(string uName, string Camapign_Id, string Group_Name, string Phone_No, string Status, string color) { ActiveAgent ai = new ActiveAgent(); ai.uName = uName; ai.Campaign_Id = Camapign_Id; ai.Group_Name = Group_Name; ai.Phone_No = Phone_No; ai.Status = Status; ai.Color = color; return(ai); }