示例#1
0
        /// <summary>
        /// addRow: 添加树节点
        /// </summary>
        /// <param name="_table">表名</param>
        /// <param name="_keys">字段列表</param>
        /// <param name="_values">值列表</param>
        /// <returns></returns>
        public string addRow(string _table, string _keys, string _values)
        {
            if (Native.isEmpty(_keys) || Native.isEmpty(_values))
            {
                return("");
            }
            string _result = String.Empty;
            string sql     = MString.getInsertStr(_table, _keys, _values, true);

            try
            {
                DBUtil.onExecSqlBefore(_CLASS, "addRow", sql);
                cmd.CommandText = @sql;
                state           = ConnectionState.Executing;
                object _rObj = cmd.ExecuteScalar();
                if (_rObj != null)
                {
                    _result = _rObj.ToString();
                }
            }
            catch (Exception e)
            {
                _result = Native.getErrorMsg(e.Message);
                DBUtil.onExecSqlError(_CLASS, "addRow", sql, e.Message);
            }
            return(_result);
        }
示例#2
0
        /// <summary>
        /// addTreeNode: 添加树节点
        /// </summary>
        /// <param name="_table">表名</param>
        /// <param name="_pid">父节点ID</param>
        /// <param name="_keys">字段列表</param>
        /// <param name="_values">值列表</param>
        /// <returns>返回当前树节点ID</returns>
        public string addTreeNode(string _table, int _pid, string _keys, string _values)
        {
            string _val = String.Empty;

            if (_pid == 0)
            {
                return(execScalar(MString.getInsertStr(_table, _keys, _values, true)));
            }
            Json _pre = execJson(MString.getSelectStr(_table, "*", "id=" + _pid));

            if (_pre != null)
            {
                string _treeOrder = execScalar("select max(treeOrder)+1 from {0} where delFlag=0 and pid={1};", _table, _pid).ToString();
                if (Native.isEmpty(_treeOrder))
                {
                    _treeOrder = "1";
                }
                string _k = _keys + ",parentPath,treeOrder,depth";
                string _v = _values + ",'" + _pre.getString("parentPath") + _pid + ",'," + _treeOrder + "," + (_pre.getInt("depth") + 1);
                if (_k.IndexOf("pid") == -1)
                {
                    _k += ",pid"; _v += "," + _pid;
                }
                _val = execScalar(MString.getInsertStr(_table, _k, _v, true));
                execNonQuery(MString.getUpdateStr(_table, "sons=sons+1", "id=" + _pid));
            }
            else
            {
                _val = Native.getErrorMsg("在表({0})中pid={1}的节点不存在", _table, _pid);
            }
            return(_val);
        }
示例#3
0
        public string reStart(int wfID, string jsonStr, string ext = "")
        {
            SqlTrans trans   = new SqlTrans(api);
            string   _return = String.Empty;

            try
            {
                Json _sNode = trans.execJson(MString.getSelectStr(R.Table.WF_INSTANCE, "oid,state", "id=" + wfID));
                if (_sNode.getInt("state") == S_CANCLED)
                {
                    trans.execNonQuery(MString.getUpdateStr(R.Table.WF_INSTANCE, "state=" + S_NORMAL, wfID));
                }
                else
                {
                    _return = Native.getErrorMsg("流程重启失败!");
                }
                trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message + "--WFInstance--reStart");
                trans.rollback();
            }
            finally
            {
                trans.close();
            }
            return(_return);
        }
示例#4
0
        /// <summary>
        /// createDB: 创建数据库
        /// </summary>
        /// <param name="_DBName">数据库名</param>
        /// <returns></returns>
        public string createDB(string _DBName, string _DataPath)
        {
            string   _val = String.Empty, _copyTableSQLs = String.Empty;
            SqlTrans _trans = new SqlTrans(this);
            string   _sql   = @"use master;
                                if exists (select * from sysdatabases where name='{0}') drop database {0};
                                EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
                                EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;
                                exec xp_cmdshell 'mkdir {1}', NO_OUTPUT;
                                create database {0}
                                on primary (name='{0}_data',fileName='{1}\\{0}_data.mdf',size=10MB,filegrowth=10%)
                                log on (name='{0}_log',fileName='{1}\\{0}_data.ldf',size=1MB,maxsize=20MB,filegrowth=10%)";

            helper.execNonQuery(_sql, _DBName, _DataPath);
            string[] _tables = execQuery("Select name FROM {0}..SysObjects Where XType='U' and charindex('SYS_',name)<>1 ORDER BY Name;", DB_TEMPLATE).Split(getRSplit().ToCharArray());
            for (int i = 0, _len = _tables.GetLength(0); i < _len; i++)
            {
                _copyTableSQLs += MString.format("select * into {0}.dbo.{2} from {1}.dbo.{2};", _DBName, DB_TEMPLATE, _tables[i]);
            }
            try
            {
                _trans.execNonQuery(_copyTableSQLs);
                _trans.commit();
            }
            catch (Exception e)
            {
                _val = e.Message;
                _trans.rollback();
            }
            finally
            {
                _trans.close();
            }
            return(_val);
        }
示例#5
0
        public string getAllStepUsers(SqlTrans trans, int wfId)
        {
            Hashtable _table = new Hashtable();

            string[] _idsTAry, _idsAry = trans.execReader(MString.getSelectStr("SYS_WF_INSTANCE", "owner", "pid=" + wfId)).Split(trans.getBaseApi().getRSplit().ToCharArray());
            string   _val = ",", _key;

            for (int i = 0; i < _idsAry.Length; i++)
            {
                _idsTAry = _idsAry[i].Split(',');
                for (int j = 0; j < _idsTAry.Length; j++)
                {
                    _key = _idsTAry[j];
                    if (!Native.isEmpty(_key) && !_table.ContainsKey(_key))
                    {
                        _table.Add(_key, true);
                    }
                }
            }
            ArrayList akeys = new ArrayList(_table.Keys);

            akeys.Sort();
            for (int i = 0; i < akeys.Count; i++)
            {
                _val += akeys[i] + ",";
            }
            return(_val);
        }
示例#6
0
        /// <summary>
        /// nextSUBPROCESS: 子流程节点的下一步扭转
        /// </summary>
        /// <param name="currID"></param>
        /// <param name="nextID"></param>
        /// <param name="jsonStr"></param>
        /// <param name="ext"></param>
        /// <returns></returns>
        private string nextSUBPROCESS(int currID, int nextID, string jsonStr, string ext = "")
        {
            string   _return = String.Empty;
            SqlTrans trans   = new SqlTrans(api);
            bool     _ifNext = false;

            try
            {
                string _count = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "count(*)", "pid=" + currID + " and state<>-1"));
                if (_count == "0")
                {
                    _ifNext = true;
                }
                trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message + "--WFInstance--nextSUBPROCESS");
                trans.rollback();
            }
            finally
            {
                trans.close();
            }
            if (_ifNext)
            {
                _return = nextNORMAL(currID, nextID, jsonStr, ext);
            }
            return(_return);
        }
