コード例 #1
0
        public void InitArchorSettings()
        {
            var list2 = DbInfoHelper.GetArchorSettings();

            _bll.ArchorSettings.Clear();
            _bll.ArchorSettings.AddRange(list2);
        }
コード例 #2
0
        /// <summary>
        /// 初始化设备模型和类型表
        /// </summary>
        public void InitDevModelAndType()
        {
            ////设备模型信息\\DevTypeModel.sql
            //string initFile = AppDomain.CurrentDomain.BaseDirectory + "Data\\设备模型信息\\DevTypeModel.sql";
            //if (File.Exists(initFile))
            //{
            //    try
            //    {
            //        string txt = File.ReadAllText(initFile);
            //        int count = Db.Database.ExecuteNonQuery(txt);
            //    }
            //    catch (Exception ex)
            //    {
            //        Log.Error("执行sql语句失败", ex);
            //    }
            //}
            //else
            //{
            //    Log.Info("sql文件不存在:" + initFile);
            //}
            //因为sqlite不支持改成从表格导入

            var list = DbInfoHelper.GetDevModels();

            DevModels.AddRange(list);

            var list2 = DbInfoHelper.GetDevTypes();

            DevTypes.AddRange(list2);
        }
コード例 #3
0
        private void MenuArchorSetting_Click(object sender, RoutedEventArgs e)
        {
            Bll bll   = new Bll();
            var list2 = DbInfoHelper.GetArchorSettings();

            bll.ArchorSettings.Clear();
            bll.ArchorSettings.AddRange(list2);
            MessageBox.Show("完成");
        }
コード例 #4
0
        /// <summary>
        /// 初始化设备模型和类型表
        /// </summary>
        public void InitDevModelAndType()
        {
            var list = DbInfoHelper.GetDevModels();

            DevModels.AddRange(list);

            var list2 = DbInfoHelper.GetDevTypes();

            DevTypes.AddRange(list2);
        }
