Example #1
0
    protected void btnsave(object sender, EventArgs e)
    {
        wgiAdUnionSystem.BLL.wgi_usersite bll = new wgiAdUnionSystem.BLL.wgi_usersite();
        wgiAdUnionSystem.Model.wgi_usersite model = new wgiAdUnionSystem.Model.wgi_usersite();
        string sitename = txtsitename.Text;
        string url = txturl.Text;
        string remark = txtremark.Text;

        int ipno, pvno;
        ipno = pvno = 0;

        int sitetype = int.Parse(ddlsitetype.SelectedValue);

        try
        {
            ipno = int.Parse(txtipno.Text);

        }
        catch (Exception)
        {

            //ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('独立IP数请输入数字');", true);
            ipno = 0;
        }
        try
        {
            pvno = int.Parse(txtpvno.Text);

        }
        catch (Exception)
        {
            //ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('日均PV数请输入数字');", true);
            pvno = 0;
        }
        model.ipno = ipno;
        model.pvno = pvno;
        model.sitename = sitename;
        model.siteremark = remark;
        model.sitetype = sitetype;
        model.url = url;
        model.userid = userid;
        model.siteid = int.Parse(hidsiteid.Value);

        bll.Update(model);
        ScriptManager.RegisterClientScriptBlock(this, GetType(), DateTime.Now.ToString(), "alert('编辑网站成功');location=location;", true);
    }
Example #2
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<wgiAdUnionSystem.Model.wgi_usersite> DataTableToList(DataTable dt)
 {
     List<wgiAdUnionSystem.Model.wgi_usersite> modelList = new List<wgiAdUnionSystem.Model.wgi_usersite>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         wgiAdUnionSystem.Model.wgi_usersite model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new wgiAdUnionSystem.Model.wgi_usersite();
             if(dt.Rows[n]["userid"].ToString()!="")
             {
                 model.userid=int.Parse(dt.Rows[n]["userid"].ToString());
             }
             if(dt.Rows[n]["siteid"].ToString()!="")
             {
                 model.siteid=int.Parse(dt.Rows[n]["siteid"].ToString());
             }
             model.sitename=dt.Rows[n]["sitename"].ToString();
             model.url=dt.Rows[n]["url"].ToString();
             model.siteremark=dt.Rows[n]["siteremark"].ToString();
             if(dt.Rows[n]["ipno"].ToString()!="")
             {
                 model.ipno=int.Parse(dt.Rows[n]["ipno"].ToString());
             }
             if(dt.Rows[n]["pvno"].ToString()!="")
             {
                 model.pvno=int.Parse(dt.Rows[n]["pvno"].ToString());
             }
             if(dt.Rows[n]["sitetype"].ToString()!="")
             {
                 model.sitetype=int.Parse(dt.Rows[n]["sitetype"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }