예제 #1
0
 protected void BtnUpdate_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     try
     {
         if (ValiEdit())
         {
             DBLL.clsNews       News   = new DBLL.clsNews();
             DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
             bool _Result = false;
             MutileUploaderUserControl3.sNewName = txtsTitle.Text;
             MutileUploaderUserControl3.SavePath();
             if (MutileUploaderUserControl3.filepathlist.Count > 0)
             {
                 for (int i = 0; i < MutileUploaderUserControl3.filepathlist.Count; i++)
                 {
                     _Result = News.update_tb_NewsBynNewsID(int.Parse(hfNewsUpdateID.Value), int.Parse(ddlnTCategoryID.SelectedValue), int.Parse(rblnLangType.SelectedValue), txtsTitle.Text, txtsAuthor.Text, MutileUploaderUserControl3.filepathlist[i].ToString(), CKEditorControl1.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue));
                 }
             }
             else
             {
                 if (Image3.ImageUrl != "")
                 {
                     _Result = News.update_tb_NewsBynNewsID(int.Parse(hfNewsUpdateID.Value), int.Parse(ddlnTCategoryID.SelectedValue), int.Parse(rblnLangType.SelectedValue), txtsTitle.Text, txtsAuthor.Text, Image3.ImageUrl.ToString(), CKEditorControl1.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue));
                 }
                 else
                 {
                     _Result = News.update_tb_NewsBynNewsID(int.Parse(hfNewsUpdateID.Value), int.Parse(ddlnTCategoryID.SelectedValue), int.Parse(rblnLangType.SelectedValue), txtsTitle.Text, txtsAuthor.Text, "", CKEditorControl1.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue));
                 }
             }
             if (_Result == true)
             {
                 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess");
                 ShowMsg1.Show();
                 MultiView1.ActiveViewIndex = 0;
                 ReBindPageList();
             }
             else
             {
                 //失败就一条
                 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail");
                 ShowMsg1.Show();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #2
0
    protected void lvNewsList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
    {
        Label lblnID = (Label)lvNewsList.Items[e.NewSelectedIndex].FindControl("lblnNewsID");
        int   _nID   = 0;

        DBLL.clsNews News = new DBLL.clsNews();
        if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0)
        {
            MultiView1.ActiveViewIndex = 1;
            DBLL.DBcommon dbcom           = new DBLL.DBcommon();
            DataTable     TopicCategorydt = dbcom.selectNormalTableofAll(false, "tb_TopicCategory");
            ddlnTCategoryID.DataSource     = TopicCategorydt;
            ddlnTCategoryID.DataValueField = "nTCategoryID";
            ddlnTCategoryID.DataTextField  = "sTCategoryNameCN";
            ddlnTCategoryID.DataBind();
            DataTable dt = News.Select_tb_NewsBynNewsID(_nID);

            ddlnTCategoryID.SelectedValue = dt.Rows[0]["nTCategoryID"].ToString();
            txtsTitle.Text             = dt.Rows[0]["sTitle"].ToString();
            txtsAuthor.Text            = dt.Rows[0]["sAuthor"].ToString();
            rblnLangType.SelectedValue = dt.Rows[0]["nLangType"].ToString();
            Image3.ImageUrl            = dt.Rows[0]["sImagePath"].ToString();
            if (Image3.ImageUrl != "")
            {
                lblsImagePath.Visible = false;
                MutileUploaderUserControl3.Visible = false;
                Label2.Visible  = true;
                Button1.Visible = true;
                Image3.Visible  = true;
            }
            else
            {
                lblsImagePath.Visible = true;
                MutileUploaderUserControl3.Visible = true;
                Label2.Visible  = false;
                Button1.Visible = false;
                Image3.Visible  = false;
            }
            CKEditorControl1.Text     = dt.Rows[0]["sContent"].ToString();
            ddlnSorting.SelectedValue = dt.Rows[0]["nSorting"].ToString();
            MutileUploaderUserControl3.Refresh();
            hfNewsUpdateID.Value = _nID.ToString();
        }
    }
예제 #3
0
 protected void BtnAdd_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     if (ValiAdd())
     {
         DBLL.clsNews       News   = new DBLL.clsNews();
         DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
         int _Result = 0;
         MutileUploaderUserControl3.sNewName = txtsTitle.Text;
         MutileUploaderUserControl3.SavePath();
         if (MutileUploaderUserControl3.filepathlist.Count > 0)
         {
             for (int i = 0; i < MutileUploaderUserControl3.filepathlist.Count; i++)
             {
                 _Result = News.insert_tb_News(int.Parse(ddlnTCategoryID.SelectedValue), int.Parse(rblnLangType.SelectedValue), txtsTitle.Text, txtsAuthor.Text, MutileUploaderUserControl3.filepathlist[i].ToString(), CKEditorControl1.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue));
             }
         }
         else
         {
             _Result = News.insert_tb_News(int.Parse(ddlnTCategoryID.SelectedValue), int.Parse(rblnLangType.SelectedValue), txtsTitle.Text, txtsAuthor.Text, "", CKEditorControl1.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue));
         }
         if (_Result > 0)
         {
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertSuccess");
             ShowMsg1.Show();
             Clear();
         }
         else
         {
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertFail");
             ShowMsg1.Show();
         }
     }
     else
     {
         ShowMsg1.Show();
     }
 }