示例#7
0
        //仓库流程执行完之后的回调
        #region 收料完成回调
        /// <summary>
        /// 收料完成回调
        /// </summary>
        /// <param name="_tkId">收料单据ID</param>
        /// <returns></returns>
        public string onReceiveComplete(string _tkId)
        {
            string   _sql = String.Empty, _return = String.Empty;
            SqlTrans _trans = new SqlTrans(api);

            try
            {
                Json          _rJson      = _trans.execJson("select code,whId from {0} where id={1};", R.Table.TK_WH_RECEIVE, _tkId);
                string        _code       = _rJson.getValue("code");
                StringBuilder _noQuerySql = new StringBuilder();
                _noQuerySql.Append(MString.getUpdateStr(R.Table.TK_WH_RECEIVE, "state=" + R.WorkFlow.OVER, Convert.ToInt16(_tkId)));
                _noQuerySql.Append(MString.getUpdateStr(R.Table.TK_WH_RECEIVE_DETAIL, "state=1, receiveCode='" + _code + "'", "oid=" + Convert.ToInt16(_tkId)));
                _trans.execNonQuery(_noQuerySql.ToString());
                _return = _tkId;
                _trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message);
                _trans.rollback();
            }
            finally
            {
                _trans.close();
            }
            return(_return);
        }
示例#8
0
        /// <summary>
        /// Draw text
        /// </summary>
        /// <param name="text">Text to drawn</param>
        /// <param name="x">X position in pixel</param>
        /// <param name="y">Y position in pixel</param>
        /// <param name="align">Horizontal alignment</param>
        /// <param name="color">Color</param>
        /// <param name="xScale">X Scale</param>
        /// <param name="yScale">Y Scale</param>
        /// <param name="font">Font</param>
        /// <param name="shadowOffset">Offset of shadow</param>
        /// <param name="shadowColor">Color of shadow</param>
        /// <param name="screenHeight">Height of screen in pixel</param>
        /// <param name="screenWidth">Width of screen in pixel</param>
        public static void DrawText(MString text, int x, int y, GlobalConst.HAlign align, Color color, float xScale = 0.35f, float yScale = 0.35f, GTA.Font font = GTA.Font.ChaletLondon, Point shadowOffset = new Point(), Color shadowColor = new Color(), int screenWidth = GlobalConst.DEFAULT_SCREEN_WIDTH, int screenHeight = GlobalConst.DEFAULT_SCREEN_HEIGHT)
        {
            if (shadowOffset.X != 0 || shadowOffset.Y != 0)
            {
                DrawText(text, x + shadowOffset.X, y + shadowOffset.Y, align, shadowColor, xScale, yScale, font, new Point(), Color.Black, screenWidth, screenHeight);
            }
            Function.Call(Hash.SET_TEXT_FONT, (int)font);
            Function.Call(Hash.SET_TEXT_SCALE, xScale, yScale);
            Function.Call(Hash.SET_TEXT_COLOUR, color.R, color.G, color.B, color.A);
            switch (align)
            {
                case GlobalConst.HAlign.Left:
                    Function.Call(Hash.SET_TEXT_CENTRE, 0);
                    break;

                case GlobalConst.HAlign.Center:
                    Function.Call(Hash.SET_TEXT_CENTRE, 1);
                    break;

                case GlobalConst.HAlign.Right:
                    Function.Call(Hash.SET_TEXT_RIGHT_JUSTIFY, 1);
                    break;
            }
            Function.Call(Hash._SET_TEXT_ENTRY, "STRING");
            Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, ML(text));
            Function.Call(Hash._DRAW_TEXT, (float)x / screenWidth, (float)y / screenHeight);
        }
示例#9
0
        /// <summary>
        /// 退料完成回调
        /// </summary>
        /// <param name="_tkId">退料单据ID</param>
        /// <returns></returns>
        public string onBackComplete(string _tkId)
        {
            string   _sql = String.Empty, _return = String.Empty;
            SqlTrans _trans = new SqlTrans(api);

            try
            {
                ArrayList     _msInfos    = _trans.execJsonList("select * from {0} where oid={1} and sendId<>0;", R.Table.TK_WH_BACK_DETAIL, _tkId);
                Json          _rJson      = _trans.execJson("select code,whId from {0} where id={1};", R.Table.TK_WH_BACK, _tkId);
                string        _bCode      = _rJson.getValue("code");
                StringBuilder _noQuerySql = new StringBuilder();
                for (int i = 0, _len = _msInfos.Count; i < _len; i++)
                {
                    Json   _MS = (Json)_msInfos[i];
                    int    _msID = _MS.getInt("msId"), _whId = _MS.getInt("whId"), _bId = _MS.getInt("batchId");
                    double _num = _MS.getDouble("number"), _price = _MS.getDouble("price"), _msCostCount = _MS.getDouble("sum");
                    if (_bId == 0)
                    {
                        string _keys    = "type,batchCode,whId,msId,price,totalNum,remainNum";
                        string _values  = "453,'" + _bCode + "'," + _whId + "," + _msID + "," + _price + "," + _num + "," + _num;
                        int    _batchId = Convert.ToInt16(_trans.execScalar(MString.getInsertStr(R.Table.WH_MS_BATCH, _keys, _values, true)));
                        Json   _TSTOCK  = _trans.execJson("select id from {0} where whId={1} and msId={2};", "SYS_WH_STOCK", _whId, _msID);
                        if (_TSTOCK == null)
                        {
                            _trans.execNonQuery(MString.getInsertStr(R.Table.WH_MS_STOCK, "whId,msId,totalSum,number", _whId + "," + _msID + "," + _msCostCount + "," + _num));
                        }
                        else
                        {
                            _trans.execNonQuery(MString.getUpdateStr(R.Table.WH_MS_STOCK, "number=number+" + _num + ",totalSum=totalSum+" + _msCostCount, "whId=" + _whId + " and msId=" + _msID));
                        }
                        Json _rd = _trans.execJson("select number,totalSum from {0} where whId={1} and msId={2};", R.Table.WH_MS_STOCK, _whId, _msID);
                        _noQuerySql.Append("update " + R.Table.TK_WH_BACK_DETAIL + " set mTime=getdate(), batchId=" + _batchId + ", batchCode='" + _bCode + "', totalCount=" + _rd.getDouble("number") + ", balance=" + _rd.getDouble("totalSum") + "  where id=" + _MS.getInt("id") + ";");
                        _noQuerySql.Append(MString.getUpdateStr(R.Table.WH_MS, "avgPrice=(select cast((sum(totalSum)+" + _msCostCount + ")/(sum(number)+" + _num + ") as numeric(18,2)) from " + R.Table.WH_MS_STOCK + " where msId=" + _msID + "), price=" + _price, _msID));
                    }
                    else
                    {
                        _trans.execNonQuery(MString.getUpdateStr(R.Table.WH_MS_BATCH, "remainNum=remainNum+" + _MS.getDouble("number"), _bId));
                        _trans.execNonQuery(MString.getUpdateStr(R.Table.WH_MS_STOCK, "number=number+" + _num + ",totalSum=totalSum+" + _msCostCount, "whId=" + _whId + " and msId=" + _msID));
                        Json _rd = _trans.execJson("select number,totalSum from {0} where whId={1} and msId={2};", R.Table.WH_MS_STOCK, _whId, _msID);
                        _noQuerySql.Append(MString.getUpdateStr(R.Table.TK_WH_BACK_DETAIL, "totalCount=" + _rd.getDouble("number") + ", balance=" + _rd.getDouble("totalSum"), "id=" + _MS.getInt("id")));
                        _noQuerySql.Append(MString.getUpdateStr(R.Table.WH_MS, "avgPrice=(select cast((sum(totalSum)+" + _msCostCount + ")/(sum(number)+" + _num + ") as numeric(18,2)) from " + R.Table.WH_MS_STOCK + " where msId=" + _msID + "), price=" + _price, _msID));
                    }
                    _noQuerySql.Append(MString.getUpdateStr(R.Table.TK_WH_SEND_DETAIL, "remainNum=remainNum-" + _num, _MS.getInt("sendId")));
                }
                _noQuerySql.Append(MString.getUpdateStr(R.Table.TK_WH_BACK, "state=" + R.WorkFlow.OVER, Convert.ToInt16(_tkId)));
                _trans.execNonQuery(_noQuerySql.ToString());
                _return = _tkId;
                _trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message);
                _trans.rollback();
            }
            finally
            {
                _trans.close();
            }
            return(_return);
        }
