Beispiel #1
0
        /// <summary>
        /// 方案保存
        /// </summary>
        /// <param name="userid">用户phid</param>
        /// <param name="usertype">用户类型</param>
        /// <param name="dateflag">时间戳</param>
        /// <returns></returns>
        public static bool UserConfigSave(long userid, int usertype, string dateflag)
        {
            string sqlText = "select count(*) from fg3_userconfig where userid = '" + userid + "' and usertype = '" + usertype + "'";
            string obj     = DbHelper.GetString(sqlText);

            if (obj != "0")
            {
                sqlText = "update fg3_userconfig set dateflag = '" + dateflag + "' where userid = '" + userid + "' and usertype = '" + usertype + "'";
                DbHelper.ExecuteNonQuery(sqlText);
                return(true);
            }
            else
            {
                sqlText = "insert into fg3_userconfig(phid,userid,usertype,dateflag) values({0},{1},{2},{3})";

                long phid = GetBillId("fg3_userconfig", "phid");

                NGDataParameter[] dataparams = new NGDataParameter[4];
                dataparams[0]       = new NGDataParameter("phid", DbType.Int64);
                dataparams[0].Value = phid;
                dataparams[1]       = new NGDataParameter("userid", DbType.Int64);
                dataparams[1].Value = userid;
                dataparams[2]       = new NGDataParameter("usertype", DbType.Byte);
                dataparams[2].Value = usertype;
                dataparams[3]       = new NGDataParameter("dateflag", DbType.DateTime);
                dataparams[3].Value = dateflag;

                DbHelper.ExecuteNonQuery(sqlText, dataparams);
                return(true);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 是否存在用户定义的查询条件
        /// </summary>
        /// <param name="pageid"></param>
        /// <param name="ocode"></param>
        /// <param name="logid"></param>
        /// <returns></returns>

        //内嵌查询判断是去系统自定义表中找还是用户自定义找
        //说明:存在以下几种情况:
        //1.master没有数据,那么detail肯定没有数据
        //2.master有数据,detail表没有数据
        //3.master有数据,detail表有数据
        //-------内嵌查询判断语句开始--------------


        //情况master有数据,detail表有数据
        private bool ExistsUserDefineInMasterandDetail(string pageid, string ocode, string logid)
        {
            string sqlindetail = string.Empty;
            string sqlinmaster = string.Empty;

            //注释的语句只适用于sql server,oracle不兼容
            //sql = @"select (
            //        (select COUNT(*) from c_sys_search_def_detail where mst_id IN
            //    (SELECT id FROM c_sys_search_def_master WHERE pageid={0} and userid={1} and cboo = {2}))
            //    +
            //    (SELECT COUNT(*) FROM c_sys_search_def_master WHERE pageid={0} and userid={1} and cboo = {2})
            //    )";
            sqlindetail = @"select COUNT(*) from c_sys_search_def_detail where mst_id IN 
                                (SELECT id FROM c_sys_search_def_master WHERE pageid={0} and userid={1} and cboo = {2})";

            sqlinmaster = @"SELECT COUNT(*) FROM c_sys_search_def_master WHERE pageid={0} and userid={1} and cboo = {2}";

            IDataParameter[] p = new NGDataParameter[3];
            p[0] = new NGDataParameter("helpid", pageid);
            p[1] = new NGDataParameter("userid", logid);
            p[2] = new NGDataParameter("cboo", ocode);

            string sqld = DbHelper.GetString(sqlindetail, p);
            string sqlm = DbHelper.GetString(sqlinmaster, p);
            int    all  = int.Parse(sqld) + int.Parse(sqlm);

            return(all != 0);
        }
Beispiel #3
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="logid"></param>
        /// <param name="oldpwd"></param>
        /// <param name="newpwd"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string ChangePwd(string logid, string oldpwd, string newpwd, ref string msg)
        {
            int iret = -1;

            string sql = "select pwd from secuser where logid={0}";


            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("logid", logid);

            string pwd = DbHelper.GetString(sql, p);

            //旧密码输入不正确
            if (oldpwd != NGEncode.DecodePassword(pwd, 128))
            {
                msg = "旧密码输入不正确";
                return("-1");
            }

            string endcodepwd = NGEncode.EncodePassword(newpwd, 128);

            sql  = "update secuser set pwd='" + endcodepwd + "',chgpwd_date='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where logid='" + logid + "'";
            iret = DbHelper.ExecuteNonQuery(sql);

            return("1");
        }
Beispiel #4
0
        /// <summary>
        /// 获取用户排序数据
        /// </summary>
        /// <param name="pageid"></param>
        /// <param name="ocode"></param>
        /// <param name="logid"></param>
        /// <returns></returns>
        public DataTable GetSortFilterData(string pageid, string ocode, string logid)
        {
            IDataParameter[] p;
            if (this.ExistsUserDefineInDetail(pageid, ocode, logid))
            {
                //filter = " and c_sys_search_def_detail.isplay='1' ";
                StringBuilder strb = new StringBuilder();
                strb.Append(" SELECT c_sys_search.searchfield,c_sys_search_def_detail.sortmode,c_sys_search_def_detail.sortorder ");
                strb.Append(" FROM c_sys_search ");
                strb.Append(" LEFT JOIN c_sys_search_def_master ON c_sys_search.pageid = c_sys_search_def_master.pageid ");
                strb.Append(" LEFT JOIN c_sys_search_def_detail ON (c_sys_search.ccode = c_sys_search_def_detail.code)  and (c_sys_search_def_master.id = c_sys_search_def_detail.mst_id)");
                strb.Append(" WHERE c_sys_search_def_master.userid = {0} AND c_sys_search_def_master.cboo = {1} ");
                strb.Append(" AND c_sys_search_def_master.pageid = {2} AND c_sys_search_def_detail.sortmode <> 0 ORDER BY sortorder ASC ");
                p = new NGDataParameter[] { new NGDataParameter("userid", logid), new NGDataParameter("cboo", ocode), new NGDataParameter("pageid", pageid) };
                return(DbHelper.GetDataTable(strb.ToString(), p));
            }



            string sql = @"SELECT c_sys_search.searchfield,c_sys_search.sortmode,c_sys_search.sortorder
                        FROM c_sys_search                       
                        WHERE pageid = {0} AND c_sys_search.sortmode <> 0  " + " ORDER BY sortorder ASC  ";

            p = new NGDataParameter[] { new NGDataParameter("pageid", pageid) };

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #5
0
        private string GetHeader(string helpid)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select fieldproperty from fg_helpinfo_master,fg_helpinfo_sys ");
            sb.Append(" where fg_helpinfo_master.code = fg_helpinfo_sys.masterid and showheader='1' and fg_helpinfo_master.helpid ={0} ");
            //sb.Append(" union");
            //sb.Append(" select fieldproperty from fg_helpinfo_master,fg_helpinfo_user ");
            //sb.Append(" where fg_helpinfo_master.code = fg_helpinfo_user.masterid and showheader='1' and fg_helpinfo_master.helpid = {0} ");

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("helpid", helpid);
            DataTable dt = DbHelper.GetDataTable(sb.ToString(), p);

            string header = string.Empty;
            int    last   = dt.Rows.Count - 1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string temp = dt.Rows[i]["fieldproperty"].ToString();
                if (i == last)
                {
                    header += temp;
                }
                else
                {
                    header += temp + ",";
                }
            }

            return(header);
        }
Beispiel #6
0
        private string GetFields(string helpid)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select fg_helpinfo_sys.tablename,fieldname,fieldsource,seq,showheader from fg_helpinfo_master,fg_helpinfo_sys ");
            sb.Append(" where fg_helpinfo_master.code = fg_helpinfo_sys.masterid and fg_helpinfo_master.helpid ={0} ORDER BY showheader desc , seq");
            //sb.Append(" union");
            //sb.Append(" select fg_helpinfo_user.tablename,fieldname,fieldsource,seq,showheader from fg_helpinfo_master,fg_helpinfo_user ");
            //sb.Append(" where fg_helpinfo_master.code = fg_helpinfo_user.masterid and fg_helpinfo_master.helpid = {0} ORDER BY showheader desc , seq");

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("helpid", helpid);
            DataTable dt = DbHelper.GetDataTable(sb.ToString(), p);

            string fields = string.Empty;
            int    last   = dt.Rows.Count - 1;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string temp = dt.Rows[i]["tablename"].ToString() + "." + dt.Rows[i]["fieldname"].ToString();
                //string temp = dt.Rows[i]["tablename"].ToString() + "." + DataConverterHelper.FieldToProperty(dt.Rows[i]["tablename"].ToString(), dt.Rows[i]["fieldname"].ToString());

                if (i == last)
                {
                    fields += temp;
                }
                else
                {
                    fields += temp + ",";
                }
            }

            return(fields);
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public DataTable GetList(string userId, string controlId, string names)
        {
            string sql = @"
SELECT 
	phid,
	userid,
	controlid,
	names,
	lasttimes,
	counts
FROM fg3_useful where userid={0} and controlid={1} and names LIKE '" + names + "%'";

            IDataParameter[] p = new NGDataParameter[2];
            p[0] = new NGDataParameter("userid", userId);
            p[1] = new NGDataParameter("controlid", controlId);

            string sortString  = "counts desc,lasttimes desc";
            int    totalRecord = 0;
            int    pageSize    = 10;
            int    pageIndex   = 0;

            string strSql = PaginationAdapter.GetPageDataSql(sql, pageSize, ref pageIndex, ref totalRecord, sortString, p);

            return(DbHelper.GetDataTable(strSql, p));
        }
