static void test2()
        {
            var ctx = new DadeAfzaMongoDbContext();

            ctx.OpenDatabase("Db_1");


            MTable <Student> tb1 = new MTable <Student>(ctx, tableName2, "");

            MTable <ClassRoom> tb2 = new MTable <ClassRoom>(ctx, tableName1, "");


            MJoin <Student, ClassRoom> tb1tb2 = new MJoin <Student, ClassRoom>(tb1, tb2, "ClassId", "Id", new QueryDocument(), new List <KeyValuePair <string, string> >(), new List <KeyValuePair <string, string> >());


            //Filter<Student> flt = new Filter<Student>(tb1, "{Age:{$gt:50}}");


            //OfflineSort<Student> sort = new OfflineSort<Student>(flt, "Age", SortDirection.Ascending);

            var lst = tb1tb2.ToList();


            Console.WriteLine($"{lst.Count}");

            foreach (var item in lst)
            {
                Console.WriteLine($"{item.Age}");
            }
        }
Exemplo n.º 2
0
        public static MTable getBkList(WindAPI w, string sec, DateTime dt, bool FilterTheNoPrice)
        {
            SecIndexClass   sic = new SecIndexClass(sec);
            secIndexBuilder sib = new secIndexBuilder(w, sic);
            MTable          mt  = sib.getBkList(dt);

            if (mt == null || mt.Count == 0)
            {
                return(mt);
            }
            BaseDataProcess_ForWD bdp = new BaseDataProcess_ForWD(w);

            string[]       seccodes = mt["wind_code"].ToList <string>().ToArray();
            RunResultClass rc       = bdp.getSetDataResult(seccodes, "close", dt);
            MTable         ret      = new MTable();
            List <DataRow> NewDrs   = new List <DataRow>();

            for (int i = 0; i < rc.Result.Count; i++)
            {
                DataRow retdr = mt.GetTable().Rows[i];
                DataRow dr    = rc.Result.GetTable().Rows[i];
                if (dr.IsNull("CLOSE") && FilterTheNoPrice)
                {
                    continue;
                }
                NewDrs.Add(retdr);
            }
            ret.FillList(NewDrs.ToArray());
            return(ret);
        }
Exemplo n.º 3
0
        private void MRoot_Load(object sender, EventArgs e)
        {
            //左侧布局
            Controls["lline"].BackColor         = Color.White;
            BFrom._LeftPanel.BackColor          = Color.White;
            BFrom._LeftPanel.Controls[2].Height = 50;
            BFrom._LeftPanel.Controls[1].Height = 30;
            info = Skincss.AddLable(BFrom._LeftPanel.Controls[1], "> 请选择用户", "top", "0/30", Skin.upBColor);
            Label ad = Skincss.AddLable(BFrom._LeftPanel.Controls[2], "保存", "0/10", BFrom._LeftPanel.Width + "/30", "#255255255", 10, "", 1, -1, false, Skin.upBColor);

            ad.Click       += Ad_Click;
            Uman            = BFrom._SetMan("and isstop<>'是' and dept<>'' order by dept", false);
            Uman.CellClick += Uman_CellClick;
            //右侧布局
            BFrom._MainPanel.Controls[1].Height = 40;
            Label Temp = new Label();



            //循环读取
            Temp = Skincss.AddLable(BFrom._MainPanel.Controls[1], "售后旧件管理", "0/0", "100/30", "#255255255", 10, "", 1, -1, false, Skin.upBColor);
            //循环读取


            Temp.Click += Temp_Click;



            //初始化
            Setlablist(ReadFistLabel("售后旧件管理"));
        }
Exemplo n.º 4
0
        private void GetChildNodesID(Ctx ctx, int currentnode, int treeID)
        {
            MTree tree = new MTree(ctx, treeID, null);


            if (parentIDs.Length == 0)
            {
                parentIDs.Append(currentnode);
            }
            else
            {
                parentIDs.Append(",").Append(currentnode);
            }
            string adtableName = MTable.GetTableName(ctx, tree.GetAD_Table_ID());

            string tableName = tree.GetNodeTableName();

            //  string sql = "SELECT node_ID FROM " + tableName + " WHERE AD_Tree_ID=" + treeID + " AND Parent_ID = " + currentnode + " AND NODE_ID IN (SELECT " + adtableName + "_ID FROM " + adtableName + " WHERE ISActive='Y' AND IsSummary='Y')";


            string sql = "SELECT pr.node_ID FROM " + tableName + "   pr JOIN " + adtableName + " mp on pr.Node_ID=mp." + adtableName + "_id  WHERE pr.AD_Tree_ID=" + treeID + " AND pr.Parent_ID = " + currentnode + " AND mp.ISActive='Y' AND mp.IsSummary='Y'";

            DataSet ds = DB.ExecuteDataset(sql);

            if (ds == null || ds.Tables[0].Rows.Count > 0)
            {
                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    GetChildNodesID(ctx, Convert.ToInt32(ds.Tables[0].Rows[j]["node_ID"]), treeID);
                }
            }
        }