示例#10
0
        /// <summary>
        /// 物资收料
        /// </summary>
        /// <param name="tk_form">单据表单信息</param>
        /// <param name="MSInfos">物资具体信息</param>
        /// <returns></returns>
        public string receive(string tk_form, string MSInfos, int wfIdx)
        {
            string   _return = String.Empty, _code = MConvert.getValue(tk_form, "code");
            string   _wfId = (new WFIndex(wfIdx, api)).addInstance("施工工程收料单号:" + _code, "");
            SqlTrans trans = new SqlTrans(api);

            try
            {
                string[] _kv = MConvert.toKV(tk_form);
                string   _users = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "owner", "id=" + _wfId)), _proId = MConvert.getValue(tk_form, "proId");
                string   _newID  = trans.addRow(R.Table.TK_WH_RECEIVE, _kv[0] + ",wfId,users,observers", _kv[1] + "," + _wfId + ",'" + _users + "','" + _users + "'");
                string[] infoAry = MSInfos.Split('^');
                for (int i = 0, _len = infoAry.Length; i < _len; i++)
                {
                    string[] _tKV = MConvert.toKV(infoAry[i]);
                    trans.execNonQuery(MString.getInsertStr(R.Table.TK_WH_RECEIVE_DETAIL, _tKV[0] + ", oid, proId", _tKV[1] + "," + _newID + "," + _proId));
                }
                _return = _newID;
                trans.commit();
            }
            catch (Exception e)
            {
                trans.rollback();
                _return = Native.getErrorMsg(e.Message);
            }
            finally {
                trans.close();
            }
            return(_return);
        }
示例#11
0
        /// <summary>
        /// runNext: 根据当前节点和下一个节点id运行扭转的回调函数
        /// </summary>
        /// <param name="_currDefinedID">当前节点的定义节点ID</param>
        /// <param name="_nextDefinedID">下一个节点的定义节点ID</param>
        public static void runNext(int _currDefinedID, int _nextDefinedID, string _currOwners, string _nextOwners)
        {
            SqlTrans trans = new SqlTrans(DBUtil.getBaseApi());

            try
            {
                //ArrayList _cRules = trans.execJsonList("select type, itemKey, itemValue from {0} where oid={1};", T_rule, _currDefinedID);
                ArrayList _nRules = trans.execJsonList("select type, itemKey, itemValue from {0} where oid={1};", R.Table.WF_RULE, _nextDefinedID);
                //ArrayList _cOwners = trans.execJsonList(MString.getSelectStr("SYS_CM_USER", "id,email", "charindex(','+cast(id as varchar(10))+',','" + _currOwners + "')<>0"));
                ArrayList _nOwners = trans.execJsonList(MString.getSelectStr("SYS_CM_USER", "id,email", "charindex(','+cast(id as varchar(10))+',','" + _nextOwners + "')<>0"));
                //if (_cRules != null) { for (int _c = 0, _cLen = _cRules.Count; _c < _cLen; _c++) { runCurrRule((Json)_cRules[_c], _cOwners); } }
                if (_nRules != null)
                {
                    for (int _n = 0, _nLen = _nRules.Count; _n < _nLen; _n++)
                    {
                        runNextRule((Json)_nRules[_n], _nOwners, trans);
                    }
                }
                trans.commit();
            }
            catch (Exception e)
            {
                trans.rollback();
                Native.write(e.Message);
            }
            finally {
                trans.close();
            }
        }
