Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SmsServer.Model.SmsTaskA> DataTableToList(DataTable dt)
        {
            List <SmsServer.Model.SmsTaskA> modelList = new List <SmsServer.Model.SmsTaskA>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SmsServer.Model.SmsTaskA model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SmsServer.Model.SmsTaskA();
                    //model.ID=dt.Rows[n]["ID"].ToString();
                    model.PhoneList  = dt.Rows[n]["PhoneList"].ToString();
                    model.MsgContent = dt.Rows[n]["MsgContent"].ToString();
                    if (dt.Rows[n]["SubTime"].ToString() != "")
                    {
                        model.SubTime = DateTime.Parse(dt.Rows[n]["SubTime"].ToString());
                    }
                    if (dt.Rows[n]["SendTime"].ToString() != "")
                    {
                        model.SendTime = DateTime.Parse(dt.Rows[n]["SendTime"].ToString());
                    }
                    model.UserID    = dt.Rows[n]["UserID"].ToString();
                    model.ParentID  = dt.Rows[n]["ParentID"].ToString();
                    model.SpgateNo  = dt.Rows[n]["SpgateNo"].ToString();
                    model.SubPort   = dt.Rows[n]["SubPort"].ToString();
                    model.SubPortEx = dt.Rows[n]["SubPortEx"].ToString();
                    if (dt.Rows[n]["FeeNum"].ToString() != "")
                    {
                        model.FeeNum = int.Parse(dt.Rows[n]["FeeNum"].ToString());
                    }
                    if (dt.Rows[n]["PhoneNum"].ToString() != "")
                    {
                        model.PhoneNum = int.Parse(dt.Rows[n]["PhoneNum"].ToString());
                    }
                    if (dt.Rows[n]["MsgLen"].ToString() != "")
                    {
                        model.MsgLen = int.Parse(dt.Rows[n]["MsgLen"].ToString());
                    }
                    if (dt.Rows[n]["HasIndex"].ToString() != "")
                    {
                        model.HasIndex = int.Parse(dt.Rows[n]["HasIndex"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<SmsServer.Model.SmsTaskA> DataTableToList(DataTable dt)
 {
     List<SmsServer.Model.SmsTaskA> modelList = new List<SmsServer.Model.SmsTaskA>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         SmsServer.Model.SmsTaskA model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new SmsServer.Model.SmsTaskA();
             //model.ID=dt.Rows[n]["ID"].ToString();
             model.PhoneList=dt.Rows[n]["PhoneList"].ToString();
             model.MsgContent=dt.Rows[n]["MsgContent"].ToString();
             if(dt.Rows[n]["SubTime"].ToString()!="")
             {
                 model.SubTime=DateTime.Parse(dt.Rows[n]["SubTime"].ToString());
             }
             if(dt.Rows[n]["SendTime"].ToString()!="")
             {
                 model.SendTime=DateTime.Parse(dt.Rows[n]["SendTime"].ToString());
             }
             model.UserID=dt.Rows[n]["UserID"].ToString();
             model.ParentID=dt.Rows[n]["ParentID"].ToString();
             model.SpgateNo=dt.Rows[n]["SpgateNo"].ToString();
             model.SubPort=dt.Rows[n]["SubPort"].ToString();
             model.SubPortEx=dt.Rows[n]["SubPortEx"].ToString();
             if(dt.Rows[n]["FeeNum"].ToString()!="")
             {
                 model.FeeNum=int.Parse(dt.Rows[n]["FeeNum"].ToString());
             }
             if(dt.Rows[n]["PhoneNum"].ToString()!="")
             {
                 model.PhoneNum=int.Parse(dt.Rows[n]["PhoneNum"].ToString());
             }
             if(dt.Rows[n]["MsgLen"].ToString()!="")
             {
                 model.MsgLen=int.Parse(dt.Rows[n]["MsgLen"].ToString());
             }
             if(dt.Rows[n]["HasIndex"].ToString()!="")
             {
                 model.HasIndex=int.Parse(dt.Rows[n]["HasIndex"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(SmsServer.Model.SmsTaskA model)
 {
     dal.Update(model);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(SmsServer.Model.SmsTaskA model)
 {
     return(dal.Add(model));
 }