Exemplo n.º 5
0
        public static MTable getTable(WindData wd, params object[] colTypes)
        {
            MTable ret = new MTable();

            ret.FillTable(getRecords(wd, colTypes));
            return(ret);
        }
Exemplo n.º 6
0
        public RunResultClass LastProcess(MTable mt)
        {
            RunResultClass ret = new RunResultClass();

            ret.Result = mt[string.Format(":{0}", InParam.TopN - 1), "*"];
            return(ret);
        }
Exemplo n.º 7
0
        public static MTable GetMutliSetData(WindAPI w, string[] code, DateTime endt, Cycle cyc, PriceAdj prcAdj, bool IncludeBaseData, string args)
        {
            RunNoticeClass ret  = new RunNoticeClass();
            MTable         mtab = new MTable();

            if (IncludeBaseData)
            {
                BaseDataProcess bp   = new BaseDataProcess_ForWD(w, cyc, prcAdj);
                RunResultClass  bret = bp.getSetDataResult(code, endt, new object[0] {
                });
                if (!bret.Notice.Success)
                {
                    mtab.Union(bret.Result);
                    //return new BaseDataTable();
                }
            }
            Dictionary <string, HashSet <string> > guids = getMutliValueGuid(args.Split(','));

            foreach (string key in guids.Keys)
            {
                MutliValueGuidProcess_ForWD cgp = new MutliValueGuidProcess_ForWD(w, key, guids[key].ToArray <string>());
                cgp.cycle  = cyc;
                cgp.prcAdj = prcAdj;
                RunResultClass cret = cgp.getSetDataResult(code, endt, new object[0] {
                });
                mtab.Union(cret.Result);
            }
            return(mtab);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Sync Version table in database
        /// </summary>
        /// <param name="table"></param>
        /// <param name="AD_Column_ID"></param>
        /// <returns>Message (String)</returns>
        private string SyncVersionTable(MTable table, int AD_Column_ID, out bool Success)
        {
            // create object of Column passed in parameter
            Success = true;
            MColumn column    = new MColumn(GetCtx(), AD_Column_ID, _trx);
            int     noColumns = 0;
            // sync table in database
            string sql       = CommonFunctions.SyncColumn(table, column, out noColumns);
            string exception = "";
            int    no        = 0;

            if (sql.IndexOf(";") == -1)
            {
                try
                {
                    no = DataBase.DB.ExecuteQuery(sql, null, _trx);
                    AddLog(0, DateTime.MinValue, Decimal.Parse(no.ToString()), sql);
                }
                catch (Exception ex)
                {
                    Success   = false;
                    exception = ex.Message;
                    return(exception);
                }
                //addLog (0, null, new BigDecimal(no), sql);
            }
            else
            {
                //string ss = "; ";
                string[] statements = sql.Split(';');
                for (int i = 0; i < statements.Length; i++)
                {
                    int count = DataBase.DB.ExecuteQuery(statements[i].ToString(), null, _trx);
                    AddLog(0, DateTime.MinValue, Decimal.Parse(count.ToString()), statements[i]);
                    no += count;
                }
            }

            if (no == -1)
            {
                Success = false;
                string        msg = "@Error@ ";
                ValueNamePair pp  = VAdvantage.Logging.VLogger.RetrieveError();
                if (pp != null)
                {
                    msg += exception + " - ";
                }
                msg += sql;
                return(msg);
            }

            // Apply constraints on columns for Version table
            ColumnSync colSync = new ColumnSync();

            colSync.SetAD_Column_ID(AD_Column_ID);
            string r = colSync.createFK(noColumns);

            return(r);
        }
        /// <summary>
        /// Perform Process.
        /// </summary>
        /// <returns>Message (variables are parsed)</returns>
        protected override String DoIt()
        {
            MWFProcess process = new MWFProcess(GetCtx(), p_AD_WF_Process_ID, Get_Trx());

            log.Info("doIt - " + process);

            MUser user = MUser.Get(GetCtx(), GetAD_User_ID());

            //	Abort
            if (p_IsAbort)
            {
                msg = user.GetName() + ": Abort";
                process.SetTextMsg(msg);
                process.SetAD_User_ID(GetAD_User_ID());
                process.SetWFState(StateEngine.STATE_ABORTED);

                //JID_0278 : To mark processing checkbox false.
                // Mohit
                // Date : 22 May 2019
                MTable table = new MTable(GetCtx(), process.GetAD_Table_ID(), null);
                PO     po    = MTable.GetPO(GetCtx(), table.GetTableName(), process.GetRecord_ID(), Get_Trx());
                if (po != null && po.Get_ColumnIndex("Processing") >= 0)
                {
                    po.Set_Value("Processing", false);
                    po.Save();
                }
                return(msg);
            }

            //	Change User
            if (p_AD_User_ID != 0 && process.GetAD_User_ID() != p_AD_User_ID)
            {
                MUser from = MUser.Get(GetCtx(), process.GetAD_User_ID());
                MUser to   = MUser.Get(GetCtx(), p_AD_User_ID);
                msg = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                process.SetTextMsg(msg);
                process.SetAD_User_ID(p_AD_User_ID);
            }
            //	Change Responsible
            if (p_AD_WF_Responsible_ID != 0 && process.GetAD_WF_Responsible_ID() != p_AD_WF_Responsible_ID)
            {
                MWFResponsible from = MWFResponsible.Get(GetCtx(), process.GetAD_WF_Responsible_ID());
                MWFResponsible to   = MWFResponsible.Get(GetCtx(), p_AD_WF_Responsible_ID);
                String         msg1 = user.GetName() + ": " + from.GetName() + " -> " + to.GetName();
                process.SetTextMsg(msg1);
                process.SetAD_WF_Responsible_ID(p_AD_WF_Responsible_ID);
                if (msg == null)
                {
                    msg = msg1;
                }
                else
                {
                    msg += " - " + msg1;
                }
            }
            process.Save();

            return("OK");
        }
Exemplo n.º 10
0
        public static int getTradeDays(MongoDataReader w, DateTime begt, DateTime endt)
        {
            TDaysGuidClas          tgc = new TDaysGuidClas();
            TDayGuildBuilder_ForMG tgb = new TDayGuildBuilder_ForMG(w, tgc);
            MTable ret = tgb.getRecordsCount(begt, endt);

            return((int)ret.GetTable().Rows[0][0]);
        }
 string[] GetParentColumns(int _TableID)
 {
     //string _Sql = "select columnname from AD_field_V where ad_table_id=" + _TableID + " and isparent='Y' order by isdisplayed desc, seqno";
     //string _Sql = "SELECT * FROM AD_Column WHERE AD_Table_ID=" + _TableID + " ORDER BY ColumnName";
     //return DB.ExecuteDataset(_Sql);
     string[] keyColumns = new MTable(GetCtx(), _TableID, null).GetKeyColumns();
     return(keyColumns);
 }
Exemplo n.º 12
0
        static void InitEquites()
        {
            AllMarketEquitClass aec = new AllMarketEquitClass();
            MTable dt = CommWDToolClass.getBkList(w, aec.SummaryCode, DateTime.Today, false);

            if (dt == null || dt.Count == 0)
            {
                return;
            }
            string[]      equitcodes = dt["WIND_CODE"].ToList <string>().ToArray();
            BaseDataTable bdt        = CommWDToolClass.GetBaseData(w,
                                                                   equitcodes,
                                                                   DateTime.Today,
                                                                   Cycle.Day,
                                                                   PriceAdj.Beyond,
                                                                   new object[0] {
            });                                                                                                   //获得所有股票的基本信息

            OnMarketDate = bdt[BaseDataPoint.ipo_date.ToString().ToUpper()].ToList <DateTime>().Min <DateTime>(); //所有股票中的最早的IPO日期
            EquitCnt     = bdt.Count;
            Dictionary <string, SecurityInfo>      alllist = new Dictionary <string, SecurityInfo>();
            Dictionary <int, List <SecurityInfo> > grps    = new Dictionary <int, List <SecurityInfo> >();

            for (int i = 0; i < bdt.Count; i++)
            {
                BaseDataItemClass info = bdt[i] as BaseDataItemClass;
                SecurityInfo      si   = new SecurityInfo
                {
                    secType   = SecType.Equit,
                    BaseInfo  = info,
                    DateIndex = new Dictionary <DateTime, int>()
                };
                if (alllist.ContainsKey(si.BaseInfo.WindCode))
                {
                    throw (new Exception("初始化系统出现重复股票!"));
                }
                int t = i % GroupCnt;
                if (!grps.ContainsKey(t))
                {
                    grps.Add(t, new List <SecurityInfo>());
                }
                grps[t].Add(si);
                alllist.Add(si.BaseInfo.WindCode, si);
            }
            int cnt = 0;

            foreach (int k in grps.Keys)
            {
                if (cnt++ == 0)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(runBuild), grps[k]);
                }
            }
            if (!AllSecSet.ContainsKey(SecType.Equit))
            {
                AllSecSet.Add(SecType.Equit, alllist);
            }
        }