示例#12
0
        public string enabledMail(int uid)
        {
            string _sql = MString.format(@"
                if not exists(select * from sysobjects where name='{0}')
                CREATE TABLE [dbo].[{0}](
	                [id] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY,
	                [nodeName] [nvarchar](300) COLLATE Chinese_PRC_CI_AS DEFAULT (''),
	                [pid] [bigint] DEFAULT (0),
	                [depth] [int] DEFAULT (0),
	                [parentPath] [varchar](200) DEFAULT (','),
	                [sons] [int] DEFAULT (0),
	                [treeOrder] [int] DEFAULT (0),
	                [owners] [varchar](2000) DEFAULT (','),
	                [ifRead] [bigint] DEFAULT (0),
	                [ifAttach] [bigint] DEFAULT (0),
	                [state] [int] DEFAULT (0),
	                [type] [int] DEFAULT (0),
	                [link] [varchar](200) DEFAULT (','),
	                [content] [nvarchar](3800) COLLATE Chinese_PRC_CI_AS DEFAULT (''),
	                [delFlag] [bit] DEFAULT ((0)),	
	                [cTime] [datetime] DEFAULT (getdate()),
	                [mTime] [datetime] DEFAULT (getdate()),
	                [cPerson] [bigint] DEFAULT (0),
	                [mPerson] [bigint] DEFAULT (0)
                ) ON [PRIMARY]
                insert into {0} (nodeName) values ('我的文件夹');
            ", T_PREFIX + uid);

            return(api.execQuery(_sql));
        }
示例#13
0
        public TValue this[MString key] {
            get {
                return(((IDictionary <MString, TValue>)Value)[key]);
            }

            set {
                ((IDictionary <MString, TValue>)Value)[key] = value;
            }
        }
示例#14
0
        /// <summary>
        /// addInstance: 新建在该流程索引下的实例
        /// </summary>
        /// <returns></returns>
        public string addInstance(string alias, string url, string owners, bool ifReturnCurrID, string note)
        {
            SqlTrans trans   = new SqlTrans(api);
            string   _return = String.Empty;

            try
            {
                Json json = trans.execJson("select id,oid,nodeName,type,next,users,roles,logicState from {0} where oid={1} and type=10;", R.Table.WF_DEFINITION, indexID);
                if (json == null)
                {
                    _return = Native.getErrorMsg("在索引ID为{0}中未找到开始节点, 请核实!", indexID);
                }
                else
                {
                    if (owners.Length < 2)
                    {
                        owners = trans.getAllUsers(json.getValue("users"), json.getValue("roles"));
                    }
                    switch (json.getInt("logicState"))
                    {
                    case 6:
                        owners = "," + MSession.get(MSession.getClientKey()) + ",";
                        break;

                    case 7:
                        owners = trans.getDeptOwners(MSession.get(MSession.getClientKey()));
                        break;
                    }
                    string _k = "oid,nodeName,owner,url";
                    string _v = json.getValue("oid") + ",'" + alias + "','" + owners + "','" + url + "'";
                    _return = trans.execScalar(MString.getInsertStr(R.Table.WF_INSTANCE, _k, _v, true));
                    int    _rootID = Convert.ToInt16(_return);
                    string _kt     = "oid,definedNodeID,nodeName,next,pre,state,type,owner,note";
                    string _vt     = json.getValue("oid") + "," + json.getValue("id") + ",'" + json.getValue("nodeName") + "','" + json.getValue("next") + "',0,1,10,'" + owners + "','" + note + "'";
                    string _CURRID = trans.addTreeNode(R.Table.WF_INSTANCE, _rootID, _kt, _vt);
                    if (ifReturnCurrID)
                    {
                        _return += "@" + _CURRID;
                    }
                    trans.commit();
                }
            }
            catch (Exception ex)
            {
                _return = Native.getErrorMsg(ex.Message + "--addInstance");
                trans.rollback();
            }
            finally {
                trans.close();
            }
            return(_return);
        }
示例#15
0
        public string getParallerUsers(SqlTrans trans, string _users, string _roles, int logicState, Json wf)
        {
            Hashtable _table = new Hashtable();

            if (logicState == 5)
            {
                _roles += trans.execScalar(MString.getSelectStr("SYS_CM_USER", "department", wf.getInt("cPerson"))) + ",";
            }
            string _val = ",", _key;

            string[] _idsTAry, _uTAry = _users.Split(',');
            _roles = _roles.Replace(",,", ",");
            int _rLen = _roles.Length;

            if (_rLen > 2)
            {
                _roles = _roles.Substring(1, _rLen - 2);
                string[] _idsAry = trans.execReader(MString.getSelectStr("SYS_CM_ROLE", "link", "id in (" + _roles + ")")).Split(trans.getBaseApi().getRSplit().ToCharArray());
                for (int i = 0; i < _idsAry.Length; i++)
                {
                    _idsTAry = _idsAry[i].Split(',');
                    for (int j = 0; j < _idsTAry.Length; j++)
                    {
                        _key = _idsTAry[j];
                        if (!Native.isEmpty(_key) && !_table.ContainsKey(_key))
                        {
                            _table.Add(_key, true);
                        }
                    }
                }
            }
            for (int j = 0; j < _uTAry.Length; j++)
            {
                _key = _uTAry[j];
                if (!Native.isEmpty(_key) && !_table.ContainsKey(_key))
                {
                    _table.Add(_key, true);
                }
            }
            ArrayList akeys = new ArrayList(_table.Keys);

            akeys.Sort();
            for (int i = 0; i < akeys.Count; i++)
            {
                _val += akeys[i] + ",";
            }
            return(_val);
        }
示例#16
0
        /// <summary>
        /// deleteTreeNode: 删除树节点
        /// </summary>
        /// <param name="_table">表名</param>
        /// <param name="_id">删除节点对应的ID</param>
        /// <returns></returns>
        public string deleteTreeNode(string _table, int _id)
        {
            string _val  = String.Empty;
            Json   _curr = execJson(MString.getSelectStr(_table, "*", "id=" + _id));

            if (_curr != null)
            {
                execNonQuery(MString.getUpdateStr(_table, "sons=sons-1", _curr.getInt("pid")));
                execNonQuery(MString.getDeleteStr(_table, "id=" + _id) + MString.getDeleteStr(_table, "charindex('," + _id + ",',parentPath,0)<>0"));
            }
            else
            {
                _val = Native.getErrorMsg("在表({0})中id={1}的节点不存在", _table, _id);
            }
            return(_val);
        }
示例#17
0
        /// <summary>
        /// orderTreeNode: 根据升序或降序尽心修改顺序
        /// </summary>
        /// <param name="_table">表名</param>
        /// <param name="_id">要排序操作的ID值</param>
        /// <param name="_ifAsc">是否按照升序方式排序, true: 升序, false: 降序</param>
        /// <returns></returns>
        public string orderTreeNode(string _table, int _id, bool _ifAsc)
        {
            SqlTrans _trans = new SqlTrans(this);
            string   _val = String.Empty, _sign = ">", _fn = "min";

            if (_ifAsc)
            {
                _sign = "<"; _fn = "max";
            }
            try
            {
                Json _node = _trans.execJson(MString.getSelectStr(_table, "pid, treeOrder", "id=" + _id));
                if (_node != null)
                {
                    int  _pid = _node.getInt("pid"), _treeOrder = _node.getInt("treeOrder");
                    Json _target = _trans.execJson("select top 1 id,treeOrder from {0} where pid={1} and treeOrder=(select {2}(treeOrder) from {0} where pid={1} and treeOrder{3}{4});", _table, _pid, _fn, _sign, _treeOrder);
                    if (_target != null)
                    {
                        string _sql = "update {0} set treeOrder={1} where id={2};";
                        _sql  = MString.format(_sql, _table, _target.getValue("treeOrder"), _id);
                        _sql += "update {0} set treeOrder={1} where id={2};";
                        _sql  = MString.format(_sql, _table, _treeOrder, _target.getValue("id"));
                        _trans.execNonQuery(_sql);
                    }
                    else
                    {
                        Native.writeToPage(Native.getErrorMsg("id是{0}的记录指针已经是第一行或最后一行", _id));
                    }
                }
                else
                {
                    Native.writeToPage(Native.getErrorMsg("在表({0})中不存在id是{1}的记录", _table, _id));
                }
                _trans.commit();
            }
            catch (Exception e)
            {
                _val = Native.getErrorMsg(e.Message);
                _trans.rollback();
            }
            finally
            {
                _trans.close();
            }
            return(_val);
        }
示例#18
0
        /// <summary>
        /// Adds a menu item into menu
        /// </summary>
        /// <param name="parent">Parent menu</param>
        /// <param name="text">Text</param>
        /// <param name="toggle">Is toggle</param>
        /// <param name="on">Is on</param>
        /// <param name="subMenu">Sub menu</param>
        /// <param name="activateEventHandler">Activated event handler</param>
        /// <param name="highlightedEventHandler">Highlighted event handler</param>
        /// <param name="preActivateEventHandler">Pre-activated event handler</param>
        public static MenuItem AddMenuItem(Menu parent, MString text, bool toggle = false, bool on = false, Menu subMenu = null, MenuItemEventHandler activateEventHandler = null, MenuItemEventHandler preActivateEventHandler = null, MenuItemEventHandler highlightedEventHandler = null, object data = null)
        {
            MenuItem mi = new MenuItem()
            {
                Text = text,
                IsToggle = toggle,
                On = on,
                SubMenu = subMenu
            };
            if (activateEventHandler != null) mi.Activated += activateEventHandler;
            if (preActivateEventHandler != null) mi.PreActivated += preActivateEventHandler;
            if (highlightedEventHandler != null) mi.Highlighted += highlightedEventHandler;
            mi.Data = data;
            parent.Add(mi);

            return mi;
        }
示例#19
0
        /// <summary>
        /// onProcessEnd: 当流程结束时所触发的事件
        /// </summary>
        /// <param name="trans">SQL事务对象</param>
        /// <param name="pid">子流程根节点ID</param>
        /// <returns></returns>
        private string [] onProcessEnd(SqlTrans trans, int pid)
        {
            string [] _return = new string[] {};
            string    _rootID = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "pid", "id=" + pid + " and state=" + S_ENDED));

            if (!Native.isEmpty(_rootID) && _rootID != "0")
            {
                string _count = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "count(*)", "pid=" + _rootID + " and state<>" + S_ENDED));
                if (_count == "0")
                {
                    string[] _nexts = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "next", "id=" + _rootID)).Split(',');
                    if (_nexts.Length == 3)
                    {
                        _return = new string[] { _rootID, _nexts[1] };
                    }
                }
            }
            return(_return);
        }
