/// <summary>
        /// historyテーブルに移す
        /// </summary>
        public void Tohistory()
        {
            try
            {
                var dbConnection = new SQLiteConnect();

                // TODO : コネクションは削除の方とまとめること
                using (dbConnection.conn)
                    using (var transaction = dbConnection.conn.BeginTransaction())
                    {
                        var cmd = dbConnection.conn.CreateCommand();

                        var sql = new StringBuilder();
                        sql.Append("REPLACE INTO history (move_date, title, url, date)");
                        sql.Append("SELECT @NOWTIME,title, url, date ");
                        sql.Append("FROM pages");

                        cmd.CommandText = sql.ToString();

                        cmd.Parameters.Add(SetParam("@NOWTIME", DbType.String, DateTime.Now.ToString()));

                        cmd.ExecuteNonQuery();

                        transaction.Commit();
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        private void BeginDownLoad()
        {
            _progressBar.Maximum = 4;
            _progressBar.Value   = 0;
            OperateLog log = new OperateLog();

            log.Guid        = CO_IA.Client.Utility.NewGuid();
            log.Operater    = RiasPortal.Current.UserSetting.UserName;
            log.OperateDate = DateTime.Now;
            log.OperateType = OperateTypeEnum.DownLoad;
            UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(_progressBar.SetValue);

            SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(SystemLoginService.CurrentActivity.Name);
            try
            {
                SQLiteDataService.DeleteStationBase(SystemLoginService.CurrentActivity.Guid, SystemLoginService.CurrentActivityPlace.Guid);
                SQLiteDataService.DeleteFreqPlan(SystemLoginService.CurrentActivity.Guid, SystemLoginService.CurrentActivityPlace.Guid);
                SQLiteDataService.DeletePlace(SystemLoginService.CurrentActivity.Guid);
                for (int i = 0; i < 4; i++)
                {
                    if (i == 0 && _statDownLoad.IsChecked == true)
                    {
                        _downLoadInfo.Text = "正在下载周围台站数据";
                        DownLoadStationBase();
                        log.OperateTables += "ACTIVITY_PLACE_STATION,";
                    }
                    //else if (i == 1 && _emitDownLoad.IsChecked == true)
                    //{
                    //    _downLoadInfo.Text = "正在下载设备信息数据";
                    //    DownLoadEquipInfo();
                    //    log.OperateTables += "ACTIVITY_STATION_EMIT,";
                    //}

                    else if (i == 2 && _areaDownLoad.IsChecked == true)
                    {
                        _downLoadInfo.Text = "正在下载活动区域数据";
                        DownLoadActivityPlace();
                        log.OperateTables += "ACTIVITY_PLACE,ACTIVITY_PLACE_LOCATION,";
                    }
                    else if (i == 3 && _freqRangeDownLoad.IsChecked == true)
                    {
                        _downLoadInfo.Text = "正在下载频率预案数据";
                        DownLoadFreqPlan();
                        log.OperateTables += "activity_place_freq_plan, rias_equipment_freqplanning,";
                    }
                    Dispatcher.Invoke(updatePbDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { System.Windows.Controls.ProgressBar.ValueProperty, Convert.ToDouble(i + 1) });
                }
                SQLiteDataService.SaveOperaterLog(log);

                SQLiteDataService.Transaction.Commit();
                _downLoadInfo.Text = "下载完成";
            }
            catch (Exception ex)
            {
                SQLiteDataService.Transaction.Rollback();
                Console.WriteLine(ex.Message);
                _downLoadInfo.Text = "下载失败";
                MessageBox.Show("失败原因:\r\n" + ex.Message);
            }
        }
Beispiel #3
0
        public List <studentModel> GetListDelete()
        {
            List <studentModel> list = new List <studentModel>();
            var    sqlConnection     = SQLiteConnect.CreateInstance().SQLiteConnection;
            String querry            = "select * from Student_2 where status=0";

            using (var result = sqlConnection.Prepare(querry))
            {
                while (SQLiteResult.ROW == result.Step())
                {
                    String rollNumber = result["rollNumber"].ToString();
                    String name       = (string)result["name"];
                    String status     = result["status"].ToString();;

                    var student = new studentModel()
                    {
                        rollNumber = Convert.ToInt32(rollNumber),
                        name       = name,
                        status     = Convert.ToInt32(status),
                    };
                    list.Add(student);
                }
            }
            return(list);
        }
Beispiel #4
0
        public ActionResult Customer()
        {
            SQLiteConnect cnt = new SQLiteConnect();

            cnt.GetCustomerByID(1);
            return(View());
        }
        /// <summary>
        /// DBインサート
        /// </summary>
        public void Ins(WebPageData wpd)
        {
            try
            {
                var dbConnection = new SQLiteConnect();

                using (dbConnection.conn)
                    using (var transaction = dbConnection.conn.BeginTransaction())
                    {
                        var cmd = dbConnection.conn.CreateCommand();

                        cmd.CommandText = "REPLACE INTO pages (title, url, date) VALUES (@TITLE, @URL, @DATE)";

                        cmd.Parameters.Add(SetParam("@TITLE", DbType.String, wpd.Title));
                        cmd.Parameters.Add(SetParam("@URL", DbType.String, wpd.URL));
                        cmd.Parameters.Add(SetParam("@DATE", DbType.String, wpd.nowtime.ToString()));

                        cmd.ExecuteNonQuery();

                        transaction.Commit();
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void ParseAttribute(string attribute, string itemClass)
        {
            //Console.WriteLine("Parse Attribute");
            Dictionary <string, double> calculatedStats = new Dictionary <string, double>();
            BsonDocument Stat    = new BsonDocument();
            bool         isEquip = SQLiteConnect.getEquipItemStats(itemClass, calculatedStats, out string qualityType, out string enhanceType);
            int          ability = -1;

            if (!isEquip)
            {
                if (attribute.Contains("VARIABLESTAT"))
                {
                    ApplyVariableStat(attribute, calculatedStats, itemClass, out ability);
                }
            }
            else
            {
                if (attribute.Contains("COMBINATION"))
                {
                    ApplyCombination(attribute, calculatedStats, out qualityType, out enhanceType);
                }
                if (attribute.Contains("GEMSTONEINFO"))
                {
                    ApplyGemstone(attribute, calculatedStats);
                }
                if (attribute.Contains("QUALITY"))
                {
                    ApplyQuality(attribute, calculatedStats, qualityType);
                }
                if (attribute.Contains("ENHANCE"))
                {
                    ApplyEnhance(attribute, calculatedStats, enhanceType);
                }
                if (attribute.Contains("SPIRIT_INJECTION"))
                {
                    ApplySpiritInjection(attribute, calculatedStats);
                }
                if (attribute.Contains("PREFIX"))
                {
                    ApplyEnchantType("PREFIX", attribute, calculatedStats);
                }
                if (attribute.Contains("SUFFIX"))
                {
                    ApplyEnchantType("SUFFIX", attribute, calculatedStats);
                }
            }
            if (calculatedStats.Count != 0)
            {
                SetStats(Stat, calculatedStats);
                SetAbility(ability, Stat);
                Attributes.Add("Stat", Stat);
                string statStr = GetStatString(calculatedStats);
                Attributes.Add("StatStr", statStr);
            }
            if (attribute.Contains("ANTIBIND"))
            {
                SetAntiBind(attribute);
            }
        }
        private static void ApplyQuality(string attribute, Dictionary <string, double> stats, string qualityType)
        {
            Console.WriteLine("Apply Quality");
            MatchCollection mc = Regex.Matches(attribute, @"QUALITY:\(([0-9]+)\)");

            foreach (Match m in mc)
            {
                int quality = int.Parse(m.Groups[1].ToString());
                SQLiteConnect.ApplyQualityMultiplier(quality, qualityType, stats);
            }
        }
        private void SetAbility(int ability, BsonDocument Stat)
        {
            if (ability == -1)
            {
                return;
            }
            string abilityClass = SQLiteConnect.GetAbilityClass(ability);
            string abilityDesc  = MongoDBConnect.connection.GetAbilityString(abilityClass);

            Stat.Add("Ability", abilityDesc);
        }
        private static void ApplyEnhance(string attribute, Dictionary <string, double> stats, string enhanceType)
        {
            Console.WriteLine("Apply Enhance");
            MatchCollection mc = Regex.Matches(attribute, @"ENHANCE:([0-9]+)");

            foreach (Match m in mc)
            {
                int enhance = int.Parse(m.Groups[1].ToString());
                SQLiteConnect.ApplyEnhanceStats(enhance, enhanceType, stats);
            }
        }
Beispiel #10
0
        //public studentModel GetDetail(int id)
        //{
        //    List<studentModel> list = new List<studentModel>();
        //    var sqlConnection = SQLiteConnect.CreateInstance().SQLiteConnection;
        //    var querry = "select * from Student where id=" + id;
        //    using (var result = sqlConnection.Prepare(querry))
        //    {
        //        while (SQLiteResult.ROW == result.Step())
        //        {
        //            String id2 = result["id"].ToString();
        //            String name = (string)result["name"];
        //            String address = (string)result["address"];
        //            String age = (string)result["address"];
        //            var student = new student()
        //            {
        //                id = id,
        //                name = name,
        //                address = address,
        //                age = Int32.Parse(age),
        //            };
        //            list.Add(student);
        //        }
        //        return list[0];
        //    }
        //}

        public bool deleteStudent(int id)
        {
            var sqlConnection = SQLiteConnect.CreateInstance().SQLiteConnection;
            var querry        = "UPDATE Student_2 SET status=0 WHERE rollNumber=" + id;

            using (var stt = sqlConnection.Prepare(querry))
            {
                var result = stt.Step();
                Debug.WriteLine("result=" + result);
            }
            return(true);
        }
Beispiel #11
0
        public static void Main(string[] args)
        {
            string mongoUri = Environment.GetEnvironmentVariable("MONGO_URI");

            SQLiteConnect.SetupDicts();
            MongoDBConnect.SetupConnect(mongoUri);
            Properties.Settings settings = Properties.Settings.Default;
            FrontendConnect     c        = new FrontendConnect(settings.username, settings.pin.ToString(), 1);

            c.Login();
            c.jp.Join();
        }
        private void SetMaxEnhanceString(string enhanceType, string qualityType, int enchantMaxLevel)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Max Enhance Level ");
            sb.Append(SQLiteConnect.GetMaxEnhance(enhanceType));
            sb.Append(", Max Quality ");
            sb.Append(SQLiteConnect.GetMaxQuality(qualityType));
            sb.Append(" Star, Max Enchant Rank ");
            sb.Append(SQLiteConnect.EnchantNumToLevel(enchantMaxLevel));

            Attributes.Add("MaxEnhance", sb.ToString());
        }
        private void AddComposite(Dictionary <string, double> stats, string itemClass, BsonArray Composite)
        {
            Console.WriteLine("Add Composite");
            BsonDocument compositeStat = new BsonDocument();

            SetStats(compositeStat, stats);
            compositeStat.Add("ItemClass", itemClass);
            string icon = SQLiteConnect.GetIcon(itemClass);

            compositeStat.Add("Icon", icon);
            string statStr = GetStatString(stats);

            compositeStat.Add("StatStr", statStr);
            Composite.Add(compositeStat);
        }
Beispiel #14
0
        public bool Save(studentModel student)
        {
            var sqlConnection = SQLiteConnect.CreateInstance().SQLiteConnection;
            var querry        = "insert into Student_2 (rollNumber, name, status) values (?,?,?)";

            using (var stt = sqlConnection.Prepare(querry))
            {
                stt.Bind(1, student.rollNumber);
                stt.Bind(2, student.name);
                stt.Bind(3, student.status);
                var result = stt.Step();
                Debug.WriteLine("result=" + result);
                return(true);
            }
        }
Beispiel #15
0
        private void BeginUpLoad()
        {
            _progressBar.Maximum = 2;
            _progressBar.Value   = 0;

            UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(_progressBar.SetValue);
            OperateLog log = new OperateLog();

            log.Guid        = CO_IA.Client.Utility.NewGuid();
            log.Operater    = RiasPortal.Current.UserSetting.UserName;
            log.OperateDate = DateTime.Now;
            log.OperateType = OperateTypeEnum.UpLoad;
            try
            {
                for (int i = 0; i < 2; i++)
                {
                    if (i == 0)
                    {
                        if (_analysisUpLoad.IsChecked == true)
                        {
                            _upLoadInfo.Text = "正在上传分析结果数据";
                            UpLoadAnalysisResult();
                            log.OperateTables += "ACTIVITY_ANALYSIS_RESULT,";
                        }
                    }
                    else if (i == 1)
                    {
                        if (_emitUpLoad.IsChecked == true)
                        {
                            _upLoadInfo.Text = "正在上传发射信息数据";
                            UpLoadEmitInfo();
                            log.OperateTables += "ACTIVITY_EMIT_INFO,";
                        }
                    }
                    Dispatcher.Invoke(updatePbDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { System.Windows.Controls.ProgressBar.ValueProperty, Convert.ToDouble(i + 1) });
                }
                SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(SystemLoginService.CurrentActivity.Name);
                SQLiteDataService.SaveOperaterLog(log);
                SQLiteDataService.Transaction.Commit();
                _upLoadInfo.Text = "上传成功";
            }
            catch (Exception ex)
            {
                _upLoadInfo.Text = "上传失败";
                //MessageBox.Show("失败原因:\r\n" + ex.Message);
            }
        }
        private void AddComposite(Dictionary <string, double> stats, string itemClass, BsonArray Composite, int ability)
        {
            Console.WriteLine("Add Composite");
            BsonDocument compositeStat = new BsonDocument();

            SetStats(compositeStat, stats);
            compositeStat.Add("ItemClass", itemClass);
            string abilityClass = SQLiteConnect.GetAbilityClass(ability);
            string abilityDesc  = MongoDBConnect.connection.GetAbilityString(abilityClass);
            string icon         = SQLiteConnect.GetIcon(itemClass);

            compositeStat.Add("Icon", icon);
            compositeStat.Add("Ability", abilityDesc);
            string statStr = GetStatString(stats);

            compositeStat.Add("StatStr", statStr);
            Composite.Add(compositeStat);
        }
        private void ApplyEnchantType(string type, string attribute, Dictionary <string, double> calculatedStats)
        {
            Console.WriteLine("Apply Enchant");
            BsonDocument    doc = new BsonDocument();
            MatchCollection mc  = Regex.Matches(attribute, type + @":([a-z_0-9]+)");

            foreach (Match m in mc)
            {
                string enchant = m.Groups[1].ToString();
                Dictionary <string, double> stats = new Dictionary <string, double>();
                SQLiteConnect.ApplyEnchantStats(enchant, stats, out string buff);
                SetStats(doc, stats);
                doc.Add("Enchant", enchant);
                if (buff.Length != 0)
                {
                    doc.Add("Buff", buff);
                }
                CombineStats(calculatedStats, stats);
            }
            Attributes.Add(type, doc);
        }
        private void ApplyVariableStat(string attribute, Dictionary <string, double> calculatedStats, string itemClass, out int ability)
        {
            Console.WriteLine("Apply Variable Stat");
            CombineStats(calculatedStats, SQLiteConnect.classCombineStats[itemClass]);
            MatchCollection mc = Regex.Matches(attribute, @"VARIABLESTAT:([0-9;]+)");

            ability = -1;
            foreach (Match m in mc)
            {
                string statDiff = m.Groups[1].ToString();
                ApplyStats(statDiff, calculatedStats);
            }
            mc = Regex.Matches(attribute, @"VARIABLESTAT:[0-9;]+\(([0-9]+)\)");
            foreach (Match m in mc)
            {
                int.TryParse(m.Groups[1].ToString(), out int abilityClassID);
                Console.WriteLine("Found an ability {0}", abilityClassID);
                ability = abilityClassID;
            }
            SQLiteConnect.GetEnhanceQualityEnchant(itemClass, out string enhanceType, out string qualityType, out int enchantMaxLevel);
            SetMaxEnhanceString(enhanceType, qualityType, enchantMaxLevel);
        }
Beispiel #19
0
        /// <summary>
        /// データ取得
        /// </summary>
        /// <param name="wpd"></param>
        /// <returns></returns>
        public List <WebPageData> Get(WebPageData wpd)
        {
            try
            {
                // 取得データ
                var retData = new List <WebPageData>();

                var dbConnection = new SQLiteConnect();

                using (dbConnection.conn)
                    using (var transaction = dbConnection.conn.BeginTransaction())
                    {
                        var cmd = dbConnection.conn.CreateCommand();

                        cmd.CommandText = "SELECT * FROM pages ";

                        using (var reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                var temp = new WebPageData();

                                temp.Title = reader["title"].ToString();
                                temp.URL   = reader["url"].ToString();

                                retData.Add(temp);
                            }
                        }
                    }

                return(retData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #20
0
        /// <summary>
        /// 消去
        /// </summary>
        public void Del()
        {
            try
            {
                var dbConnection = new SQLiteConnect();

                // TODO : コネクションはコピーの方とまとめること
                using (dbConnection.conn)
                    using (var transaction = dbConnection.conn.BeginTransaction())
                    {
                        var cmd = dbConnection.conn.CreateCommand();

                        cmd.CommandText = "DELETE FROM	pages";

                        cmd.ExecuteNonQuery();

                        transaction.Commit();
                    }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 保存分析结果
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_saveResult_Click(object sender, RoutedEventArgs e)
        {
            var MeasureStartTime = ((FreqCollectionIndex)lab_collectIndex.Tag).StartTime;
            var MeasureEndTime   = ((FreqCollectionIndex)lab_collectIndex.Tag).EndTime;

            BackgroundWorker worker = new BackgroundWorker();

            if (navBar.Groups.Count == 0)
            {
                MessageBox.Show("没有需要保存的数据!");
                return;
            }
            List <ObservableCollection <AnalysisResult> > freqnavbarList = new List <ObservableCollection <AnalysisResult> >();

            for (int i = 0; i < navBar.Groups.Count; i++)
            {
                NavBarGroup nbg = navBar.Groups[i];
                FreqNavBar  fnr = (FreqNavBar)nbg.Items[0];
                if (fnr.freqList != null && fnr.freqList.Count > 0)
                {
                    freqnavbarList.Add(fnr.freqList);
                }
            }
            if (freqnavbarList.Count == 0)
            {
                MessageBox.Show("没有需要保存的数据!");
                return;
            }
            busyIndicator.IsBusy = true;
            worker.DoWork       += (o, ea) =>
            {
                try
                {
                    SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(LoginService.CurrentActivity.Name);
                    for (int i = 0; i < freqnavbarList.Count; i++)
                    {
                        ObservableCollection <AnalysisResult> freqs = freqnavbarList[i];
                        if (freqs != null && freqs.Count > 0)
                        {
                            for (int j = 0; j < freqs.Count; j++)
                            {
                                AnalysisResult temp = freqs[j];
                                temp.MeasureStartTime = MeasureStartTime;
                                temp.MeasureEndTime   = MeasureEndTime;
                                temp.PlaceGuid        = LoginService.CurrentActivityPlace.Guid;
                                SQLiteDataService.SaveAnalysisResult(temp);
                            }
                        }
                    }
                    SQLiteDataService.Transaction.Commit();
                    MessageBox.Show("数据保存成功");
                }
                catch (Exception ex)
                {
                    SQLiteDataService.Transaction.Rollback();
                    MessageBox.Show(ex.Message);
                }


                //if (freqList != null && freqList.Count > 0)
                //{
                //    try
                //    {
                //        SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(LoginService.CurrentActivity.Name);

                //        for (int i = 0; i < freqList.Count; i++)
                //        {
                //            AnalysisResult temp = freqList[i];
                //            temp.MeasureStartTime = MeasureStartTime;
                //            temp.MeasureEndTime = MeasureEndTime;
                //            temp.PlaceGuid = LoginService.CurrentActivityPlace.Guid;
                //            SQLiteDataService.SaveAnalysisResult(temp);
                //        }
                //        SQLiteDataService.Transaction.Commit();
                //        MessageBox.Show("数据保存成功");
                //    }
                //    catch (Exception ex)
                //    {
                //        SQLiteDataService.Transaction.Rollback();
                //        MessageBox.Show(ex.Message);
                //    }
                //}
                //else
                //{
                //    MessageBox.Show("没有需要保存的数据!");
                //}
            };

            worker.RunWorkerCompleted += (o, ea) =>
            {
                busyIndicator.IsBusy = false;
            };
            worker.RunWorkerAsync();
        }