protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string idValue = Request.Params["id"];
         if (idValue != null)
         {
             int id = Convert.ToInt32(idValue);
             LMessageBB messageBB = new LMessageBB();
             try
             {
                 LMessageData messageData = new LMessageData();
                 messageData = messageBB.GetModel(id);
                 //����й��������˴�Ҫ��֤�Ƿ�����ɾ��
                 if (this.ValidateDataPermission(messageData.isrtEmpId))
                 {
                     messageBB.DeleteRecord(id);
                 }
                 this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
             }
             catch (Exception ex)
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3)", true);
                 return;
             }
             finally
             {
                 messageBB.Dispose();
             }
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// չʾ����
 /// </summary>
 /// <param name="id">��¼Id</param>
 private void ShowInfo(int id)
 {
     SFileBB fileBB = new SFileBB();
     LMessageBB messageBB = new LMessageBB();
     LMessageData model = new LMessageData();
     try
     {
         model = messageBB.GetModel(id);
         this.title.Text = model.title;
         this.content.Value = model.content;
         this.fileId.Value = model.fileId;
         this.fileNm.Text = fileBB.GetBatchFileNm(model.fileId);
         if (this.sort.Items.FindByValue(model.sort.ToString()) != null)
         {
             this.sort.SelectedValue = model.sort.ToString();
         }
         this.author.Text = model.author;
         this.isIndexShow.Checked = model.isIndexShow;
     }
     finally
     {
         fileBB.Dispose();
         messageBB.Dispose();
     }
 }
Esempio n. 3
0
    /// <summary>
    /// ���ݱ���
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        LMessageData model = new LMessageData();
        LMessageBB messageBB = new LMessageBB();
        try
        {
            if (this.State == "1")
            {
                //�����֤

                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = messageBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                //�����֤
                //if (this.isIndexShow.SelectedValue == "1")
                //{
                //    //���������֪ͨ�Ѿ�ѡ������ҳ��ʾ����ʾ�û�
                //    if (messageBB.GetList("isIndexShow=1 and id <>" + this.IdValue.ToString()).Tables[0].Rows.Count >= 5)
                //    {
                //        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"�Ѿ���5��֪ͨѡ���˷�����������޸�!\");", true);
                //        return;
                //    }
                //}

                model = messageBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                messageBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3)", true);
            return;
        }
        finally
        {
            messageBB.Dispose();
        }

        Response.Redirect("LMessageList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
    }