示例#20
0
        public string getAllUsers(string _users, string _roles)
        {
            Hashtable _table = new Hashtable();
            string    _val = ",", _key;

            string [] _idsTAry, _uTAry = _users.Split(',');
            int       _rLen            = _roles.Length;

            if (_rLen > 2)
            {
                _roles = _roles.Substring(1, _rLen - 2);
                string[] _idsAry = execReader(MString.getSelectStr("SYS_CM_ROLE", "uids", "id in (" + _roles + ")")).Split(baseApi.getRSplit().ToCharArray());
                for (int i = 0; i < _idsAry.Length; i++)
                {
                    _idsTAry = _idsAry[i].Split(',');
                    for (int j = 0; j < _idsTAry.Length; j++)
                    {
                        _key = _idsTAry[j];
                        if (!Native.isEmpty(_key) && !_table.ContainsKey(_key))
                        {
                            _table.Add(_key, true);
                        }
                    }
                }
            }
            for (int j = 0; j < _uTAry.Length; j++)
            {
                _key = _uTAry[j];
                if (!Native.isEmpty(_key) && !_table.ContainsKey(_key))
                {
                    _table.Add(_key, true);
                }
            }
            ArrayList akeys = new ArrayList(_table.Keys);

            akeys.Sort();
            for (int i = 0; i < akeys.Count; i++)
            {
                _val += akeys[i] + ",";
            }
            return(_val);
        }
示例#21
0
        /// <summary>
        /// nextPARALLEL: 并行节点的下一步扭转
        /// </summary>
        /// <param name="currID"></param>
        /// <param name="nextID"></param>
        /// <param name="jsonStr"></param>
        /// <param name="ext"></param>
        /// <returns></returns>
        private string nextPARALLEL(int currID, int nextID, string jsonStr, string ext = "")
        {
            string   _return = String.Empty;
            SqlTrans trans   = new SqlTrans(api);
            bool     _ifNext = false;

            try
            {
                string _pkv = "state=" + S_P_PASS, _ekv = MConvert.toUpdateSql(jsonStr);
                string _currUserId = MSession.get(MSession.getClientKey());
                if (!Native.isEmpty(_ekv))
                {
                    _pkv += "," + _ekv;
                }
                string _instanceID = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "pid", Convert.ToInt16(currID)));
                trans.execNonQuery(MString.getUpdateStr(R.Table.WF_INSTANCE, "owner=REPLACE(owner, '" + _currUserId + ",', '')", Convert.ToInt32(_instanceID)));
                int    _ifSucc = trans.execNonQuery(MString.getUpdateStr(R.Table.WF_INSTANCE, _pkv, "pid=" + currID + " and dbo.SYS_TRANS_CONFIRM_USERS(nodeName,'" + _currUserId + "')<>0"));
                string _count  = trans.execScalar("select count(*) from {0} where pid={1} and state=" + S_P_NORMAL + ";", R.Table.WF_INSTANCE, currID);
                if (_count == "0")
                {
                    _ifNext = true;
                }
                api.setDataType("json");
                _return = trans.execReader(MString.getSelectStr(R.Table.WF_INSTANCE, "*", Convert.ToInt16(currID)));
                api.setDataType("html");
                trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message + "--WFInstance--nextPARALLEL");
                trans.rollback();
            }
            finally
            {
                trans.close();
            }
            if (_ifNext)
            {
                _return = nextNORMAL(currID, nextID, "", "");
            }
            return(_return);
        }