Exemplo n.º 13
0
        public static DateTime[] getTradeDates(MongoDataReader w, DateTime begt, DateTime endt, Cycle cyc)
        {
            TDaysGuidClas tgc = new TDaysGuidClas();

            tgc.cycle = cyc;
            TDayGuildBuilder_ForMG tgb = new TDayGuildBuilder_ForMG(w, tgc);
            MTable ret = tgb.getRecords(begt, endt);

            return(ret.ToList <DateTime>().ToArray());
        }
        protected override bool AfterSave(bool newRecord, bool success)
        {
            if (newRecord)
            {
                string Sql        = "SELECT object_name FROM all_objects WHERE object_type IN ('TABLE','VIEW') AND (object_name)  = UPPER('VADMS_TEAM_ACCESS') AND OWNER LIKE '" + DB.GetSchema() + "'";
                string ObjectName = Convert.ToString(DB.ExecuteScalar(Sql));
                if (ObjectName != "")
                {
                    Sql = @"SELECT Distinct AD_Table_ID,record_ID FROM VADMS_Team_Access where C_Team_ID=" + GetC_Team_ID() + " AND IsActive='Y'";
                    DataSet ds = DB.ExecuteDataset(Sql);
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            //MTable table = MTable.Get(GetCtx(), "VADMS_Team_Access");
                            //PO pos = table.GetPO(GetCtx(), 0, null);

                            //pos.Set_Value("AD_Table_ID", Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]));
                            //pos.Set_Value("AD_User_ID", GetAD_User_ID());
                            //pos.Set_Value("Record_ID", Convert.ToInt32(ds.Tables[0].Rows[i]["Record_ID"]));
                            //pos.Set_Value("C_Team_ID", GetC_Team_ID());
                            //pos.Set_Value("VADMS_Access", "20");
                            //pos.Save();


                            string strQuery = "SELECT VADMS_ACCESS FROM (SELECT record_id,vadms_access,ad_role_id, NULL as AD_USER_ID " +
                                              ",vadms_role_access.vadms_role_access_id,null as vadms_user_access_ID " +
                                              "FROM vadms_role_access WHERE RECORD_ID=" + Convert.ToInt32(ds.Tables[0].Rows[i]["Record_ID"]) + " AND ad_table_id = " + Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]) + "  AND record_id NOT IN" +
                                              "(SELECT record_id FROM vadms_user_access WHERE ad_user_id = " + GetAD_User_ID() + " and ad_table_id = " + Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]) + ") " +

                                              "UNION " +

                                              "SELECT record_id, vadms_access, NULL as AD_Role_ID, AD_USER_ID ,NULL AS vadms_role_access_id,vadms_user_access.vadms_user_access_ID FROM vadms_user_access WHERE RECORD_ID=" + Convert.ToInt32(ds.Tables[0].Rows[i]["Record_ID"]) + " AND ad_user_id = " + GetAD_User_ID() + " and ad_table_id =" + Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]) +
                                              ") ARQ ";

                            int documentAccess = Convert.ToInt32(DB.ExecuteScalar(strQuery));


                            if (documentAccess == 0)
                            {
                                MTable tableUserAccess = MTable.Get(GetCtx(), "VADMS_User_Access");
                                PO     posUserAccess   = tableUserAccess.GetPO(GetCtx(), 0, null);

                                posUserAccess.Set_Value("AD_Table_ID", Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]));
                                posUserAccess.Set_Value("AD_User_ID", GetAD_User_ID());
                                posUserAccess.Set_Value("Record_ID", Convert.ToInt32(ds.Tables[0].Rows[i]["Record_ID"]));
                                posUserAccess.Set_Value("VADMS_Access", "20");
                                posUserAccess.Save();
                            }
                        }
                    }
                }
            }
            return(true);
        }
        protected override String DoIt()
        {
            //Get value from System Config for key SYSTEM_NATIVE_SEQUENCE
            String sql = "SELECT Value FROM AD_SysConfig"
                         + " WHERE Name='SYSTEM_NATIVE_SEQUENCE' AND AD_Client_ID IN (0) AND AD_Org_ID IN (0) AND IsActive='Y'"
                         + " ORDER BY AD_Client_ID DESC, AD_Org_ID DESC";

            object result = DB.ExecuteScalar(sql);

            if (result == null || result == DBNull.Value)
            {
                throw new Exception(Msg.GetMsg(GetCtx(), "KeyNotFound"));
            }


            // If already activated, then return.

            if (MSysConfig.IsNativeSequence(false))
            {
                throw new Exception(Msg.GetMsg(GetCtx(), "NativeSequenceActived"));
            }

            SetSystemNativeSequence(true);
            bool ok = false;

            try
            {
                CreateSequence("AD_Sequence", Get_TrxName());
                CreateSequence("AD_Issue", Get_TrxName());
                CreateSequence("AD_ChangeLog", Get_TrxName());

                sql = "SELECT AD_Table_ID FROM AD_Table WHERE TableName NOT IN ('AD_Sequence', 'AD_Issue', 'AD_ChangeLog') AND IsActive='Y'";
                DataSet ds = DB.ExecuteDataset(sql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        MTable table = new MTable(GetCtx(), Convert.ToInt32(ds.Tables[0].Rows[i]["AD_Table_ID"]), null);
                        CreateSequence(table, Get_TrxName());
                    }
                }

                ok = true;
            }
            finally
            {
                if (!ok)
                {
                    SetSystemNativeSequence(false);
                }
            }

            return("@OK@");
        }
