Esempio n. 1
0
        /// <summary>
        /// 新增按钮处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            B_ReceiveEdit l_BusReceiveEdit = null;

            //表单的合法性验证
            if (!VerifyEditField())
            {
                JScript.ShowMsgBox(Page, MsgType.VbCritical, m_strAryMessages);
                return;
            }

            //行文号是否重复
            if (B_ReceiveEdit.IsHaveSendNo(this.txtSendNo.Text.TrimEnd()))//任金权增加
            {
                JScript.ShowMsgBox(this.Page, "行文号重复", false);
                this.txtSendNo.Focus();
                return;
            }

            l_BusReceiveEdit = new B_ReceiveEdit();

            PopulateEntity(l_BusReceiveEdit);


            //l_BusReceiveEdit.ReceiveNo = B_ReceiveID.GenerateReceiveNo(DateTime.Now.Year.ToString(), TemplateName);
            ////////////////////////////////////////////////////20110124 扬子江
            if (!(TemplateName.Equals("党纪工团收文")))
            {
                l_BusReceiveEdit.ReceiveNo = B_ReceiveID.GenerateReceiveNo(DateTime.Now.Year.ToString(), TemplateName);
            }
            else
            {
                this.SubTemplateName = ddlProcessTemplate.SelectedValue;
                if (this.SubTemplateName == "工会收文")
                {
                    l_BusReceiveEdit.ReceiveNo = B_ReceiveID.GenerateDJGTReceiveNo("H" + DateTime.Now.Year.ToString(), this.SubTemplateName);
                }
                if (this.SubTemplateName == "团委收文")
                {
                    l_BusReceiveEdit.ReceiveNo = B_ReceiveID.GenerateDJGTReceiveNo("T" + DateTime.Now.Year.ToString(), this.SubTemplateName);
                }
                if (this.SubTemplateName == "党委纪委收文")
                {
                    l_BusReceiveEdit.ReceiveNo = B_ReceiveID.GenerateDJGTReceiveNo("D" + DateTime.Now.Year.ToString(), this.SubTemplateName);
                }
            }

            //归档状态
            if (chkIsArchive.Checked)
            {
                l_BusReceiveEdit.ArchiveStatus = "已归档";
            }
            else
            {
                l_BusReceiveEdit.ArchiveStatus = "未完成";
            }

            if (l_BusReceiveEdit.Save())
            {
                JScript.ShowMsgBox(this.Page, "新增成功", false);
                PopulateEditField(l_BusReceiveEdit);
                btnQuery_Click(null, null);
            }
        }