Example #1
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<light.Model.product> DataTableToList(DataTable dt)
 {
     List<light.Model.product> modelList = new List<light.Model.product>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         light.Model.product model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new light.Model.product();
             if(dt.Rows[n]["pkid"].ToString()!="")
             {
                 model.pkid=int.Parse(dt.Rows[n]["pkid"].ToString());
             }
             model.pname=dt.Rows[n]["pname"].ToString();
             if(dt.Rows[n]["pcateid"].ToString()!="")
             {
                 model.pcateid=int.Parse(dt.Rows[n]["pcateid"].ToString());
             }
             model.plogo=dt.Rows[n]["plogo"].ToString();
             model.pinfo=dt.Rows[n]["pinfo"].ToString();
             if(dt.Rows[n]["isopen"].ToString()!="")
             {
                 model.isopen=int.Parse(dt.Rows[n]["isopen"].ToString());
             }
             if(dt.Rows[n]["addtime"].ToString()!="")
             {
                 model.addtime=DateTime.Parse(dt.Rows[n]["addtime"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         int pid = light.Common.DNTRequest.GetQueryInt("pid", 0);
         if (pid > 0)
         {
             model = new light.BLL.product().GetModel(pid);
             bingCategory(model.pcateid);
             ViewState["pid"] = pid.ToString();
         }
     }
     else
     {
         doPost();
     }
 }