コード例 #5
0
        public static string StatName(this string name)
        {
            string val;

            if (DbInfoHelper.Get().ItemStatNames.TryGetValue(name.ToLower(), out val))
            {
                return(val);
            }
            return(name);
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: ashllay/LQGMTool
 public MainForm()
 {
     CashCurItem   = -1;
     NormalCurItem = -1;
     CurUser       = new User();
     DataHelper    = DbInfoHelper.Get();
     InitializeComponent();
     this.Text    += " " + Application.ProductVersion.ToString();
     this.DefTitle = this.Text;
 }
コード例 #7
0
        public Mail AttachBox(DbDataReader reader)
        {
            this.MailID = reader.ReadInt64("MailID");
            string title = reader.ReadString("title");

            title      = DbInfoHelper.Get().GetMailTitle(title);
            this.Title = title;
            //Content
            this.Text = reader.ReadString("content");
            return(this);
        }
コード例 #8
0
        public Mail(DbDataReader reader)
        {
            //mailID
            this.MailID = reader.ReadInt64("RowID");
            string title = reader.ReadString("MailTitle");

            title      = DbInfoHelper.Get().GetMailTitle(title);
            this.Title = title;
            //Content
            this.Text  = reader.ReadString("MailContent");
            this.Count = reader.ReadInt32("Count");
        }
コード例 #9
0
 public override string ToString()
 {
     if (!string.IsNullOrEmpty(_Desc))
     {
         return(_Desc);
     }
     if (Type == ItemAttributeType.ENHANCE)
     {
         _Desc = "强化:" + Value;
     }
     else if (Type == ItemAttributeType.PREFIX)
     {
         EnchantInfo einfo = DbInfoHelper.Get().GetEnchant(Value);
         _Desc = "【字首】附魔:" + (einfo == null ? Value : einfo.ToString());
     }
     else if (Type == ItemAttributeType.SUFFIX)
     {
         EnchantInfo einfo = DbInfoHelper.Get().GetEnchant(Value);
         _Desc = "【字尾】附魔:" + (einfo == null ? Value : einfo.ToString());
     }
     else if (Type == ItemAttributeType.QUALITY)
     {
         _Desc = "星数:" + Arg;
     }
     else if (Type == ItemAttributeType.SYNTHESISGRADE)
     {
         _Desc = "评分:" + Value;
         if (!string.IsNullOrEmpty(Value))
         {
             string[] strs = Value.Split('/');
             if (strs.Length > 1)
             {
                 int            i    = Convert.ToInt32(strs[1]);
                 SkillBonusInfo info = new SkillBonusInfo();
                 if (DbInfoHelper.Get().SynthesisSkillBonues.TryGetValue(i, out info))
                 {
                     _Desc = "评分:" + info.GetKey() + " " + info.DESC;
                 }
             }
         }
     }
     else if (Type == ItemAttributeType.VALUE)
     {
         _Desc = Type + ":" + Value + " " + Arg + "," + Arg2;
     }
     return(_Desc);
 }
コード例 #10
0
        private void MenuMergeArchorInfo_Click(object sender, RoutedEventArgs e)
        {
            var win = new AreaTreeWindow();

            if (win.ShowDialog() == true)
            {
                var area    = win.SelectedArea;
                var archors = DbInfoHelper.GetArchors().FindAll(i => i.ParentId == area.Id);
                var devs    = DbInfoHelper.GetDevInfos().FindAll(i => i.ParentId == area.Id);
                foreach (var item in archors)
                {
                    item.DevInfo = devs.Find(i => i.Id == item.DevInfoId);
                }
                var archorSettings = DbInfoHelper.GetArchorSettings().FindAll(i => i.FloorName == area.Name);
                foreach (var item in archorSettings)
                {
                    item.Archor = archors.Find(i => i.Id == item.ArchorId);
                }

                Bll bll             = new Bll();
                var archors2        = bll.Archors.FindAll(i => i.ParentId == area.Id);
                var devs2           = bll.DevInfos.FindAll(i => i.ParentId == area.Id);
                var archorSettings2 = bll.ArchorSettings.FindAll(i => i.FloorName == area.Name);

                bll.Archors.RemoveList(archors2);
                bll.DevInfos.RemoveList(devs2);
                bll.ArchorSettings.RemoveList(archorSettings2);

                bll.DevInfos.AddRange(devs);
                foreach (var item in archors)
                {
                    item.DevInfoId = item.DevInfo.Id;
                }
                bll.Archors.AddRange(archors);

                foreach (var item in archorSettings)
                {
                    if (item.Archor != null)
                    {
                        item.ArchorId = item.Archor.Id;
                    }
                }
                bll.ArchorSettings.AddRange(archorSettings);
            }
        }
コード例 #11
0
 /// <summary>
 ///     提交当前单元操作的结果
 /// </summary>
 /// <returns></returns>
 public int Commit()
 {
     if (IsCommitted)
     {
         return(0);
     }
     try
     {
         int result = Context.SaveChanges();
         IsCommitted = true;
         return(result);
     }
     catch (DbUpdateException e)
     {
         if (e.InnerException != null && e.InnerException.InnerException is SqlException)
         {
             SqlException sqlEx = e.InnerException.InnerException as SqlException;
             string       msg   = DbInfoHelper.GetSqlExceptionMessage(sqlEx.Number);
             throw PublicHelper.ThrowDataAccessException("提交数据更新时发生异常:" + msg, sqlEx);
         }
         throw;
     }
 }
コード例 #12
0
        /// <summary>
        /// 新增数据库中没有增加的设备模型
        /// </summary>
        /// <param name="resultAction"></param>
        public void AddDevModelTypeByExcel(Action <int, int> resultAction = null)
        {
            int             modelCount   = 0;
            int             typeCount    = 0;
            var             list         = DbInfoHelper.GetDevModels();
            var             devModelList = DevModels.ToList();
            List <DevModel> newModels    = new List <DevModel>();

            foreach (var item in list)
            {
                if (string.IsNullOrEmpty(item.Name))
                {
                    continue;
                }
                if (devModelList == null)
                {
                    newModels.Add(item);
                }
                else
                {
                    DevModel model = devModelList.Find(i => i.Name == item.Name);
                    if (model == null)
                    {
                        newModels.Add(item);
                    }
                }
            }
            if (newModels.Count != 0)
            {
                modelCount = newModels.Count;
                DevModels.AddRange(newModels);
            }

            var            list2       = DbInfoHelper.GetDevTypes();
            var            devTypeList = DevTypes.ToList();
            List <DevType> newTypes    = new List <DevType>();

            foreach (var item in list2)
            {
                if (string.IsNullOrEmpty(item.TypeName))
                {
                    continue;
                }
                if (devTypeList == null)
                {
                    newTypes.Add(item);
                }
                else
                {
                    DevType model = devTypeList.Find(i => i.TypeName == item.TypeName);
                    if (model == null)
                    {
                        newTypes.Add(item);
                    }
                }
            }
            if (newTypes.Count != 0)
            {
                typeCount = newTypes.Count;
                DevTypes.AddRange(newTypes);
            }
            ClearModelTypeNullData(devModelList, DevModels, devTypeList, DevTypes);
            if (resultAction != null)
            {
                resultAction(modelCount, typeCount);
            }
        }
コード例 #13
0
        public static void LoadArchorList(string tag)
        {
            try
            {
                DateTime start = DateTime.Now;
                Log.Info(tag, "LoadArchorList Start");

                var    Path  = AppDomain.CurrentDomain.BaseDirectory + "\\Data\\DbInfos\\";
                string file1 = Path + "DevInfo.xls";
                string file2 = Path + "Archor.xls";
                string file3 = Path + "ArchorSetting.xls";

                Bll bll = Bll.NewBllNoRelation();
                Log.Info(tag, "archors_ms");
                var archors_ms = DbInfoHelper.GetArchors(); //老的SQLServer
                Log.Info(tag, "archors_my");
                var archors_my = bll.Archors.ToList();      //现在的mysql中的基站
                Log.Info(tag, "archors2Dict_my");
                var archors2Dict_my = bll.Archors.ToDictionary();
                Log.Info(tag, "archorSettings_my");
                var archorSettings_my = DbInfoHelper.GetArchorSettings();
                Log.Info(tag, "archors_list");

                var archors_list = ArchorHelper.LoadArchoDevInfo().ArchorList;//清单文件
                Log.Info(tag, "archors_engine");
                var archors_engine0 = bll.bus_anchors.ToList();
                var archors_engine1 = archors_engine0.FindAll(i => i.enabled != 1); //引擎数据
                var archors_engine  = archors_engine0.FindAll(i => i.enabled == 1); //引擎数据
                Log.Info(tag, "archorConfig_engine");
                var archorConfig_engine = bll.bus_anchor_config.ToList().FindAll(i => i.net_gate != null);
                Log.Info(tag, "devs_ms_all");

                var devs_ms_all = DbInfoHelper.GetDevInfos();
                Log.Info(tag, "devs_ms");
                var devs_ms = devs_ms_all.FindAll(i => i.Local_TypeCode == 20180821);

                Log.Info(tag, "devs_my");
                var devs_my = bll.DevInfos.FindAll(i => i.Local_TypeCode == 20180821);
                Log.Info(tag, "archorSettings2");
                var archorSettings2 = bll.ArchorSettings.ToList();

                Log.Info(tag, "areas_ms");
                var areas_ms = DbInfoHelper.GetAreas().ToDictionary(i => i.Id);
                Log.Info(tag, "InitArea(areas_ms)");
                InitArea(areas_ms, tag);

                Log.Info(tag, "areas_my");
                var areas_my_list = bll.Areas.ToList();
                var areas_my      = areas_my_list.ToDictionary(i => i.Id);
                Log.Info(tag, "InitArea(areas_my)");
                InitArea(areas_my, tag);

                foreach (var item in archors_my)
                {
                    item.DevInfo = devs_my.Find(i => i.Id == item.DevInfoId);
                }

                foreach (var item in archors_ms)
                {
                    item.DevInfo = devs_ms.Find(i => i.Id == item.DevInfoId);
                }

                bll.Archors.RemoveList(archors_my);
                bll.DevInfos.RemoveList(devs_my);
                bll.ArchorSettings.RemoveList(archorSettings2);

                //foreach (var item in archors_ms)
                for (int j = 0; j < archors_ms.Count; j++)
                {
                    var item = archors_ms[j];
                    //Log.Info(tag, string.Format("SetParent : {0}/{1}", j, archors_ms.Count));

                    var dev = item.DevInfo;
                    if (dev != null)
                    {
                        item.DevInfoId = dev.Id;

                        if (dev.ParentId != null)
                        {
                            var pid = (int)dev.ParentId;

                            var p1 = areas_ms[pid];
                            var p2 = areas_my_list.Find(i => i.Path == p1.Path);
                            if (p2 != null)
                            {
                                dev.ParentId  = p2.Id;
                                item.ParentId = p2.Id;
                            }
                        }
                    }
                }

                bll.DevInfos.AddRange(devs_ms);

                foreach (var item in archors_ms)
                {
                    item.DevInfoId = item.DevInfo.Id;
                }
                bll.Archors.AddRange(archors_ms);
                archors_my = archors_ms;

                foreach (var item in archorSettings_my)
                {
                    if (item.Archor != null)
                    {
                        item.ArchorId = item.Archor.Id;
                    }
                }
                bll.ArchorSettings.AddRange(archorSettings_my);

                //{
                //    List<Archor> temp11 = new List<Archor>();
                //    List<Archor> temp12 = new List<Archor>();
                //    foreach (var item in archors_my)
                //    {
                //        var old = archors_ms.Find(i => i.Code == item.Code);
                //        if (old != null)
                //        {
                //            temp11.Add(item);
                //            archors_ms.Remove(old);
                //        }
                //        else
                //        {
                //            temp12.Add(item);
                //        }
                //    }
                //}

                //{
                //    List<Archor> temp11 = new List<Archor>();
                //    List<Archor> temp12 = new List<Archor>();
                //    foreach (var item in archors_my)
                //    {
                //        var old = archors_list.Find(i => i.ArchorID == item.Code);
                //        if (old != null)
                //        {
                //            temp11.Add(item);
                //            archors_list.Remove(old);
                //        }
                //        else
                //        {
                //            temp12.Add(item);
                //        }
                //    }
                //}

                {
                    List <Archor> temp11 = new List <Archor>();
                    List <Archor> temp12 = new List <Archor>();
                    foreach (var item in archors_my)
                    {
                        var old = archorConfig_engine.Find(i => i.anchor_id == item.Code);
                        if (old != null)
                        {
                            temp11.Add(item);
                            archorConfig_engine.Remove(old);
                        }
                        else
                        {
                            temp12.Add(item);
                        }
                    }

                    List <DevInfo> devs = new List <DevInfo>();
                    foreach (var item in temp12)
                    {
                        devs.Add(item.DevInfo);
                    }

                    bll.Archors.RemoveList(temp12);
                    bll.DevInfos.RemoveList(devs);
                }

                var time = DateTime.Now - start;
                Log.Info(tag, "LoadArchorList End:" + time);
            }
            catch (Exception ex)
            {
                Log.Error(tag, ex.ToString());
            }
        }