예제 #1
0
        /// <summary>
        /// 发布脚本代码,所有用户生效
        /// </summary>
        /// <param name="busType"></param>
        /// <param name="scriptCode"></param>
        /// <returns></returns>
        public int PublishScript(string busType, Int64 phid, string scriptCode)
        {
            string scriptFileName = GenerateScriptFile(busType, phid, scriptCode, true);
            string base64Str      = NG3.NGEncode.ToBase64(scriptCode);

            //orcale会截断,要参数化保存clob
            //string sql = string.Format("update fg_individualinfo  set scriptcode_draft={0} where phid={1}", DbConvert.ToSqlString(base64Str), phid);
            //string sql2 = string.Format("update fg_individualinfo   set scriptcode_pub={0} where phid={1}", DbConvert.ToSqlString(base64Str), phid);
            //int iret = DbHelper.ExecuteNonQuery(sql);//草稿
            //iret += DbHelper.ExecuteNonQuery(sql2);//发布版本

            string sql = "update fg_individualinfo  set scriptcode_draft={0} where phid={1}";

            IDataParameter[] p = new NGDataParameter[2];
            p[0]       = new NGDataParameter("scriptcode_draft", NGDbType.Text);
            p[0].Value = base64Str;
            p[1]       = new NGDataParameter("phid", DbType.Int64);
            p[1].Value = phid;
            int iret = DbHelper.ExecuteNonQuery(sql, p);

            string sql2 = "update fg_individualinfo   set scriptcode_pub={0} where phid={1}";

            IDataParameter[] parm = new NGDataParameter[2];
            parm[0]       = new NGDataParameter("scriptcode_pub", NGDbType.Text);
            parm[0].Value = base64Str;
            parm[1]       = new NGDataParameter("phid", DbType.Int64);
            parm[1].Value = phid;
            iret         += DbHelper.ExecuteNonQuery(sql2, parm);

            string sqlStr = string.Format("update fg_individualinfo  set userdef_scripturl={0} where phid={1}", DbConvert.ToSqlString(scriptFileName), phid);

            iret += DbHelper.ExecuteNonQuery(sqlStr);

            return(iret);
        }
예제 #2
0
        /// <summary>
        /// 获取用户查询数据
        /// </summary>
        /// <param name="PageId"></param>
        /// <returns></returns>
        public DataTable GetQueryPanelData(string PageId)
        {
            string sqlString = " select remeberstr,reembersql from c_sys_search_def_master where pageid=" + DbConvert.ToSqlString(PageId) + " and userid=" + DbConvert.ToSqlString(NG3.AppInfoBase.LoginID) + " and cboo=" + DbConvert.ToSqlString(NG3.AppInfoBase.OCode);;

            return(DbHelper.GetDataTable(sqlString));
        }
예제 #3
0
        /// <summary>
        /// 删除自定义界面信息
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public int Delete(string code)
        {
            string sql = string.Format("delete from fg_individualinfo where code={0}", DbConvert.ToSqlString(code));

            return(DbHelper.ExecuteNonQuery(sql));
        }
