예제 #1
0
        private void Delete()
        {
            SqlConnection cnn = new SqlConnection(DbConnString);

            cnn.Open();
            SqlTransaction sqlTransaction = cnn.BeginTransaction();

            try
            {
                SqlHelper.ExecuteNonQuery(sqlTransaction, this.GetCmdDelete());
                ReportAuth ra = new ReportAuth();
                ra.DeleteViewColFromDatabase(this.DataCnn, sqlTransaction, this._ID);
                _Parent.Remove(this);
                sqlTransaction.Commit();
            }
            catch (Exception e)
            {
                sqlTransaction.Rollback();
                throw e;
            }
            finally
            {
                if (cnn.State == ConnectionState.Open)
                {
                    cnn.Close();
                }
            }
        }
예제 #2
0
        private void Update()
        {
            SqlConnection cnn = new SqlConnection(DbConnString);

            cnn.Open();
            SqlTransaction sqlTransaction = cnn.BeginTransaction();

            try
            {
                SqlHelper.ExecuteNonQuery(sqlTransaction, this.GetCmdUpdate());
                ReportAuth ra = new ReportAuth();
                ra.UpdateViewNameToBusobject(this.DbConnString, this.DataCnn, sqlTransaction, this._ID);
                sqlTransaction.Commit();
            }
            catch (Exception e)
            {
                sqlTransaction.Rollback();
                throw e;
            }
            finally
            {
                if (cnn.State == ConnectionState.Open)
                {
                    cnn.Close();
                }
            }
            //SqlHelper.ExecuteNonQuery(DbConnString, this.GetCmdUpdate());
        }
        private static string GetAuthIdByReport(string reportID)
        {
            ReportAuth auth = new ReportAuth();

            string sql = string.Format("select ReportId from UAP_ReportView_AuthId  where ReportGuid='{0}'", reportID);

            return(SqlHelper.ExecuteScalar(_DbCnnString, sql).ToString());
        }
        /// <summary>
        /// 发布到BS
        /// </summary>
        /// <param name="reportID"></param>
        /// <param name="cAccId"></param>
        /// <param name="cYear"></param>
        /// <param name="userId"></param>
        /// <param name="conString"></param>
        /// <returns></returns>
        public static bool PublishBS(string reportID, string cAccId, string cYear, string userId, U8LoginInfor u8LoginInfor)
        {
            CheckCnnString();

            //string menuId = reportID.GetHashCode().ToString();
            string menuId       = reportID;
            string reportName   = string.Empty;
            string twReportName = string.Empty;
            string enReportName = string.Empty;
            string filterid     = string.Empty;
            string subId        = string.Empty;
            string authId       = string.Empty;

            GetReportSimpleInfo(reportID, out reportName, out twReportName, out enReportName, out filterid, out subId);
            ReportAuth auth = new ReportAuth(u8LoginInfor);

            authId = auth.GetReportAuthId(reportID) + "_01";//01是查询权限
            //authId = GetAuthIdByReport(reportID);
            StringBuilder sb        = new StringBuilder();
            string        parameter = string.Format("<property type='Report' reportid='{0}'></property>", reportID);

            //菜单
            sb.AppendFormat("insert into ua_menu(cMenu_id,cMenu_name,cmenu_Eng,cSub_id,iGrade,cSupMenu_id,bEndGrade,cAuth_id,iOrder,iImgIndex,Paramters,  Depends,Flag,isWebFlag,cimagename,cmenutype)" +
                            "values('{0}'   ,'{1}'      ,null     ,'{2}'  ,'1'   ,'{3}'     ,1        ,'{4}'    ,1     ,1        ,@parameter    ,null   ,null,1,   'report_default.png','report');",
                            menuId, reportName, "UA", subId, authId);
            //语言
            sb.AppendFormat("INSERT INTO UFMENU_BUSINESS_LANG(MenuId,Caption,Localeid) values('{0}','{1}','zh-cn');", menuId, reportName);
            sb.AppendFormat("INSERT INTO UFMENU_BUSINESS_LANG(MenuId,Caption,Localeid) values('{0}','{1}','zh-tw');", menuId, twReportName);
            sb.AppendFormat("INSERT INTO UFMENU_BUSINESS_LANG(MenuId,Caption,Localeid) values('{0}','{1}','en-us');", menuId, enReportName);

            //把菜单置为isweb
            sb.AppendFormat(" update ufsystem..ua_Menu set iswebflag=2 where cmenu_id= '{0}';", subId);
            sb.AppendFormat("update  UFMeta_{0}..uap_report set MappingBsMenuId='{1}'where id='{2}'", cAccId, menuId, reportID);

            //菜单对应的程序集
            //sb.AppendFormat("Insert into ua_idt_ex (id,assembly,catalogtype,type,class,entrypoint,parameter,reserved)" +
            //"values('{0}','SLReport/UFIDA.U8.Report.SLReportView.dll',1,0,'UFIDA.U8.Report.SLReportView.ReportLoginable','{0}','','UFIDA.U8.Portal.Proxy.Supports.NetModule');",
            //menuId);
            SqlParameter reportParameter = new SqlParameter("parameter", parameter);
            SqlCommand   comand          = new SqlCommand(sb.ToString());

            comand.Parameters.Add(reportParameter);
            SqlHelper.ExecuteNonQuery(u8LoginInfor.UfDataCnnString, comand);

            //插入程序集
            //sb = new StringBuilder();
            //sb.AppendFormat("Insert into ua_idt (id,assembly,catalogtype,type,class,entrypoint,parameter,reserved)" +
            //"values('{0}','SLReport/UFIDA.U8.Report.SLReportView.dll',1,0,'UFIDA.U8.Report.SLReportView.ReportLoginable','{0}','','UFIDA.U8.Portal.Proxy.Supports.NetModule');",
            //menuId);
            //SqlHelper.ExecuteScalar(u8LoginInfor.UfSystCnnString, sb.ToString());

            comand.CommandType = CommandType.StoredProcedure;
            comand.CommandText = "dbo.sp_CalculateSupAuthByAuthID";
            comand.Parameters.Clear();
            comand.Parameters.Add(SqlHelper.GetParameter("@AuthID", SqlDbType.NVarChar, 100, authId));
            comand.Parameters.Add(SqlHelper.GetParameter("@isDelete", SqlDbType.Bit, "false"));
            SqlHelper.ExecuteNonQuery(u8LoginInfor.UfSystCnnString, comand);
            //更改状态 _DbCnnString是meta库
            SqlHelper.ExecuteNonQuery(_DbCnnString, GetCmdPublish(reportID, ReportPublicPosition.CSAndBS));
            return(true);
        }