コード例 #1
0
 /// <summary>
 /// 获取新闻类别名称
 /// </summary>
 protected string GetNewsTypeName(int proinfotype)
 {
     using (BLLNewsType bll = new BLLNewsType())
     {
         NewsType obj = new NewsType();
         if (proinfotype > 0)
         {
             obj = bll.GetSingle(proinfotype);
             if (obj != null)
             {
                 return(obj.NewsTypeName.ToString());
             }
         }
         return("");
     }
 }
コード例 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            using (BLLNewsType bll = new BLLNewsType())
            {
                NewsType obj = new NewsType();

                if (id > 0)
                {
                    obj    = bll.GetSingle(id);
                    obj.ID = id;
                }
                obj.NewsTypeName = txtNewsTypeName.Text.Trim().ToString();
                obj.Remarks      = txtRemarks.Text.ToString();
                if (rbtnIsChinese.Checked == true)
                {
                    obj.IsEnglish = 1;
                }
                else if (rbtnIsEnglish.Checked == true)
                {
                    obj.IsEnglish = 2;
                }
                else
                {
                    ShowMsg("请选择语言类别!");
                    return;
                }

                bll.Save(obj);

                if (bll.IsFail)
                {
                    ExceptionManager.ShowErrorMsg(this, bll.DevNetException);
                }
                else
                {
                    JSMsg.ShowWinRedirect(this, "保存成功", "cpNewsTypeList.aspx");
                }
            }
        }
コード例 #3
0
 private void setInfo()
 {
     if (id > 0)
     {
         using (BLLNewsType bll = new BLLNewsType())
         {
             NewsType cpinfor = bll.GetSingle(id);
             if (cpinfor != null)
             {
                 if (cpinfor.IsEnglish == 1)
                 {
                     rbtnIsChinese.Checked = true;
                 }
                 else if (cpinfor.IsEnglish == 2)
                 {
                     rbtnIsEnglish.Checked = true;
                 }
                 txtNewsTypeName.Text = cpinfor.NewsTypeName;
                 txtRemarks.Text      = cpinfor.Remarks;
             }
         }
     }
 }