예제 #1
0
        private void cmdSave_ServerClick(object sender, EventArgs e)
        {
            DBDateTime dDate       = FormatHelper.GetNowDBDateTime(this.DataProvider);
            string     strReportId = "";

            RptViewUserSubscription[] subs = new RptViewUserSubscription[this.gridWebGrid.Rows.Count];
            for (int i = 0; i < this.gridWebGrid.Rows.Count; i++)
            {
                GridRecord row            = this.gridWebGrid.Rows[i];
                RptViewUserSubscription s = new RptViewUserSubscription();
                s.UserCode          = this.GetUserCode();
                s.ReportID          = row.Items.FindItemByKey("ReportID").Text;
                s.Sequence          = i + 1;
                s.InputType         = row.Items.FindItemByKey("InputType").Text;
                s.InputName         = row.Items.FindItemByKey("InputName").Text;
                s.InputValue        = row.Items.FindItemByKey("InputValue").Text;
                s.SqlFilterSequence = decimal.Parse(row.Items.FindItemByKey("SqlFilterSequence").Text);
                s.MaintainUser      = this.GetUserCode();
                s.MaintainDate      = dDate.DBDate;
                s.MaintainTime      = dDate.DBTime;
                subs[i]             = s;
                strReportId         = s.ReportID;
                this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainUser").Text = s.MaintainUser;
                this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainDate").Text = FormatHelper.ToDateString(s.MaintainDate);
                this.gridWebGrid.Rows[i].Items.FindItemByKey("MaintainTime").Text = FormatHelper.ToTimeString(s.MaintainTime);
            }

            if (rptFacade == null)
            {
                rptFacade = new ReportViewFacade(this.DataProvider);
            }
            if (strReportId == "")
            {
                string strValue = this.drpRptId.SelectedValue;
                object objEntry = rptFacade.GetRptViewEntry(strValue);
                strReportId = ((RptViewEntry)objEntry).ReportID;
            }

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.OpenConnection();
            this.DataProvider.BeginTransaction();
            try
            {
                rptFacade.UpdateRptViewUserSubscriptionByReportId(strReportId, this.GetUserCode(), subs, this.chkReportAsDefault.Checked);

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
            finally
            {
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.CloseConnection();
            }

            string alertInfo =
                string.Format("<script language=javascript>alert('{0}');</script>", this.languageComponent1.GetString("$CS_Save_Success"));

            if (!this.ClientScript.IsClientScriptBlockRegistered("SaveSuccess"))
            {
                this.ClientScript.RegisterClientScriptBlock(typeof(string), "SaveSuccess", alertInfo);
            }
        }