Exemple #1
0
    private DataTable getInfo(int seType, DataTable dt,  Dictionary<string, string> wcDictionary, ISession sessionManager, string ServiceName)
    {
        
  
       IList<SessionInfo> sessionList = null;
    
       DataRow newRow = null;
     
       //int i = 15;
        //newRow = dt.NewRow();
        //newRow["change"] = "chngge2" + i.ToString();
        //newRow["WC"] = "WC" + i.ToString();
        //newRow["PdLine"] = "line" + i.ToString();
        //newRow["Operator"] = "line" + i.ToString();
        //newRow["StartTime"] = "line" + i.ToString();
        //newRow["StationId"] = string.Empty;
        //dt.Rows.Add(newRow);

        //for (i = 0; i < 5; i++)
        //{
        //    newRow = dt.NewRow();
        //    newRow["change"] = "chngge2" + i.ToString();
        //    newRow["WC"] = "WC" + i.ToString();
        //    newRow["PdLine"] = "line" + i.ToString();
        //    newRow["Operator"] = "line" + i.ToString();
        //    newRow["StartTime"] = "line" + i.ToString();
        //    newRow["StationId"] = string.Empty;
        //    dt.Rows.Add(newRow);
        //}

       //sessionManager = (ISession)ServiceAgent.getInstance().GetObjectByName<ISession>(WebConstant.CommonObject, ServiceName);
    
       if (wcDictionary == null || wcDictionary.Count == 0)
       {
           IList<StationInfo> stations = sessionManager.GetAllStationInfo();
           if ((stations != null) && (stations.Count > 0))
           {
               foreach (StationInfo sta in stations)
               {
                   wcDictionary.Add(sta.StationId, sta.Descr);
               }
           }
       }
         sessionList = sessionManager.GetSessionByType((SessionType)seType);
         IList<string> noDesStaslist = new List<string>();  
        // sessionList.Add 
         if ((sessionList != null) && (sessionList.Count > 0))
         {
             foreach (SessionInfo se in sessionList)
             {

                 newRow = dt.NewRow();
                 newRow["change"] = se.SessionKey;
                 if (wcDictionary.ContainsKey(se.StationId))
                 {
                     newRow["WC"] = wcDictionary[se.StationId];//'se.wc
                 }
                 else if (!noDesStaslist.Contains(se.StationId))
                 {
                     noDesStaslist.Add(se.StationId);
                     newRow["WC"] = se.StationId;
                 }
                 newRow["Service"] = ServiceName;
                 newRow["PdLine"] = se.PdLine;
                 newRow["Operator"] = se.Operator;
                 newRow["StartTime"] = DateTimeToString(se.Cdt);
                 newRow["StationId"] = se.StationId;

                 dt.Rows.Add(newRow);
             }

             if (noDesStaslist.Count > 0)
             {
                 foreach (string nodesSta in noDesStaslist)
                 {
                     if (string.IsNullOrEmpty(noDescWC))
                     {
                         noDescWC = nodesSta;
                     }
                     else
                     {
                         noDescWC = noDescWC + "," + nodesSta;
                     }
                 }
             }
         }
         //else
         //{
         //    dt = getNullBomDataTable();
         //}



        return dt;
    }