示例#22
0
        /// <summary>
        /// deleteTreeNode: 删除树节点
        /// </summary>
        /// <param name="_table">表名</param>
        /// <param name="_id">删除节点对应的ID</param>
        /// <returns></returns>
        public string copyTreeNode(string _table, int _id, int _pid)
        {
            string _val  = String.Empty;
            Json   _curr = execJson(MString.getSelectStr(_table, "*", "id=" + _id));
            Json   _pre  = execJson(MString.getSelectStr(_table, "*", "id=" + _pid));

            if (_curr == null)
            {
                return(Native.getErrorMsg("在表({0})中id={1}的节点不存在", _table, _id));
            }
            if (_pre == null)
            {
                return(Native.getErrorMsg("在表({0})中id={1}的节点不存在", _table, _pid));
            }
            int    _pDepth = _pre.getInt("depth") + 1;
            string _pPath = _pre.getValue("parentPath"), _newPPath = _pPath + _pid + ",";
            string _update = "treeOrder=isnull((select max(treeOrder)+1 from " + _table + " where pid=" + _pid + "),1),pid=" + _pid + ",parentPath='" + _newPPath + "',depth=" + _pDepth;

            execNonQuery(MString.getUpdateStr(_table, _update, _id) + MString.getUpdateStr(_table, "sons=sons+1", _pid));
            execNonQuery(MString.getUpdateStr(_table, "parentPath=replace(parentPath,'" + _curr.getValue("parentPath") + "', '" + _newPPath + "'),depth=" + (_pDepth + 1), "charindex('," + _id + ",',parentPath,0)<>0"));
            return(_val);
        }
示例#23
0
        public override string ToJson()
        {
            string result = "{";
            bool   first  = true;

            foreach (var value in Value)
            {
                if (!first)
                {
                    result += ", ";
                }
                else
                {
                    first = false;
                }
                MString key = (MString)value.Key;
                result += string.Format("{0} : {1}", value.Key.ToJson(), value.Value.ToJson());
            }
            result += "}";

            return(result);
        }
示例#24
0
        public string send(string _json)
        {
            string   _return = String.Empty;
            SqlTrans _trans  = new SqlTrans(api);

            try
            {
                string[] _kv = MConvert.toKV(_json), _owners = MConvert.getValue(_json, "owners").Split(',');
                _trans.execNonQuery(MString.getInsertStr(T_EMAIL_USER, _kv[0] + ", type", _kv[1] + ", " + TYPE_SEND));
                string _link = MConvert.getValue(_json, "link");
                if (_link.Length > 1)
                {
                    _link = "1";
                }
                else
                {
                    _link = "0";
                }
                for (int i = 0, _len = _owners.Length; i < _len; i++)
                {
                    string _uid = _owners[i];
                    if (Native.isEmpty(_uid))
                    {
                        continue;
                    }
                    _trans.execNonQuery(MString.getInsertStr(T_PREFIX + _uid, _kv[0] + ", type, ifAttach", _kv[1] + ", " + TYPE_EMAIL + ", " + _link));
                }
                _trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message);
                _trans.rollback();
            }
            finally {
                _trans.close();
            }
            return(_return);
        }
示例#25
0
        /// <summary>
        /// nextPARALLEL: 并行节点的下一步扭转
        /// </summary>
        /// <param name="currID"></param>
        /// <param name="nextID"></param>
        /// <param name="jsonStr"></param>
        /// <param name="ext"></param>
        /// <returns></returns>
        public string denyPARALLEL(int currID, int nextID, string jsonStr, string ext = "")
        {
            string   _return = String.Empty;
            SqlTrans trans   = new SqlTrans(api);
            bool     _ifNext = false;

            try
            {
                string _pkv = "state=" + S_P_DENY, _ekv = MConvert.toUpdateSql(jsonStr);
                if (!Native.isEmpty(_ekv))
                {
                    _pkv += "," + _ekv;
                }
                int    _ifSucc = trans.execNonQuery(MString.getUpdateStr(R.Table.WF_INSTANCE, _pkv, "pid=" + currID + " and nodeName='" + MSession.get(MSession.getClientKey()) + "'"));
                string _count  = trans.execScalar("select count(*) from {0} where pid={1} and state=" + S_P_NORMAL + ";", R.Table.WF_INSTANCE, currID);
                if (_count == "0")
                {
                    _ifNext = true;
                }
                api.setDataType("json");
                _return = trans.execReader(MString.getSelectStr(R.Table.WF_INSTANCE, "*", Convert.ToInt16(currID)));
                api.setDataType("html");
                trans.commit();
            }
            catch (Exception e)
            {
                _return = Native.getErrorMsg(e.Message + "--WFInstance--nextPARALLEL");
                trans.rollback();
            }
            finally
            {
                trans.close();
            }
            if (_ifNext)
            {
                _return = nextNORMAL(currID, nextID, "", "");
            }
            return(_return);
        }
示例#26
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!verify())
            {
                MetroMessageBox.Show(this, "Please Fill All Kid Requirment");
                return;
            }

            string col     = " [name_id], [sex], [dob], [order]";
            string name_id = Database.QueryScalar(@"DECLARE @id int=0 exec @id=insertName '" + txtKidName.Text + "', 4 select @id") + "";

            //Helpers.ShowMsg(name_id);

            if (rowEditing)
            {
                //Database.Update("tbl_kid", "Where id=" + dgKids.SelectedRows[0].Cells["id"].Value, col, name_id, txtKidOrder.Text, cbGender.SelectedIndex, dpDOB.Value.ToShortDateString());
                //    id = Database.GetLastId("tbl_mom") + "";

                Database.Update("tbl_kid", "Where id=" + dgKids.SelectedRows[0].Cells["kid_id"].Value + "", col, name_id, cbGender.SelectedIndex, dpDOB.Value.ToShortDateString(), txtKidOrder.Text);
                //id = Database.GetLastId("tbl_mom") + "";

                ReloadGridView(id);
                Clear();
                rowEditing = false;
                return;
            }



            string kid_data = MString.implode(",", "'", id, txtKidName.Text, cbGender.SelectedIndex + "", dpDOB.Value.ToString("yyyy-MM-dd"), txtKidOrder.Text);

            Database.Exec("exec insertKid " + kid_data);

            ReloadGridView(id);
            Clear();
            rowEditing = false;
            //Helpers.ShowMsg("Edit");
        }
