Exemplo n.º 1
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<WebProject.Model.BaseData.ZT_COM_WebInfo> DataTableToList(DataTable dt)
 {
     List<WebProject.Model.BaseData.ZT_COM_WebInfo> modelList = new List<WebProject.Model.BaseData.ZT_COM_WebInfo>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         WebProject.Model.BaseData.ZT_COM_WebInfo model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new WebProject.Model.BaseData.ZT_COM_WebInfo();
             if(dt.Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
             }
             model.FilePath=dt.Rows[n]["FilePath"].ToString();
             model.WebURL=dt.Rows[n]["WebURL"].ToString();
             model.Title=dt.Rows[n]["Title"].ToString();
             model.KeyWords=dt.Rows[n]["KeyWords"].ToString();
             model.Description=dt.Rows[n]["Description"].ToString();
             model.Remark=dt.Rows[n]["Remark"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemplo n.º 2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Session["ZT_ADMIN"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            if (this.txtTitle.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入网页标题!");
                return;
            }
            if (this.txtWebUrl.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入链接地址!");
                return;
            }
            if (this.txtKeyWords.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入关键字!");
                return;
            }
            if (this.txtFilePath.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入文件路径!");
                return;
            }
            if (this.txtDescription.Text.Trim() == "")
            {
                MessageBox.Show(this, "请输入网页描述!");
                return;
            }
            WebProject.Model.BaseData.ZT_COM_WebInfo model_WebInfo = new WebProject.Model.BaseData.ZT_COM_WebInfo();
            model_WebInfo.Title = this.txtTitle.Text.Trim();
            model_WebInfo.WebURL = this.txtWebUrl.Text.Trim();
            model_WebInfo.KeyWords = this.txtKeyWords.Text.Trim();
            model_WebInfo.FilePath = this.txtFilePath.Text.Trim();
            model_WebInfo.Description = this.txtDescription.Text.Trim();
            WebProject.BLL.BaseData.ZT_COM_WebInfo bll_WebInfo = new WebProject.BLL.BaseData.ZT_COM_WebInfo();
            bll_WebInfo.Add(model_WebInfo);

            LogManage.WriteLog(Request.UserHostAddress, "关键字管理", "添加关键字", "成功", "网页标题:" + model_WebInfo.Title + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo);
            MessageBox.ShowAndRedirect(this, "添加关键字成功!", "WebInfoList.aspx");
        }
    }