Exemplo n.º 16
0
        /// <summary>
        /// Select report info based on Document type selected in that particular record.
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="tableID"></param>
        /// <param name="record_ID"></param>
        /// <returns></returns>
        private int GetDoctypeBasedReport(Ctx ctx, int tableID, int record_ID)
        {
            #region To Override Default Process With Process Linked To Document Type

            string colName = "C_DocTypeTarget_ID";


            string sql1 = "SELECT COUNT(*) FROM AD_Column WHERE AD_Table_ID=" + tableID + " AND ColumnName   ='C_DocTypeTarget_ID'";
            int    id   = Util.GetValueOfInt(DB.ExecuteScalar(sql1));
            if (id < 1)
            {
                colName = "C_DocType_ID";
                sql1    = "SELECT COUNT(*) FROM AD_Column WHERE AD_Table_ID=" + tableID + " AND ColumnName   ='C_DocType_ID'";
                id      = Util.GetValueOfInt(DB.ExecuteScalar(sql1));
            }

            if (id > 0)
            {
                string tableName = MTable.GetTableName(ctx, tableID);
                sql1 = "SELECT " + colName + ", AD_Org_ID FROM " + tableName + " WHERE " + tableName + "_ID =" + Util.GetValueOfString(record_ID);
                DataSet ds = DB.ExecuteDataset(sql1);

                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    // Check if Document Sequence has organization Level checked, if yes then get report from there.
                    // If Not, then try to get report from Document Type.
                    sql1 = @"SELECT AD_Sequence_No.Report_ID
                                From Ad_Sequence Ad_Sequence
                                JOIN C_Doctype C_Doctype
                                ON (C_Doctype.Docnosequence_Id =Ad_Sequence.Ad_Sequence_Id 
                                AND C_DocType.ISDOCNOCONTROLLED='Y')  
                                JOIN AD_Sequence_No AD_Sequence_No
                                On (Ad_Sequence_No.Ad_Sequence_Id=Ad_Sequence.Ad_Sequence_Id
                                AND Ad_Sequence_No.AD_Org_ID=" + Convert.ToInt32(ds.Tables[0].Rows[0]["AD_Org_ID"]) + @")
                                JOIN AD_Process ON AD_Process.AD_Process_ID=AD_Sequence_No.Report_ID
                                Where C_Doctype.C_Doctype_Id     = " + Convert.ToInt32(ds.Tables[0].Rows[0][0]) + @"
                                And Ad_Sequence.Isorglevelsequence='Y' AND Ad_Sequence.IsActive='Y' AND AD_Process.IsActive='Y'";

                    object processID = DB.ExecuteScalar(sql1);
                    if (processID == DBNull.Value || processID == null || Convert.ToInt32(processID) == 0)
                    {
                        sql1      = "select Report_ID FRoM C_Doctype WHERE C_Doctype_ID=" + Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                        processID = DB.ExecuteScalar(sql1);
                    }
                    if (processID != DBNull.Value && processID != null && Convert.ToInt32(processID) > 0)
                    {
                        return(Convert.ToInt32(processID));
                    }
                }
            }
            return(0);

            #endregion
        }