示例#27
0
        /// <summary>
        /// start: 启动流程
        /// </summary>
        /// <param name="wfID">流程实例ID值</param>
        /// <param name="jsonStr">json字符串</param>
        /// <param name="ext">扩展信息</param>
        /// <returns></returns>
        public string start(int wfID, string jsonStr, string ext = "")
        {
            SqlTrans trans   = new SqlTrans(api);
            string   _return = String.Empty;

            try
            {
                Json _sNode = trans.execJson(MString.getSelectStr(R.Table.WF_INSTANCE, "oid,state", "id=" + wfID));
                if (_sNode.getInt("state") == 0)
                {
                    Json     _fNode  = trans.execJson(MString.getSelectStr(R.Table.WF_DEFINITION, "*", "oid=" + _sNode.getValue("oid") + ", type=10"));
                    string   _kt     = "oid,definedNodeID,nodeName,next,pre,state,type,owner,ext";
                    string   _owners = trans.getAllUsers(_fNode.getValue("users"), _fNode.getValue("roles"));
                    string   _vt     = _fNode.getValue("oid") + "," + _fNode.getValue("id") + ",'" + _fNode.getValue("nodeName") + "','" + _fNode.getValue("next") + "',0,1,10,'" + _owners + "','" + ext + "'";
                    string[] _js     = MConvert.toKV(jsonStr);
                    if (!Native.isEmpty(_js[0]))
                    {
                        _kt += "," + _js[0]; _vt += "," + _js[1];
                    }
                    _return = trans.addTreeNode(R.Table.WF_INSTANCE, wfID, _kt, _vt);
                }
                else
                {
                    _return = Native.getErrorMsg("流程已经结束或取消!");
                }
                trans.commit();
            }
            catch (Exception ex)
            {
                _return = Native.getErrorMsg(ex.Message + "--WFInstance--start");
                trans.rollback();
            }
            finally
            {
                trans.close();
            }
            return(_return);
        }
示例#28
0
 public static string FormatML(MString format, MString arg)
 {
     return string.Format(ML(format), ML(arg));
 }
示例#29
0
 /// <summary>
 /// Gets the string with current language code.
 /// </summary>
 /// <param name="str">Multi-string</param>
 /// <returns></returns>
 public static string ML(MString str)
 {
     return str[Trainer.LanguageCode];
 }
示例#30
0
 /// <summary>
 /// Shows a notification above in-game mini-map
 /// </summary>
 /// <param name="message">Message to show</param>
 public static void ShowNotificationAboveMap(MString message)
 {
     Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
     Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, message[Trainer.LanguageCode]);
     Function.Call(Hash._DRAW_NOTIFICATION, 0, 1);
 }
示例#31
0
 /// <summary>
 /// Creates a weather data
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="internalName">Internal name</param>
 public WeatherData(MString name, string internalName)
 {
     Name = name;
     InternalName = internalName;
 }
示例#32
0
 public bool TryGetValue(MString key, out TValue value)
 {
     return(((IDictionary <MString, TValue>)Value).TryGetValue(key, out value));
 }
示例#33
0
 public bool ContainsKey(MString key)
 {
     return(((IDictionary <MString, TValue>)Value).ContainsKey(key));
 }
示例#34
0
 public static string FormatML(MString format, params object[] args)
 {
     return string.Format(ML(format), args);
 }
示例#35
0
 /// <summary>
 /// Creates an instance of menu and set initial values.
 /// </summary>
 /// <param name="title">Title of menu</param>
 /// <param name="location">Location of the menu</param>
 /// <param name="width">Width of the menu in pixel</param>
 /// <param name="itemHeight">Item height of the menu in pixel</param>
 /// <param name="itemPerPage">Item count per page</param>
 public Menu(MString title, Point location, int width, int itemHeight, int itemPerPage)
 {
     Title = title;
     _width = width;
     _itemHeight = itemHeight;
     _itemPerPage = itemPerPage;
     Location = location;
     _items = new List<MenuItem>();
 }
示例#36
0
 /// <summary>
 /// Creates an instance of a menu.
 /// </summary>
 /// <param name="title">Title of the menu</param>
 /// <param name="x">X position of the menu</param>
 /// <param name="y">Y position of the menu</param>
 public Menu(MString title, int x, int y)
     : this(title, new Point(x, y))
 {
 }
示例#37
0
 /// <summary>
 /// Creates an instance of a menu and adds initial items.
 /// </summary>
 /// <param name="title">Title of menu</param>
 /// <param name="x">X position of the menu</param>
 /// <param name="y">Y position of the menu</param>
 /// <param name="items">Menu items</param>
 public Menu(MString title, int x, int y, MenuItem[] items)
     : this(title, new Point(x, y), items)
 {
 }