예제 #4
0
파일: UserDac.cs 프로젝트: RaoLeigf/msyh
        private bool UpdateUserStatus(string logid, string status)
        {
            string sql  = "update secuser set status = '" + status + "' where logid=" + DbConvert.ToSqlString(logid);//锁定:status=1;未锁定:status=0或null
            int    iret = DbHelper.ExecuteNonQuery(sql);

            if (iret > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        /// <summary>
        /// 保存用户查询数据
        /// </summary>
        /// <param name="PageId"></param>
        /// <param name="ClientJsonString"></param>
        /// <returns></returns>
        public int SetQueryPanelData(string PageId, string ClientJsonString)
        {
            string sqlWhere = " pageid=" + DbConvert.ToSqlString(PageId) + " and userid=" + DbConvert.ToSqlString(NG3.AppInfoBase.LoginID) + " and cboo=" + DbConvert.ToSqlString(NG3.AppInfoBase.OCode);
            string query    = DataConverterHelper.ConvertQueryString(ClientJsonString);


            //目前是直接删除后创建  这样的话,guid的主从明细表就查不到明细数据了
            //若存在 则更新,否则 删除后创建
            DataTable tmpDT = DbHelper.GetDataTable("select * from c_sys_search_def_master where " + sqlWhere);

            if (tmpDT.Rows.Count == 0)
            {
                DataRow dr = tmpDT.NewRow();
                dr["id"]         = Guid.NewGuid().ToString();
                dr["pageid"]     = PageId;
                dr["userid"]     = NG3.AppInfoBase.LoginID;
                dr["cboo"]       = NG3.AppInfoBase.OCode;
                dr["isdefault"]  = 0;
                dr["ismember"]   = 0;
                dr["remeberstr"] = ClientJsonString;
                dr["reembersql"] = query;
                tmpDT.Rows.Add(dr);
                return(DbHelper.Update(tmpDT, "select * from c_sys_search_def_master"));
            }
            else
            {
                tmpDT.Rows[0]["isdefault"]  = 0;
                tmpDT.Rows[0]["ismember"]   = 0;
                tmpDT.Rows[0]["remeberstr"] = ClientJsonString;
                tmpDT.Rows[0]["reembersql"] = query;
                return(DbHelper.Update(tmpDT, "select * from c_sys_search_def_master where " + sqlWhere));
            }
        }
예제 #6
0
        /// <summary>
        /// 对应oracle数据库根据帐套取最大年度帐套的密码
        /// </summary>
        /// <param name="ucode">数据库名</param>
        /// <returns>帐套对应的密码</returns>
        public string GetDbPwd(string PubConnectString, string dbname)
        {
            //string sql = "select ucode from ngusers where dbname=" + DbConvert.ToSqlString(dbname) + "";
            //string ucode = DbHelper.ExecuteScalar(PubConnectString, sql).ToString();

            string sql   = string.Empty;
            string ucode = string.Empty;
            string uyear = string.Empty;
            string pwd   = string.Empty;

            if (dbname.Length > 6)//ng00012016
            {
                ucode = dbname.Substring(2, dbname.Length - 6);
                uyear = dbname.Substring(dbname.Length - 4, 4);
                sql   = "select count(*) from ngyeardb where ucode=" + DbConvert.ToSqlString(ucode) + " and uyear=" + DbConvert.ToSqlString(uyear) + "";

                string ret = DbHelper.GetString(PubConnectString, sql);
                if (ret == "0")                                     //没有则取最大
                {
                    ucode = dbname.Substring(2, dbname.Length - 2); //去掉NG前缀
                    sql   = "select max(uyear) from ngyeardb where ucode=" + DbConvert.ToSqlString(ucode) + "";
                    uyear = DbHelper.GetString(PubConnectString, sql);
                }
            }
            else//默认取最大年度
            {
                ucode = dbname.Substring(2, dbname.Length - 2);//去掉NG前缀
                sql   = "select max(uyear) from ngyeardb where ucode=" + DbConvert.ToSqlString(ucode) + "";
                uyear = DbHelper.GetString(PubConnectString, sql);
            }

            sql = "select dblogpass from ngyeardb where ucode=" + DbConvert.ToSqlString(ucode) + " and uyear=" + DbConvert.ToSqlString(uyear) + "";
            pwd = DbHelper.GetString(PubConnectString, sql);

            if (string.IsNullOrEmpty(pwd))
            {
                throw new Exception(string.Format("密码获取失败,dbname:{0};ucode:{1};uyear:{2}", dbname, ucode, uyear));
            }
            return(pwd);
        }
예제 #7
0
파일: PrintDac.cs 프로젝트: RaoLeigf/msyh
 /// <summary>
 ///
 /// </summary>
 /// <param name="printId"></param>
 /// <param name="paramName"></param>
 /// <param name="paramValue"></param>
 public void UpdateStatus(string printId, string paramName, string paramValue)
 {
     DbHelper.ExecuteNonQuery(PubConnectString, "update printfm set " + paramName + "=" + DbConvert.ToSqlString(paramValue) + " where printid=" + printId);
 }
예제 #8
0
        /// <summary>
        /// 根据logid和业务标识获取记忆数据
        /// </summary>
        /// <param name="logid"></param>
        /// <param name="bustype"></param>
        /// <returns></returns>
        public DataRow GetLayoutLogDr(string logid, string bustype)
        {
            //string sqlString = " select * from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid) + " and bustype=" + DbConvert.ToSqlString(bustype);
            string    sqlString = " select gid,bustype,logid,pagesize from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid) + " and bustype=" + DbConvert.ToSqlString(bustype);
            DataTable logdt     = DbHelper.GetDataTable(sqlString);

            return(logdt.Rows.Count > 0 ? logdt.Rows[0] : null);
        }
예제 #9
0
        //clob字段单独获取
        public string GetLayoutValue(string logid, string bustype)
        {
            string sqlString = " select value from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid) + " and bustype=" + DbConvert.ToSqlString(bustype);

            return(DbHelper.GetString(sqlString));
        }
예제 #10
0
        public DataTable GetLayoutLogdt(string logid, string[] bustypes)
        {
            string inString = string.Join("','", bustypes);

            inString = "('" + inString + "')";
            string sqlString = string.Format(" select * from fg_layoutlog where logid={0} and bustype in {1}", DbConvert.ToSqlString(logid), inString);

            return(DbHelper.GetDataTable(sqlString));
        }
예제 #11
0
        /// <summary>
        /// 根据登录编号获取记忆数据
        /// </summary>
        /// <param name="logid"></param>
        /// <returns></returns>
        public DataTable GetLayoutLogdt(string logid)
        {
            //string sqlString = " select * from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid);
            string sqlString = " select gid,bustype,logid,pagesize from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid);

            return(DbHelper.GetDataTable(sqlString));
        }
예제 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pubconstr"></param>
        /// <param name="moduleid"></param>
        /// <returns></returns>
        private string GetFullModuleNoByModuleId(string pubconstr, string moduleid)
        {
            //套件+模块号
            string    sql = string.Format(@"select * from ngproducts where moduleid={0} and product={1} ", DbConvert.ToSqlString(moduleid), DbConvert.ToSqlString(NGCOM.Instance.Product));
            DataTable dt  = DbHelper.GetDataTable(pubconstr, sql);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(string.Empty);
            }
            string suitno      = Convert.ToString(dt.Rows[0]["suitno"]);
            string moduleno    = Convert.ToString(dt.Rows[0]["moduleno"]);
            string newmoduleno = string.Empty;

            if (moduleno.IndexOf(".") > 0)
            {
                //ngproducts.moduleno字段信息中已包含套件信息
                newmoduleno = moduleno;
            }
            else
            {
                newmoduleno = Convert.ToString(dt.Rows[0]["suitno"]) + "." + moduleno;
            }

            return(newmoduleno);
        }
예제 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pubconstr"></param>
        /// <param name="moduleid"></param>
        /// <returns></returns>
        private string GetModuleNoByModuleId(string pubconstr, string moduleid)
        {
            string    sql = string.Format(@"select moduleno from ngproducts where moduleid={0} and product={1} ", DbConvert.ToSqlString(moduleid), DbConvert.ToSqlString(NGCOM.Instance.Product));
            DataTable dt  = DbHelper.GetDataTable(pubconstr, sql);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(string.Empty);
            }
            else
            {
                return(Convert.ToString(dt.Rows[0]["moduleno"]));
            }
        }