Exemplo n.º 17
0
    public TaskSolution Solve(DiffMethod method, double a, double b, int n)
    {
        TablesManager manager = new TablesManager();

        t0Table    = manager.T0Table;
        mTable     = manager.MTable;
        nTable     = manager.NTable;
        sigmaTable = manager.SigmaTable;

        DiffEquationSys deSys = null;

        switch (method)
        {
        case DiffMethod.RungeKutta:
            deSys = new RungeKuttaDiffEquationSys(new DiffEquationSys.SeveralArgFun[]
            {
                (x, y) => ((y[1] - (Rk + Rp(y[0])) * y[0]) / Lk),
                (x, y) => (-y[0] / Ck)
            });
            break;

        case DiffMethod.ImplTrap:
            deSys = new ImplTrapDiffEquationSys(new DiffEquationSys.SeveralArgFun[]
            {
                (x, y) => ((y[1] - (Rk + Rp(y[0])) * y[0]) / Lk),
                (x, y) => (-y[0] / Ck)
            });
            break;
        }

        DiffEquationSolution[] sysSolution = deSys.FindSolution(a, b, new double[] { I0, Uc0 }, n);
        DiffEquationSolution   rpSolution  = new DiffEquationSolution(a, b, n);

        for (int i = 0; i <= n; i++)
        {
            rpSolution.Y[i] = Rp(sysSolution[0].Y[i]);
        }
        DiffEquationSolution ucpSolution = new DiffEquationSolution(a, b, n);

        for (int i = 0; i <= n; i++)
        {
            ucpSolution.Y[i] = rpSolution.Y[i] * sysSolution[0].Y[i];
        }

        TaskSolution taskSolution;

        taskSolution.I   = sysSolution[0];
        taskSolution.Uc  = sysSolution[1];
        taskSolution.Rp  = rpSolution;
        taskSolution.Ucp = ucpSolution;

        return(taskSolution);
    }