示例#38
0
        /// <summary>
        /// 物资退料
        /// </summary>
        /// <param name="tk_form">单据表单信息</param>
        /// <param name="MSInfos">物资具体信息</param>
        /// <returns></returns>
        public string back(string tk_form, string MSInfos, int wfIdx)
        {
            string   _return = String.Empty, _code = MConvert.getValue(tk_form, "code"), _whId = MConvert.getValue(tk_form, "whId"), _proId = MConvert.getValue(tk_form, "proId");
            string   _wfId = (new WFIndex(wfIdx, api)).addInstance("退料单号:" + _code, "");
            SqlTrans trans = new SqlTrans(api);

            try
            {
                string[] _kv     = MConvert.toKV(tk_form);
                string   _users  = trans.execScalar(MString.getSelectStr(R.Table.WF_INSTANCE, "owner", "id=" + _wfId));
                string   _newID  = trans.addRow(R.Table.TK_WH_BACK, _kv[0] + ",wfId,users,observers", _kv[1] + "," + _wfId + ",'" + _users + "','" + _users + "'");
                string[] infoAry = MSInfos.Split('^');
                for (int i = 0, _len = infoAry.Length; i < _len; i++)
                {
                    string    _sInfo = infoAry[i], _pid = String.Empty, _msId = MConvert.getValue(_sInfo, "msId");
                    string[]  _tKV    = MConvert.toKV(_sInfo);
                    double    _num    = MConvert.getDouble(_sInfo, "number");
                    ArrayList _stocks = trans.execJsonList("select {0} from {1} where msId={2} and remainNum<>0 and batchId<>0 and proId={3} order by cTime desc, id desc;", "id,whId,batchId,batchCode,batchPrice,number,remainNum", R.Table.TK_WH_SEND_DETAIL, _msId, _proId);
                    for (int _n = 0; _n < _stocks.Count; _n++)
                    {
                        if (_num < 0 || _num == 0)
                        {
                            break;
                        }
                        Json   _stock = (Json)_stocks[_n];
                        double _realNum = 0, _price = _stock.getDouble("batchPrice");
                        string _k = String.Empty, _v = String.Empty, _batchId = "0", _batchCode = "", _newWhId = _whId, _sendId = _stock.getValue("id"), _sourceId = _stock.getValue("whId");
                        _num = _num - _stock.getDouble("remainNum");
                        if (Native.isEmpty(_newWhId) || _newWhId == "0")
                        {
                            _newWhId = _sourceId; _batchId = _stock.getValue("batchId"); _batchCode = _stock.getValue("batchCode");
                        }
                        if (_num > 0)
                        {
                            _realNum = _stock.getDouble("remainNum");
                            if (Native.isEmpty(_pid))
                            {
                                _k   = "msId,sourceId,proId,whId,oid,planNum";
                                _v   = _msId + "," + _sourceId + "," + _proId + "," + _newWhId + "," + _newID + "," + MConvert.getValue(_sInfo, "planNum");
                                _pid = trans.execScalar(MString.getInsertStr(R.Table.TK_WH_BACK_DETAIL, _k, _v, true));
                            }
                            _k = "sendId,msId,sourceId,proId,whId,oid,batchId,batchCode,price,number,sum";
                            _v = _sendId + "," + _msId + "," + _sourceId + "," + _proId + "," + _newWhId + "," + _newID + "," + _batchId + ",'" + _batchCode + "'," + _price + "," + _realNum + "," + _price * _realNum;
                            trans.addTreeNode(R.Table.TK_WH_BACK_DETAIL, Convert.ToInt16(_pid), _k, _v);
                            trans.execNonQuery("update " + R.Table.TK_WH_BACK_DETAIL + " set sum=sum+" + (_price * _realNum) + ", number=number+" + _realNum + " where id=" + _pid);
                        }
                        else
                        {
                            _realNum = _stock.getDouble("remainNum") + _num;
                            if (!Native.isEmpty(_pid))
                            {
                                _k = "sendId,msId,sourceId,proId,whId,oid,batchId,batchCode,price,number,sum";
                                _v = _sendId + "," + _msId + "," + _sourceId + "," + _proId + "," + _newWhId + "," + _newID + "," + _batchId + ",'" + _batchCode + "'," + _price + "," + _realNum + "," + _price * _realNum;
                                trans.addTreeNode(R.Table.TK_WH_BACK_DETAIL, Convert.ToInt16(_pid), _k, _v);
                                trans.execNonQuery("update " + R.Table.TK_WH_BACK_DETAIL + " set sum=sum+" + (_price * _realNum) + ", number=number+" + _realNum + " where id=" + _pid);
                            }
                            else
                            {
                                trans.addRow(R.Table.TK_WH_BACK_DETAIL, _tKV[0] + ",sendId,proId,whId,sourceId,oid,batchId,batchCode,price,sum,planSum", _tKV[1] + "," + _sendId + "," + _proId + "," + _newWhId + "," + _sourceId + "," + _newID + "," + _batchId + ",'" + _batchCode + "'," + _price + "," + (_realNum * _price) + "," + (MConvert.getDouble(_sInfo, "planNum") * _price));
                            }
                        }
                    }
                }
                _return = _newID;
                trans.commit();
            }
            catch (Exception e)
            {
                trans.rollback();
                _return = Native.getErrorMsg(e.Message);
            }
            finally
            {
                trans.close();
            }
            return(_return);
        }
示例#39
0
 public bool Remove(MString key)
 {
     return(((IDictionary <MString, TValue>)Value).Remove(key));
 }
示例#40
0
 /// <summary>
 /// Creates an instance of menu and set initial values.
 /// </summary>
 /// <param name="title">Title of menu</param>
 /// <param name="x">X position of the menu</param>
 /// <param name="y">Y position of the menu</param>
 /// <param name="width">Width of the menu in pixel</param>
 /// <param name="itemHeight">Item height of the menu in pixel</param>
 /// <param name="screenWidth">Screen width in pixel</param>
 /// <param name="screenHeight">Screen height in pixel</param>
 /// <param name="itemPerPage">Item count per page</param>
 public Menu(MString title, int x, int y, int width, int itemHeight, int screenWidth, int screenHeight, int itemPerPage)
     : this(title, new Point(x, y), width, itemHeight, screenWidth, screenHeight, itemPerPage)
 {
 }
示例#41
0
 /// <summary>
 /// Creates an instance of a menu.
 /// </summary>
 /// <param name="title">Title of the menu</param>
 public Menu(MString title)
 {
     Title = title;
     _items = new List<MenuItem>();
 }
示例#42
0
 /// <summary>
 /// Creates an instance of a menu and adds initial items.
 /// </summary>
 /// <param name="title">Title of menu</param>
 /// <param name="location">Location of the menu</param>
 /// <param name="items">Menu items</param>
 public Menu(MString title, Point location, MenuItem[] items)
 {
     _items = new List<MenuItem>(items);
     Title = title;
     Location = location;
 }
示例#43
0
 public void Add(MString key, TValue value)
 {
     ((IDictionary <MString, TValue>)Value).Add(key, value);
 }
示例#44
0
 /// <summary>
 /// Creates a teleport category
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="targets">Targets</param>
 public TeleportCategory(MString name, TeleportTarget[] targets)
 {
     Name = name;
     Targets = targets;
 }
示例#45
0
 /// <summary>
 /// Creates an instance of menu and set initial values.
 /// </summary>
 /// <param name="title">Title of menu</param>
 /// <param name="location">Location of the menu</param>
 /// <param name="width">Width of the menu in pixel</param>
 /// <param name="itemHeight">Item height of the menu in pixel</param>
 /// <param name="screenWidth">Screen width in pixel</param>
 /// <param name="screenHeight">Screen height in pixel</param>
 /// <param name="itemPerPage">Item count per page</param>
 /// <param name="items">Menu items</param>
 public Menu(MString title, Point location, int width, int itemHeight, int screenWidth, int screenHeight, int itemPerPage, MenuItem[] items)
 {
     Title = title;
     _width = width;
     _itemHeight = itemHeight;
     _screenHeight = screenHeight;
     _screenWidth = screenWidth;
     _itemPerPage = itemPerPage;
     _items = new List<MenuItem>(items);
     Location = location;
 }
示例#46
-1
 /// <summary>
 /// Creates a teleport target instance
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="x">X coordinate</param>
 /// <param name="y">Y coordinate</param>
 /// <param name="z">Z coordinate</param>
 /// <param name="requiredIPLs">Required IPLs to load</param>
 /// <param name="removeIPLs">Required IPLs to remove</param>
 /// <param name="isLoaded">Is loaded</param>
 public TeleportTarget(MString name, float x, float y, float z, string[] requiredIPLs = null, string[] removeIPLs = null)
 {
     _name = name;
     _coords = new GTA.Math.Vector3(x, y, z);
     _requiredIPLs = requiredIPLs;
     _removeIPLs = removeIPLs;
 }