예제 #14
0
        /// <summary>
        /// 判断当前模块是否授权
        /// </summary>
        /// <param name="pubconstr"></param>
        /// <param name="ucode"></param>
        /// <param name="ocode"></param>
        /// <param name="moduleid"></param>
        /// <param name="validErrMsg"></param>
        /// <returns></returns>
        public bool HasRight(string pubconstr, string ucode, string ocode, string moduleid, ref string validErrMsg)
        {
            validErrMsg = string.Empty;

            if (this.AllModuleIsOpen())
            {
                return(true);                       //通狗
            }
            //******************过滤权限判断******************
            //对部分moduleid做特殊处理
            string strModuleid = this.GetAdjustedModuleId(moduleid);

            //不需要控制的模块,直接返回true;
            if (NGCOM.Instance.HtNoControlModules.ContainsValue(strModuleid))
            {
                return(true);
            }
            //242-权限中心(信息权限管理),Psoft特殊处理
            if (strModuleid == "242" || strModuleid == "19015" || strModuleid == "19016" || strModuleid == "19022" || strModuleid == "19026" || strModuleid == "19033" || strModuleid == "19038" || strModuleid == "19040")
            {
                return(true);
            }
            //************************************************

            string strFullModuleNo = this.GetFullModuleNoByModuleId(pubconstr, strModuleid);//套件.模块号

            if (this.IsModuleBuy(strFullModuleNo))
            {
                //已购买
                int       iRightCount = this.GetModuleRightsCountByFullNo(strFullModuleNo); //获取此模块授权数
                string    strModuleno = this.GetModuleNoByModuleId(pubconstr, strModuleid); //根据【ngproducts.moduleid】获取【ngproducts.moduleno】
                string    sql         = string.Format(@"select * from ngmodulerights where moduleno={0}", DbConvert.ToSqlString(strModuleno));
                DataTable dt          = DbHelper.GetDataTable(pubconstr, sql);              //获取此模块所有已授权数

                if (dt == null || dt.Rows.Count == 0)
                {
                    validErrMsg = "此模块(" + strModuleid + ")尚未授权";
                }
                else if (dt.Rows.Count > iRightCount)
                {
                    validErrMsg = "此模块已授权超过上限";
                }
                else
                {
                    //授权按组织、账套过滤
                    string    sqlfilter = "ucode=" + DbConvert.ToSqlString(ucode) + " and ocode=" + DbConvert.ToSqlString(ocode);
                    DataRow[] drRights  = dt.Select(sqlfilter);
                    if (drRights == null || drRights.Length == 0)
                    {
                        validErrMsg = "此模块(" + strModuleid + ")尚未授权";
                    }
                }

                if (validErrMsg != string.Empty)
                {
                    if (NGCOM.Instance.Product.ToUpper() == "I6" || NGCOM.Instance.Product.ToUpper() == "I6P")
                    {
                        return(false);
                    }
                    else
                    {
                        //A3,GE产品如果授权为0等情况,再判断是否按演示版使用
                        if (this.HTNotUseModuleWhereDemo.ContainsKey(strModuleid))
                        {
                            validErrMsg = "此模块不允许使用";
                            return(false);
                        }
                        else
                        {
                            validErrMsg = "此模块按演示版打开";
                            return(true);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                //未购买
                if (NGCOM.Instance.Product.ToUpper() == "I6" || NGCOM.Instance.Product.ToUpper() == "I6P")
                {
                    validErrMsg = "此模块未购买不允许使用";
                    return(false);
                }
                else
                {
                    //未购买-A3,GE演示版判断
                    if (this.HTNotUseModuleWhereDemo.ContainsKey(strModuleid))
                    {
                        validErrMsg = "此模块为演示版且不允许使用";
                        return(false);
                    }
                    else
                    {
                        validErrMsg = "此模块按演示版打开";
                        return(true);
                    }
                }
            }
        }