Exemplo n.º 18
0
        private void OnLoadMonitorList(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "ssm文件|*.ssm";
            if (openFileDialog.ShowDialog() == true)
            {
                if (MTable.Load(openFileDialog.FileName) != 0)
                {
                    LocalizedMessageBox.Show("不正确的监视文件,监视文件已损坏!", LocalizedMessageIcon.Information);
                }
            }
        }
Exemplo n.º 19
0
        private void OnSaveMonitorList(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "ssm文件|*.ssm";
            if (saveFileDialog.ShowDialog() == true)
            {
                if (MTable.Save(saveFileDialog.FileName) != 0)
                {
                    LocalizedMessageBox.Show("无法保存监视文件!", LocalizedMessageIcon.Information);
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Add Table in DB
        /// </summary>
        /// <param name="md">DB Info</param>
        /// <param name="catalog">current catalog</param>
        /// <param name="schema">schema</param>
        private void AddTable(DatabaseMetaData md, String catalog, String schema)
        {
            DataSet ds = md.GetTables();

            for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
            {
                String tableName = ds.Tables[0].Rows[i]["TABLE_NAME"].ToString();
                String tableType = ds.Tables[0].Rows[i]["TABLE_TYPE"].ToString();

                //	Try to find
                MTable table = MTable.Get(GetCtx(), tableName);
                //	Create new ?
                if (table == null)
                {
                    String tn = tableName.ToUpper();
                    if (tn.StartsWith("T_SELECTION") || //	temp table
                        tn.EndsWith("_VT") ||           //	print trl views
                        tn.EndsWith("_V") ||            //	views
                        tn.EndsWith("_V1") ||           //	views
                        tn.StartsWith("A_A") ||         //	asset tables not yet
                        tn.StartsWith("A_D") ||         //	asset tables not yet
                        (tn.IndexOf("$") != -1          //	oracle system tables
                        ) ||
                        (tn.IndexOf("EXPLAIN") != -1    //	explain plan
                        )
                        )
                    {
                        log.Fine("Ignored: " + tableName + " - " + tableType);
                        continue;
                    }
                    //
                    log.Info(tableName + " - " + tableType);

                    //	Create New
                    table = new MTable(GetCtx(), 0, Get_Trx());
                    table.SetEntityType(p_EntityType);
                    table.SetName(tableName);
                    table.SetTableName(tableName);
                    table.SetIsView("VIEW".Equals(tableType));
                    if (!table.Save())
                    {
                        continue;
                    }
                }
                //	Check Columns
                tableName = tableName.ToUpper();
                DataSet rsC = md.GetColumns(catalog, schema, tableName);
                //addTableColumn(GetCtx(), rsC, table, p_EntityType);
                //SubTableUtil.checkStandardColumns(table, p_EntityType);
            }
        }       //	addTable
Exemplo n.º 21
0
 public MRow(MTable matrix, Node node, int index)
 {
     this.isLabeled = false;
     this.index     = 0;
     this.align     = RowAlign.UNKNOWN;
     this.spacing   = "0.5ex";
     this.lines     = TableLineStyle.NONE;
     this.index     = index;
     this.attrs     = AttributeBuilder.MRowAttributes(node);
     this.colAligns = new HAlign[] { HAlign.UNKNOWN };
     this.matrix    = matrix;
     this.node      = node;
     this.cells     = new ArrayList();
 }
 /// <summary>
 /// Create Sequence for given table.
 /// </summary>
 /// <param name="table"></param>
 /// <param name="trxName"></param>
 private void CreateSequence(MTable table, Trx trxName)
 {
     if (!table.IsView())
     {
         if (!MSequence.CreateTableSequence(GetCtx(), table.GetTableName(), trxName))
         {
             //throw new Exception("Can not create Native Sequence for table " + table.GetTableName());
             this.AddLog("Can not create Native Sequence for table : " + table.GetTableName());
         }
         else
         {
             this.AddLog("Create Native Sequence for : " + table.GetTableName());
         }
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Get Persistent Object
        /// </summary>
        /// <returns>po</returns>
        public PO GetPO()
        {
            if (_po != null)
            {
                return(_po);
            }
            if (GetRecord_ID() == 0)
            {
                return(null);
            }

            MTable table = MTable.Get(GetCtx(), GetAD_Table_ID());

            _po = table.GetPO(GetCtx(), GetRecord_ID(), Get_TrxName());
            return(_po);
        }
Exemplo n.º 24
0
        public MovesetManager(string mtablePath)
        {
            var directory = Path.GetDirectoryName(mtablePath);

            string[] files = Directory.EnumerateFiles(directory, "*.bin").ToArray();

            if (files.Length == 0)
            {
                return;
            }

            foreach (string file in files)
            {
                var filename = Path.GetFileName(file);

                if (filename == "game.bin")
                {
                    Game   = new ACMDFile(file);
                    Endian = Game.Endian;
                }
                if (filename == "effect.bin")
                {
                    Effect = new ACMDFile(file);
                    Endian = Effect.Endian;
                }
                if (filename == "sound.bin")
                {
                    Sound  = new ACMDFile(file);
                    Endian = Sound.Endian;
                }
                if (filename == "expression.bin")
                {
                    Expression = new ACMDFile(file);
                    Endian     = Expression.Endian;
                }
            }
            if (File.Exists(mtablePath))
            {
                MotionTable = new MTable(mtablePath, Endian);
            }

            ScriptsHashList = new List <uint>();
            if (MotionTable != null)
            {
                ScriptsHashList.AddRange(MotionTable.ToList());
            }
        }
Exemplo n.º 25
0
 private static void write_mlist(MTable table, Dictionary <uint, string> anims, string filename)
 {
     using (var writer = File.CreateText(filename))
     {
         foreach (var u in table)
         {
             if (anims.ContainsKey(u))
             {
                 writer.WriteLine(anims[u]);
             }
             else
             {
                 writer.WriteLine($"0x{u:X8}");
             }
         }
     }
 }
Exemplo n.º 26
0
        private static void HandleSequence(string value, ConnectionMultiplexer redisConnection)
        {
            try
            {
                SequenceId sId = JsonConvert.DeserializeObject <SequenceId>(value);

                int       grammarDbNumber = Convert.ToInt32(properties["GRAMMAR_DB"]);
                IDatabase grammarDb       = redisConnection.GetDatabase(grammarDbNumber);

                string  grammarStr = grammarDb.StringGet("GRAMMAR_" + sId.id);
                Grammar grammar    = JsonConvert.DeserializeObject <Grammar>(grammarStr);

                int       newGrammarDbNumber = Convert.ToInt32(properties["NEW_GRAMMAR_DB"]);
                IDatabase newGrammarDb       = redisConnection.GetDatabase(newGrammarDbNumber);

                string     newGrammarStr = newGrammarDb.StringGet("NEW_GRAMMAR_" + sId.id);
                NewGrammar newGrammar    = JsonConvert.DeserializeObject <NewGrammar>(newGrammarStr);

                int       mTableDbNumber = Convert.ToInt32(properties["TABLE_M_DB"]);
                IDatabase mTableDb       = redisConnection.GetDatabase(mTableDbNumber);

                string mTableStr = mTableDb.StringGet("TABLE_M_" + sId.id);
                MTable mTable    = JsonConvert.DeserializeObject <MTable>(mTableStr);

                SequenceHandler sequenceHandler = new SequenceHandler(grammar.startSymbol, newGrammar.terminals, newGrammar.noTerminals, mTable.mTable);
                sequenceHandler.Process(sId.sequence);

                IDatabase redisDb = ConnectionMultiplexer.Connect(properties["REDIS_SERVER"])
                                    .GetDatabase(Convert.ToInt32(properties["SEQUENCE_DB"]));

                Sequence sequence = sequenceHandler.GetSequence();
                sequence.grammarId = "NEW_GRAMMAR_" + sId.id;
                string json  = JsonConvert.SerializeObject(sequence);
                String newId = "SEQUENCE_RESULT_" + sId.id;
                redisDb.StringSet(newId, json);
                Console.WriteLine(newId + ": " + json + " - saved to redis SEQUENCE_DB");

                MakeStatisticEvent(newId);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Exemplo n.º 27
0
        private void 明细显示_Load(object sender, EventArgs e)
        {
            Mt = new MTable
            {
                分页     = true,
                每页数量   = 200,
                Width  = Width - 20,
                Left   = 10,
                Top    = 60,
                Height = Height - 125,
                Parent = this
            };

            if (Dc != null)
            {
                Mt.分页    = false;
                Width    = 530;
                Mt.Width = Width - 20;
                Mt.数据表名称 = "m_rukuku_内部维修_领料list";
                Mt.ShowData(Dc);
                Mt.ReadOnly = false;
                for (int i = 0; i < Mt.ColumnCount; i++)
                {
                    if (Mt.Columns[i].HeaderText != "数量")
                    {
                        Mt.Columns[i].ReadOnly = true;
                    }
                }
                Label Btn = Skincss.AddLable(this, "确定", "10/" + (Mt.Top + Mt.Height + 10), "120/30", "#255255255", 10, "", 1, -1, false, Skin.upBColor);
                Btn.Click      += Btn_Click;
                Mt.CellClick   += Mt_CellClick;
                Mt.CellEndEdit += Mt_CellEndEdit;
            }
            else
            {
                m_rukukuinfo        mr  = new m_rukukuinfo();
                List <m_rukukuinfo> lmr = new List <m_rukukuinfo>();
                lmr      = mr.Select("and fid=" + id);
                Mt.数据表名称 = "m_rukuku_内部维修_明细";
                Mt.ShowList(lmr);
            }
        }
Exemplo n.º 28
0
        private void fitOpen_Click(object sender, EventArgs e)
        {
            if (fsDlg.ShowDialog() == DialogResult.OK)
            {
                this.Reset();
                foreach (var p in Directory.EnumerateFiles(fsDlg.SelectedPath))
                {
                    if (p.EndsWith(".bin"))
                    {
                        var acmd = new ACMDFile(p);
                        ScriptFiles.Add(p, acmd);
                        Runtime.WorkingEndian = acmd.Endian;
                    }
                    else if (p.EndsWith(".mtable"))
                    {
                        MotionTable = new MTable(p, Runtime.WorkingEndian);
                    }
                }
                var acmdnode = new TreeNode("ACMD")
                {
                    Name = "nACMD"
                };

                for (int i = 0; i < MotionTable.Count; i++)
                {
                    var node = new ScriptNode(MotionTable[i], $"{i:X} - [{MotionTable[i]:X8}]");
                    foreach (var keypair in ScriptFiles)
                    {
                        if (keypair.Value.Scripts.Keys.Contains(MotionTable[i]))
                        {
                            node.Scripts.Add(Path.GetFileNameWithoutExtension(keypair.Key), keypair.Value.Scripts[MotionTable[i]]);
                        }
                    }
                    acmdnode.Nodes.Add(node);
                }
                FileTree.Nodes.Add(acmdnode);
                IDEMode    = IDE_MODE.Fighter;
                this.Text += fsDlg.SelectedPath;
            }
        }
Exemplo n.º 29
0
        }       //	prepare

        /// <summary>
        /// Process
        /// </summary>
        /// <returns></returns>
        protected override String DoIt()
        {
            if (p_AD_Table_ID == 0)
            {
                throw new Exception("@NotFound@ @AD_Table_ID@ " + p_AD_Table_ID);
            }
            log.Info("EntityType=" + p_EntityType
                     + ", AllTables=" + p_AllTables
                     + ", AD_Table_ID=" + p_AD_Table_ID);

            Trx trx             = Trx.Get("getDatabaseMetaData");
            DatabaseMetaData md = new DatabaseMetaData();

            string catalog = "";
            string schema  = DataBase.DB.GetSchema();

            if (p_AllTables)
            {
                AddTable(md, catalog, schema);
            }
            else
            {
                MTable table = new MTable(GetCtx(), p_AD_Table_ID, Get_Trx());
                if ((table == null) || (table.Get_ID() == 0))
                {
                    throw new Exception("@NotFound@ @AD_Table_ID@ " + p_AD_Table_ID);
                }
                log.Info(table.GetTableName() + ", EntityType=" + p_EntityType);
                String tableName = table.GetTableName();

                //tableName = tableName.ToUpper();
                DataSet rs = md.GetColumns(catalog, schema, tableName.ToUpper());
                AddTableColumn(GetCtx(), rs, table, p_EntityType);
                SubTableUtil.CheckStandardColumns(table, p_EntityType);
            }
            md.Dispose();
            trx.Close();
            return("#" + m_count);
        }
Exemplo n.º 30
0
        private bool OpenFile(string Filepath)
        {
            bool handled = false;

            if (Filepath.EndsWith(".bin"))
            {
                DataSource source = new DataSource(FileMap.FromFile(Filepath));
                if (*(buint *)source.Address == 0x41434D44) // ACMD
                {
                    if (*(byte *)(source.Address + 0x04) == 0x02)
                    {
                        Runtime.WorkingEndian = Endianness.Little;
                    }
                    else if ((*(byte *)(source.Address + 0x04) == 0x00))
                    {
                        Runtime.WorkingEndian = Endianness.Big;
                    }
                    else
                    {
                        handled = false;
                    }

                    ACMD_FILES.Add(Path.GetFileNameWithoutExtension(Filepath), new ACMDFile(source));
                    handled = true;
                }
            }
            else if (Filepath.EndsWith(".mscsb")) // MSC
            {
                MSC_FILES.Add(Path.GetFileNameWithoutExtension(Filepath), new MSCFile(Filepath));
                handled = true;
            }
            else if (Filepath.EndsWith(".mtable"))
            {
                MotionTable = new MTable(Filepath, Runtime.WorkingEndian);
            }

            return(handled);
        }