Beispiel #9
0
        //获取自定义字段组装sql语句, 以逗号分隔
        public string GetIndividualFields(string tname)
        {
            string sql = "select c_name from fg_columns where c_bname = {0} ";

            IDataParameter[] p = new NGDataParameter[1];
            p[0]       = new NGDataParameter("c_bname", DbType.AnsiString);
            p[0].Value = tname;

            DataTable dt = DbHelper.GetDataTable(sql, p);

            if (dt.Rows.Count == 0)
            {
                return(string.Empty);
            }

            StringBuilder strb = new StringBuilder();

            int count = dt.Rows.Count - 1;

            for (int i = 0; i < count; i++)
            {
                strb.Append(dt.Rows[i]["c_name"].ToString());
                strb.Append(",");
            }

            strb.Append(dt.Rows[count]["c_name"].ToString());

            return(strb.ToString());
        }
Beispiel #10
0
 /// <summary>
 /// 保存数据到选项明细表
 /// </summary>
 /// <param name="dt"></param>
 /// <param name="logid"></param>
 /// <returns></returns>
 public int SaveFunData(DataTable dt)
 {
     try
     {
         int rows       = 0;
         int affectrows = 0;
         if (dt.Rows.Count > 0)
         {
             IList <long> phidList = this.GetPhidList(dt.Rows.Count, "phid", 1, "fg3_argument_setting");
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 //dt.Rows[i]["user_mod_flg"] = 0;
                 //dt.Rows[i]["sysflg"] = 0;
                 if (dt.Rows[i]["phid"] == DBNull.Value)
                 {
                     dt.Rows[i]["phid"] = phidList[i];
                     IDataParameter[] parameterList = new IDataParameter[6];
                     parameterList[0]       = new NGDataParameter("phid", DbType.Int64);
                     parameterList[0].Value = phidList[i];
                     parameterList[1]       = new NGDataParameter("detail_phid", DbType.Int64);
                     parameterList[1].Value = dt.Rows[i]["detail_phid"];
                     parameterList[2]       = new NGDataParameter("type", DbType.AnsiString);
                     parameterList[2].Value = dt.Rows[i]["type"];
                     parameterList[3]       = new NGDataParameter("name", DbType.AnsiString);
                     parameterList[3].Value = dt.Rows[i]["name"];
                     parameterList[4]       = new NGDataParameter("id", DbType.AnsiString);
                     parameterList[4].Value = dt.Rows[i]["id"];
                     parameterList[5]       = new NGDataParameter("argument", DbType.AnsiString);
                     parameterList[5].Value = dt.Rows[i]["argument"];
                     rows += DbHelper.ExecuteNonQuery(" INSERT INTO fg3_argument_setting (phid, detail_phid, type, name, id, argument, user_mod_flg, sysflg) VALUES ({0},{1},{2},{3},{4},{5},0,1)", parameterList);
                 }
                 else
                 {
                     IDataParameter[] parameterList = new IDataParameter[4];
                     parameterList[0]       = new NGDataParameter("name", DbType.AnsiString);
                     parameterList[0].Value = dt.Rows[i]["name"];
                     parameterList[1]       = new NGDataParameter("id", DbType.AnsiString);
                     parameterList[1].Value = dt.Rows[i]["id"];
                     parameterList[2]       = new NGDataParameter("argument", DbType.AnsiString);
                     parameterList[2].Value = dt.Rows[i]["argument"];
                     parameterList[3]       = new NGDataParameter("phid", DbType.Int64);
                     parameterList[3].Value = Convert.ToInt64(dt.Rows[i]["phid"]);
                     //parameterList[3] = new NGDataParameter("modifytime", DbType.DateTime);
                     //parameterList[3].Value = DateTime.Now;
                     //parameterList[4] = new NGDataParameter("modifyuser", DbType.AnsiString);
                     //parameterList[4].Value = logid;
                     affectrows = DbHelper.ExecuteNonQuery(" update fg3_argument_setting set name={0} , id={1},argument={2} where phid={3} ", parameterList);
                 }
             }
             //rows = DbHelper.Update(dt, "select * from fg3_argument_setting");
         }
         return(rows + affectrows);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #11
0
        /// <summary>
        /// 获取明细表的字段信息
        /// </summary>
        /// <param name="masterId"></param>
        /// <returns></returns>
        public DataTable GetDetailTableField(string masterId)
        {
            string sql = "select * from fg_helpinfo_detailtable where masterid={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("masterid", masterId);

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #12
0
        public DataTable GetRichQuery(string masterId)
        {
            string sql = "select * from fg_helpinfo_richquery where masterid={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("masterid", masterId);

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #13
0
        /// <summary>
        /// 获取某一业务类型的自定义信息列表
        /// </summary>
        /// <param name="bustype">业务类型</param>
        /// <returns></returns>
        public DataTable GetIndividualInfoList(string bustype)
        {
            string sql = "select phid,name,bustype,defaultflg,isbackup,remark from fg_individualinfo where bustype={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0]       = new NGDataParameter("bustype", DbType.AnsiString);
            p[0].Value = bustype ?? string.Empty;

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #14
0
        public void UpdateMyDesktopInfo(byte[] buffer, long userid, int usertype)
        {
            string sqlText = "update fg3_mydesktop set data = {0} where userid = " + userid + " and usertype = " + usertype;

            NGDataParameter[] dataparams = new NGDataParameter[1];
            dataparams[0]       = new NGDataParameter("data", DbType.Binary);
            dataparams[0].Value = buffer;

            DbHelper.ExecuteNonQuery(sqlText, dataparams);
        }
Beispiel #15
0
        public DataTable GetColumnInfo(string tname)
        {
            string sql = "select fieldname,fieldchn,c_type from fg_columns where tname = {0} and listshow_flg='1'";

            IDataParameter[] p = new NGDataParameter[1];
            p[0]       = new NGDataParameter("tname", DbType.AnsiString);
            p[0].Value = tname;

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #16
0
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="logid">操作员id</param>
        /// <param name="username">操作员名字</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public bool AddUser(string logid, string username, string pwd, long maxid)
        {
            string count = DbHelper.GetString("select count(*) from secuser where logid='" + logid + "'");

            if (count.ToString() != "0")
            {
                throw new Exception("用户[" + logid + "]已存在!");
            }

            string endcodepwd = NGEncode.EncodePassword(pwd, 128);

            string sql = "insert into secuser (logid,u_name,pwd,lg_sign,creadate) values ({0},{1},{2},{3},{4})";

            IDataParameter[] p = new NGDataParameter[5];
            p[0]       = new NGDataParameter("logid", DbType.AnsiString);
            p[0].Value = logid;
            p[1]       = new NGDataParameter("username", DbType.AnsiString);
            p[1].Value = username;
            p[2]       = new NGDataParameter("pwd", DbType.AnsiString);
            p[2].Value = endcodepwd;
            p[3]       = new NGDataParameter("lg_sign", DbType.AnsiString);
            p[3].Value = "1";

            p[4]       = new NGDataParameter("creadate", DbType.Date);
            p[4].Value = DateTime.Now;

            int iret = DbHelper.ExecuteNonQuery(sql, p);

            //处理fg_orgpop
            //string maxid = DbHelper.GetString("select MAX(id) from fg_orgpop");
            //int id;
            //Int32.TryParse(maxid, out id);

            sql = "insert into fg_orgpop (id,ug_code,u_soft,ocode) values({0},{1},{2},{3})";

            IDataParameter[] param = new NGDataParameter[4];
            param[0]       = new NGDataParameter("id", DbType.Int64);
            param[0].Value = maxid;
            param[1]       = new NGDataParameter("ug_code", DbType.AnsiString);
            param[1].Value = username;
            param[2]       = new NGDataParameter("u_soft", DbType.AnsiString);
            param[2].Value = "01";//类型,01是用户
            param[3]       = new NGDataParameter("ocode", DbType.AnsiString);
            param[3].Value = NG3.AppInfoBase.OCode;
            iret          += DbHelper.ExecuteNonQuery(sql, param);

            if (iret > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #17
0
        public DataTable GetQueryProperty(string masterId)
        {
            string sql = "select * from fg_helpinfo_queryprop where masterid={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("masterid", masterId);

            DataTable dt = DbHelper.GetDataTable(sql, p);

            return(dt);
        }
Beispiel #18
0
        public DataTable GetMaster(string id)
        {
            string sql = "select * from fg_helpinfo_master where code={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("code", id);

            DataTable dt = DbHelper.GetDataTable(sql, p);

            return(dt);
        }
Beispiel #19
0
        /// <summary>
        /// 根据业务类型获取表注册信息
        /// </summary>
        /// <param name="bustype"></param>
        /// <returns></returns>
        public DataTable GetTableRegByBusType(string bustype)
        {
            //string sql = "select code,tname,uitype from fg_table_reg where bustype={0}";
            string sql = "select distinct fg_columns.c_bname from fg_col_uireg,fg_columns "
                         + " where fg_col_uireg.columnreg_code = fg_columns.c_code "
                         + " and bustype={0} ";

            IDataParameter[] p = new NGDataParameter[1];
            p[0]       = new NGDataParameter("bustype", DbType.AnsiString);
            p[0].Value = bustype;

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #20
0
        //-----------自定义查询-----------------

        /// <summary>
        /// 获取自定义查询界面信息
        /// </summary>
        /// <param name="pageid">帮助id</param>
        /// <param name="ocode">组织号</param>
        /// <param name="logid">操作员</param>
        /// <returns></returns>
        public DataTable GetIndividualQueryPanelInfo(string pageid, string ocode, string logid, bool showAll = false)
        {
            string filter      = " and c_sys_search.isplay='1' ";
            string filter_user = "******";

            if (showAll)
            {
                filter = string.Empty;//不过滤
            }

            if (showAll)
            {
                filter_user = string.Empty;//不过滤
            }
            //string filter_user = "******";

            IDataParameter[] p;
            if (this.ExistsUserDefineInDetail(pageid, ocode, logid))
            {
                //filter = " and c_sys_search_def_detail.isplay='1' ";
                StringBuilder strb = new StringBuilder();
                strb.Append(" SELECT c_sys_search.combflg,c_sys_search_def_detail.displayindex,c_sys_search.fieldtype,");
                strb.Append("c_sys_search.datasource,c_sys_search.controlflag,c_sys_search.controltype,c_sys_search.ismulti");
                strb.Append(" ,c_sys_search.sqlfilter,c_sys_search.maxlength,c_sys_search_def_detail.isplay,c_sys_search.matchfieldwidth,c_sys_search.isaddtowhere " +
                            ",c_sys_search.searchfield ,c_sys_search.searchtable, c_sys_search.fname_chn,c_sys_search.langkey,c_sys_search.ccode,c_sys_search.pageid, ");
                strb.Append(" c_sys_search_def_detail.defaultdata,c_sys_search_def_detail.sortmode,c_sys_search_def_detail.sortorder, '用户定义' AS definetype ");
                strb.Append(" FROM c_sys_search ");
                strb.Append(" LEFT JOIN c_sys_search_def_master ON c_sys_search.pageid = c_sys_search_def_master.pageid ");
                strb.Append(" LEFT JOIN c_sys_search_def_detail ON (c_sys_search.ccode = c_sys_search_def_detail.code)  and (c_sys_search_def_master.id = c_sys_search_def_detail.mst_id)");
                strb.Append(" WHERE c_sys_search_def_master.userid = {0} AND c_sys_search_def_master.cboo = {1} ");
                strb.Append(filter_user);
                strb.Append(" AND c_sys_search_def_master.pageid = {2}  ORDER BY displayindex ASC ");
                p = new NGDataParameter[] { new NGDataParameter("userid", logid), new NGDataParameter("cboo", ocode), new NGDataParameter("pageid", pageid) };
                return(DbHelper.GetDataTable(strb.ToString(), p));
            }



            string sql = @"SELECT playindex AS displayindex,'系统定义' AS definetype, 
                        c_sys_search.defaultdata,
                        c_sys_search.datasource,c_sys_search.controlflag,c_sys_search.controltype,c_sys_search.ismulti,
                        c_sys_search.sqlfilter, c_sys_search.maxlength,c_sys_search.isplay,c_sys_search.matchfieldwidth,c_sys_search.isaddtowhere,
                        c_sys_search.searchtable,c_sys_search.searchfield,c_sys_search.fname_chn ,c_sys_search.langkey, c_sys_search.ccode,c_sys_search.pageid,
                        c_sys_search.combflg,c_sys_search.fieldtype,c_sys_search.sortmode,c_sys_search.sortorder
                        FROM c_sys_search                       
                        WHERE pageid = {0} " + filter + " ORDER BY displayindex ASC  ";

            p = new NGDataParameter[] { new NGDataParameter("pageid", pageid) };

            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #21
0
        private bool ExistsUserDefineInDetail(string pageid, string ocode, string logid)
        {
            string sql = string.Empty;

            sql = @"select COUNT(*) from c_sys_search_def_detail where mst_id IN  
                (SELECT id FROM c_sys_search_def_master WHERE pageid={0} and userid={1} and cboo = {2})";

            IDataParameter[] p = new NGDataParameter[3];
            p[0] = new NGDataParameter("helpid", pageid);
            p[1] = new NGDataParameter("userid", logid);
            p[2] = new NGDataParameter("cboo", ocode);

            return(DbHelper.GetString(sql, p) != "0");
        }
Beispiel #22
0
        /// <summary>
        /// 获取列信息
        /// </summary>
        /// <param name="tableregcode"></param>
        /// <returns></returns>
        public DataTable GetColumnsInfo(string tablename)
        {
            //string sql = "select * from fg_column_reg where tablereg_code={0}";

            string sql = "select * from fg_columns where c_kind='user' and c_bname={0} order by c_name";

            IDataParameter[] p = new NGDataParameter[1];
            p[0]       = new NGDataParameter("c_bname", DbType.AnsiString);
            p[0].Value = tablename;

            DataTable dt = DbHelper.GetDataTable(sql, p);

            return(dt);
        }
Beispiel #23
0
        public int Update(long phid, DateTime lasttimes, int counts)
        {
            string sql = @"
UPDATE fg3_useful
SET lasttimes = {0}, counts = {1}
WHERE phid = {2}
";

            IDataParameter[] p = new NGDataParameter[3];
            p[0] = new NGDataParameter("lasttimes", lasttimes);
            p[1] = new NGDataParameter("counts", counts);
            p[2] = new NGDataParameter("phid", phid);
            return(DbHelper.ExecuteNonQuery(sql, p));
        }
Beispiel #24
0
        //保存自定义界面
        public int SaveIndividualUI(Int64 phid, string uiinfo)
        {
            //string sql = string.Format("update fg_individualinfo set individualinfo={0} where phid={1}",DbConvert.ToSqlString(uiinfo),phid);
            //return DbHelper.ExecuteNonQuery(sql);

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

            IDataParameter[] p = new NGDataParameter[2];
            p[0]       = new NGDataParameter("individualinfo", NGDbType.Text);
            p[0].Value = uiinfo;
            p[1]       = new NGDataParameter("phid", DbType.Int64);
            p[1].Value = phid;
            return(DbHelper.ExecuteNonQuery(sql, p));
        }
Beispiel #25
0
        private DataTable GetMasterInfo(string helpid)
        {
            string sql = "select * from fg_helpinfo_master where helpid={0}";

            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("helpid", helpid);
            DataTable dt = DbHelper.GetDataTable(sql, p);

            if (dt.Rows.Count == 0)
            {
                throw new Exception("helpid:" + helpid + " is not found");
            }

            return(dt);
        }
Beispiel #26
0
        public int Insert(long phid, string userid, string controlid, string names, DateTime lasttimes, int counts)
        {
            string sql = @"
INSERT INTO fg3_useful (phid, userid, controlid, names, lasttimes, counts)
VALUES ({0}, {1}, {2},{3},{4},{5}) ";

            IDataParameter[] p = new NGDataParameter[6];
            p[0] = new NGDataParameter("phid", phid);
            p[1] = new NGDataParameter("userid", userid);
            p[2] = new NGDataParameter("controlid", controlid);
            p[3] = new NGDataParameter("names", names);
            p[4] = new NGDataParameter("lasttimes", lasttimes);
            p[5] = new NGDataParameter("counts", counts);
            return(DbHelper.ExecuteNonQuery(sql, p));
        }
Beispiel #27
0
        /// <summary>
        /// 获得表注册信息
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public DataTable GetTableRegInfo(string tablename, Int64 busPhid)
        {
            //string sql = "select * from fg_table_reg where code={0}";
            //string sql = "select * from fg_table where c_name={0}";
            string sql = "select * from  metadata_bustable where tname={0} and busphid={1}";

            IDataParameter[] p = new NGDataParameter[2];
            p[0]       = new NGDataParameter("tname", DbType.AnsiString);
            p[0].Value = tablename;
            p[1]       = new NGDataParameter("busphid", DbType.UInt64);
            p[1].Value = busPhid;


            return(DbHelper.GetDataTable(sql, p));
        }
Beispiel #28
0
        /// <summary>
        /// 添加数据到快捷功能表
        /// </summary>
        /// <param name="originalcode"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public string AddShortcutMenu(string originalcode, string name, string url, string busphid)
        {
            string        userType   = NG3.AppInfoBase.UserType;
            long          userid     = NG3.AppInfoBase.UserID;
            int           affectRows = 0;
            int           iret       = 0;
            StringBuilder strbuilder = new StringBuilder();
            DataTable     dt         = new DataTable();

            strbuilder.Append("select * from fg3_shortcutmenu");
            strbuilder.Append(" where originalcode='" + originalcode + "' and userid=" + userid + "");
            dt = DbHelper.GetDataTable(strbuilder.ToString());
            if (dt.Rows.Count > 0)
            {
                return("请勿重复添加快捷菜单!");
            }
            else
            {
                IDataParameter[] parameterList = new IDataParameter[7];
                parameterList[0]       = new NGDataParameter("originalcode", DbType.AnsiString);
                parameterList[0].Value = originalcode;
                parameterList[1]       = new NGDataParameter("name", DbType.AnsiString);
                parameterList[1].Value = name;
                parameterList[2]       = new NGDataParameter("seq", DbType.Int32);
                parameterList[2].Value = this.GetMaxSeq() + 1;
                parameterList[3]       = new NGDataParameter("userid", DbType.Int64);
                parameterList[3].Value = userid;
                parameterList[4]       = new NGDataParameter("url", DbType.AnsiString);
                parameterList[4].Value = url;
                long phid = this.GetSinglePhid("phid", 20, "fg3_shortcutmenu");
                parameterList[5]       = new NGDataParameter("phid", DbType.Int64);
                parameterList[5].Value = phid;
                long busid = string.IsNullOrEmpty(busphid) ? 0 : Convert.ToInt64(busphid);
                parameterList[6]       = new NGDataParameter("busphid", DbType.Int64);
                parameterList[6].Value = busid;
                if (phid == -9999)
                {
                    return("未能插入phid");
                }
                else
                {
                    string sql = "insert into fg3_shortcutmenu (phid,originalcode, name, userType, userid,seq,url,busphid) VALUES (" + phid + ",'" + originalcode + "','" + name + "',0," + userid + "," + (this.GetMaxSeq() + 1) + ",'" + url + "'," + busid + ")";
                    //affectRows = DbHelper.ExecuteNonQuery("insert into fg3_shortcutmenu (originalcode, name, userType, userid) VALUES ({0},{1},0,{2})", parameterList);
                    affectRows = DbHelper.ExecuteNonQuery(sql);
                    return("");
                }
            }
        }
Beispiel #29
0
        /// <summary>
        /// 更新记忆数据
        /// </summary>
        /// <param name="layoutLogInfo"></param>
        /// <returns></returns>
        public int UpdateLayoutlog(LayoutLogInfo layoutLogInfo)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("update fg_layoutlog set bustype={0},logid={1},value={2} ");
            sql.Append(" where gid={3}");

            NGDataParameter[] paramList = new NGDataParameter[4];

            paramList[0] = new NGDataParameter("bustype", layoutLogInfo.Bustype);
            paramList[1] = new NGDataParameter("logid", layoutLogInfo.Logid);
            paramList[2] = new NGDataParameter("value", NGDbType.Text, layoutLogInfo.Value);
            paramList[3] = new NGDataParameter("gid", layoutLogInfo.Gid);

            return(DbHelper.ExecuteNonQuery(sql.ToString(), paramList));
        }
Beispiel #30
0
        public void InsertMyDesktopInfo(long phid, byte[] buffer, long userid, int usertype)
        {
            string sqlText = "insert into fg3_mydesktop(phid,data,userid,usertype) values({0},{1},{2},{3})";

            NGDataParameter[] dataparams = new NGDataParameter[4];
            dataparams[0]       = new NGDataParameter("phid", DbType.Int64);
            dataparams[0].Value = phid;
            dataparams[1]       = new NGDataParameter("data", DbType.Binary);
            dataparams[1].Value = buffer;
            dataparams[2]       = new NGDataParameter("userid", DbType.String);
            dataparams[2].Value = userid;
            dataparams[3]       = new NGDataParameter("usertype", DbType.Byte);
            dataparams[3].Value = usertype;

            DbHelper.ExecuteNonQuery(sqlText, dataparams);
        }