/// <summary>
        /// 执行存储过程,返回DataTable
        /// </summary>
        /// <param name="OracleCmd"></param>
        /// <returns></returns>
        public static DataTable ExecuteDataTable(OracleCommand OracleCmd)
        {
            DataTable         objTable      = new DataTable();
            OracleConnection  objConnection = new OracleConnection(strConnectionStatic);
            OracleDataAdapter objAdapter    = new OracleDataAdapter();

            try
            {
                if (objConnection.State != ConnectionState.Open)
                {
                    objConnection.Open();
                }
                OracleCmd.Connection     = objConnection;
                objAdapter.SelectCommand = OracleCmd;
                objAdapter.Fill(objTable);
            }
            catch (Exception ex)
            {
                Tips.AppendLine(ex.Message);
            }
            finally
            {
                objConnection.Close();
                objAdapter.Dispose();
                OracleCmd.Dispose();
                objConnection.Close();
                objConnection.Dispose();
            }
            return(objTable);
        }
Exemplo n.º 2
0
        public DependencyArrow(UMLElement firstBlock, UMLElement secondBlock, Tips type)
        {
            if (!(firstBlock is UMLClassBox) || !(secondBlock is UMLClassBox))
            {
                throw  new Exception("Один из элементов пустой");
            }
            fb    = firstBlock as UMLClassBox;
            sb    = secondBlock as UMLClassBox;
            fguid = fb.getGuid();
            sguid = sb.getGuid();
            mode  = type;
            t     = generateTip(type);
            switch (type)
            {
            case Tips.AssotiationArrow:
            case Tips.DerivArrow:
            case Tips.AggregationArrow:
            case Tips.CompositionArrow:
                r = new BetweenLine(getPointForFirstBLock(), t.GetEndPointForLine(), BetweenLine.Type.Solid);
                break;

            case Tips.DependenceArrow:
            case Tips.ImplementationArrow:
                r = new BetweenLine(getPointForFirstBLock(), t.GetEndPointForLine(), BetweenLine.Type.Dotted);
                break;
            }
            updateEvents();
            fieldsSync();
            fb.addObserver(this);
            sb.addObserver(this);
        }
        /// <summary>
        /// 执行存储过程,返回影响行数
        /// </summary>
        /// <param name="OracleCmd"></param>
        /// <returns></returns>
        public static int ExecuteNonQuery(OracleCommand OracleCmd)
        {
            int intReturn = -1;

            using (OracleConnection objConnection = new OracleConnection(strConnectionStatic))
            {
                try
                {
                    if (objConnection.State != ConnectionState.Open)
                    {
                        objConnection.Open();
                    }
                    OracleCmd.Connection = objConnection;
                    intReturn            = OracleCmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Tips.AppendLine(ex.Message);
                }
                finally
                {
                    objConnection.Close();
                    OracleCmd.Dispose();
                    objConnection.Dispose();
                }
                return(intReturn);
            }
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UrlImg,Title,Resume,Content,Autor,References,ReleaseDate")] Tips tips)
        {
            if (id != tips.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tips);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipsExists(tips.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tips));
        }
Exemplo n.º 5
0
    public void OnConfirmClick()
    {
        string name = inputField.value;

        if (string.IsNullOrEmpty(name))
        {
            Tips.Make(LanguageDataProvider.GetValue(10));

            return;
        }
        //判断是否有敏感字符
        bool nameIllegal = false;

        nameIllegal = NameFilterConfigProvider.Instance.nameCheck(name);
        if (nameIllegal)
        {
            Tips.Make(LanguageDataProvider.GetValue(1114));
            return;
        }
        // GuideManager.TriggerGuideEnd(GuildEndEvent.rename);
        NetSystem.Instance.helper.ChangeName(name);

        // 本地存储玩家名称
        LocalPlayer.Get().playerData.name = inputField.value;
        LocalAccountStorage.Get().name = inputField.value;
        LocalStorageSystem.Instance.SaveLocalAccount();

        // 进入PVP界面
        UISystem.Get().HideWindow("SingleClearWindow");
        EventSystem.Instance.FireEvent(EventId.UpdateChaptersWindow);
    }
        /// <summary>
        /// 调取文件
        /// </summary>
        /// <param name="FileID">文件ID</param>
        /// <returns>文件文件流</returns>
        public byte[] LoadFile(string FileID)
        {
            byte[] objResult = null;
            string strSQL    = "select FILE_BODY from T_RPT_FILE where id='{0}'";

            strSQL = String.Format(strSQL, FileID);

            objConnection = new SqlConnection(strConnection);
            objCommand    = new SqlCommand(strSQL, objConnection);

            try
            {
                objConnection.Open();
                objReader = objCommand.ExecuteReader();

                if (objReader.Read())
                {
                    objResult = objReader.GetSqlBinary(0).Value;
                }
            }
            catch (Exception ex)
            {
                Tips.Append(ex.Message);
            }
            finally
            {
                objConnection.Close();
                objConnection.Dispose();
                objCommand.Dispose();
                objReader.Dispose();
            }

            return(objResult);
        }
Exemplo n.º 7
0
        // 托盘图标鼠标单击事件
        private void notifyIcon_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //鼠标左键
            if (e.Button == MouseButtons.Left)
            {
                //获得焦点
                this.Focus();

                if ((int)md.TimerMode == 2)
                {
                    Count = 0;
                    if (Tips.Function == false)
                    {
                        Tips tp = new Tips("加班模式下点击托盘会进行重新计时,您当前的工作时间已被重置~");
                        tp.Show();
                    }
                    return;
                }



                if (Tips.Function == false)
                {
                    Tips tp = new Tips("您已经工作了" + (Count / 60) + "分钟," + (md.Work - (Count / 60)) + "分后进入休息时间");
                    tp.Show();
                }
            }
        }
Exemplo n.º 8
0
        public static async Task <Tip> GetSingleTipAsync()
        {
            if (TipsDataModel.tipsCache.Count == 0)
            {
                // FIXME: allow choosing the correct language and language level
                Tips tipsEndpoint = new Tips(App.OAuth2Account, SupportedLanguage.English, LanguageLevelClassification.B1);
                TipsDataModel.tipsCache = await Task.Run(async() => await tipsEndpoint.CallEndpointAsObjectAsync());
            }

            int choosen = new Random().Next(TipsDataModel.tipsCache.Count - 1);

            if (TipsDataModel.tipsCache.Count == 0)
            {
                Tools.Logger.Log("TipsController", "Empty list, something went wrong.");
                return(new Tip()
                {
                    Id = -1,
                    Text = "An error occurred. Please report this message to the dev team.",
                });
            }
            else
            {
                return(TipsDataModel.tipsCache[choosen]);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCount(Tips model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Tips>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.Title.IsNullOrEmpty())
                {
                    query.Where(p => p.Title == model.Title);
                }
                if (!model.Content.IsNullOrEmpty())
                {
                    query.Where(p => p.Content == model.Content);
                }
                if (!model.CreateTime.IsNullOrEmpty())
                {
                    query.Where(p => p.CreateTime == model.CreateTime);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
Exemplo n.º 10
0
    public void AddGetRecordStatusEvent(System.Action <bool> actionCallback = null)
    {
        C_DebugHelper.LogErrorFormat("SpeechRecognizeSystemEvent AddGetRecordStatusEvent  start ");

        _ActionCallback = actionCallback;
        if (_GetRecordStatusEvent != null)
        {
            _GetRecordStatusEvent.UnregisterEvent();
        }
        _GetRecordStatusEvent = null;
        _GetRecordStatusEvent = new C_Event();
        _GetRecordStatusEvent.RegisterEvent(C_EnumEventChannel.Global, "ResponseRecordStatus", (status) => {
            _GetRecordStatusEvent.UnregisterEvent();
            if (status != null)
            {
                C_DebugHelper.LogErrorFormat("ResponseRecordStatus is :" + status);
                string answer = "1";
                if (answer.Equals(status[0]))
                {
                    if (_ActionCallback != null)
                    {
                        _ActionCallback(true);
                    }
                }
                else
                {
                    Tips.Create("开启语音权限后,才可以继续使用噢!");
                    if (_ActionCallback != null)
                    {
                        _ActionCallback(false);
                    }
                }
            }
        });
    }
 public void Update(DestinyMilestoneContent?other)
 {
     if (other is null)
     {
         return;
     }
     if (About != other.About)
     {
         About = other.About;
         OnPropertyChanged(nameof(About));
     }
     if (Status != other.Status)
     {
         Status = other.Status;
         OnPropertyChanged(nameof(Status));
     }
     if (!Tips.DeepEqualsListNaive(other.Tips))
     {
         Tips = other.Tips;
         OnPropertyChanged(nameof(Tips));
     }
     if (!ItemCategories.DeepEqualsList(other.ItemCategories))
     {
         ItemCategories = other.ItemCategories;
         OnPropertyChanged(nameof(ItemCategories));
     }
 }
Exemplo n.º 12
0
    public void Init()
    {
        smsCode       = GameObject.Find("Canvas/Group3/SmsCode").GetComponent <InputField>();
        noPasswordPay = GameObject.Find("Canvas/Group3/NoPasswordPay").GetComponent <Toggle>();

        tips = new Tips();
    }
Exemplo n.º 13
0
 private void FrmMainConsole_Load(object sender, EventArgs e)
 {
     try
     {
         //验证登陆者身份
         //如果不符要求,要重新登录
         string Message = ""; bool HasError = true;
         bv.ValidateCard(SystemMsg, ref Message, ref HasError);
         if (HasError)
         {
             MessageBox.Show(Message, "安全提醒", MessageBoxButtons.OK, MessageBoxIcon.Error);
             this.Hide();
             FrmLogin login = new FrmLogin();
             login.ShowDialog();
         }
         Lb_Msg.Text = string.Format("尊敬的‘{0}’会员,欢迎登入!", SystemMsg.AdminNickName);
         //查询员工列表,把下属员工全部陈列统计
         DataTable result = bEmployee.GetEmployeeGroup(SystemMsg.AdminGuid);
         DGVEmployeeList.DataSource = result;
         TbEmployeeCountNum.Text    = result.Rows.Count.ToString();
     }
     catch (Exception ex)
     {
         Tips.TipsInfoBox(ex.Message);
     }
 }
Exemplo n.º 14
0
        public bool Equals(DestinyMilestoneContent input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     About == input.About ||
                     (About != null && About.Equals(input.About))
                     ) &&
                 (
                     Status == input.Status ||
                     (Status != null && Status.Equals(input.Status))
                 ) &&
                 (
                     Tips == input.Tips ||
                     (Tips != null && Tips.SequenceEqual(input.Tips))
                 ) &&
                 (
                     ItemCategories == input.ItemCategories ||
                     (ItemCategories != null && ItemCategories.SequenceEqual(input.ItemCategories))
                 ));
        }
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回Scalar值;
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strCommandType">命令类型</param>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>Object</returns>
        public static object ExecuteScalar(CommandType strCommandType, string strCommandText)
        {
            OracleCommand objCommand = new OracleCommand();
            object        intReturn  = null;

            using (OracleConnection objConnection = new OracleConnection(strConnectionStatic))
            {
                PrepareCommand(objCommand, objConnection, null, strCommandType, strCommandText);

                try
                {
                    intReturn = objCommand.ExecuteScalar();
                }
                catch (Exception ex)
                {
                    Tips.AppendLine(ex.Message);
                }
                finally
                {
                    objCommand.Dispose();
                    objConnection.Close();
                    objConnection.Dispose();
                }

                return(intReturn);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 根据模型删除数据
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public bool DeleteModel(Tips model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var delete = new LambdaDelete <Tips>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    delete.Where(p => p.Id == model.Id);
                }
                if (!model.Title.IsNullOrEmpty())
                {
                    delete.Where(p => p.Title == model.Title);
                }
                if (!model.Content.IsNullOrEmpty())
                {
                    delete.Where(p => p.Content == model.Content);
                }
                if (!model.CreateTime.IsNullOrEmpty())
                {
                    delete.Where(p => p.CreateTime == model.CreateTime);
                }
            }
            return(delete.GetDeleteResult(connection, transaction));
        }
Exemplo n.º 17
0
        public async Task TipCreateMod(CommandContext ctx, DiscordUser dis)
        {
            var      username   = ctx.Member.Username;
            var      eyes       = DiscordEmoji.FromName(ctx.Client, ":eyes:");
            var      oldmessage = ctx.Message;
            TipModel profile    = new TipModel();
            var      comms      = new Communication();
            await ctx.Message.CreateReactionAsync(eyes).ConfigureAwait(false);

            //get user's profile and check if they are an admin, if not don't acknowledge the command exists.
            //if (ctx.Guild.Id == 539405872346955788
            if (ctx.Guild.Id == 826783795842777098 && profile.Role == "Admin")
            {
                string mentionedUserId = dis.Mention;
                mentionedUserId = mentionedUserId.Substring(2, mentionedUserId.Length - 3);
                ulong uLMentionedUserId = ulong.Parse(mentionedUserId);
                Console.WriteLine(uLMentionedUserId);
                //Call AdminProfileFunction to Check/Create/Assign Mod User.
                await Tips.AdminProfileCheck(uLMentionedUserId, "Mod");

                await ctx.Channel.SendMessageAsync("UserID: " + uLMentionedUserId + " is now a Mod.").ConfigureAwait(false);
            }
            else
            {
            }
        }
        /// <summary>
        /// 执行存储过程,返回执行结果,无需connection
        /// </summary>
        /// <param name="OracleCmd">执行命令</param>
        /// <returns></returns>
        public static bool ExecuteProcedure(OracleCommand OracleCmd)
        {
            OracleConnection objConnection = new OracleConnection(strConnectionStatic);

            try
            {
                if (objConnection.State != ConnectionState.Open)
                {
                    objConnection.Open();
                }
                OracleCmd.Connection = objConnection;
                OracleCmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Tips.AppendLine(ex.Message);
                return(false);
            }
            finally
            {
                objConnection.Close();
                OracleCmd.Dispose();
                objConnection.Dispose();
            }
            return(true);
        }
Exemplo n.º 19
0
        public async Task AdminBalance(CommandContext ctx)
        {
            //Locks command to Planetarium Server and Server Owner.
            //if (ctx.Guild.Id == 539405872346955788 && ctx.Member.IsOwner)
            if (ctx.Guild.Id == 826783795842777098) //Test Server
            {
                var      username   = ctx.Member.Username;
                var      oldmessage = ctx.Message;
                TipModel profile    = new TipModel();
                var      comms      = new Communication();

                Console.WriteLine("Balance Called");
                //get user's profile and check if they are an admin, if not don't acknowledge the command exists.
                profile = await Tips.ProfileExistsNew(ctx.Member.Id);

                if (profile.Role == "Admin")
                {
                    var eyes = DiscordEmoji.FromName(ctx.Client, ":eyes:");
                    await ctx.Message.CreateReactionAsync(eyes).ConfigureAwait(false);

                    var value = Tips.AdminBalanceCheck();
                    await comms.AdminBalance(ctx, oldmessage, username, value.Result);
                }
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回影响行数
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strCommandType">命令类型</param>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>影响行数</returns>
        public static int ExecuteNonQuery(CommandType strCommandType, string strCommandText)
        {
            SqlCommand objCommand = new SqlCommand();
            int        intReturn  = -1;

            using (SqlConnection objConnection = new SqlConnection(strConnectionStatic))
            {
                PrepareCommand(objCommand, objConnection, null, strCommandType, strCommandText);

                try
                {
                    intReturn = objCommand.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Tips.AppendLine(ex.Message);
                }
                finally
                {
                    objCommand.Dispose();
                    objConnection.Close();
                    objConnection.Dispose();
                }

                return(intReturn);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回Scalar值;
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>Object</returns>
        public static object ExecuteScalar(string strCommandText)
        {
            //解决SQL的COUNT语句无法进行ORDER BY的问题
            if (strCommandText.Contains("count(*)") && strCommandText.Contains("order by"))
            {
                strCommandText = strCommandText.Substring(0, strCommandText.IndexOf("order by"));
            }

            SqlCommand objCommand = new SqlCommand();
            object     intReturn  = null;

            using (SqlConnection objConnection = new SqlConnection(strConnectionStatic))
            {
                PrepareCommand(objCommand, objConnection, null, CommandType.Text, strCommandText);

                try
                {
                    intReturn = objCommand.ExecuteScalar();
                }
                catch (Exception ex)
                {
                    Tips.AppendLine(ex.Message);
                }
                finally
                {
                    objCommand.Dispose();
                    objConnection.Close();
                    objConnection.Dispose();
                }

                return(intReturn);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句列表或者存储过程,返回执行结果
        /// 创建人: 石磊
        /// 创建日期:2008-01-04
        /// </summary>
        /// <param name="strCommandText">命令文本列表</param>
        /// <returns>返回执行结果</returns>
        public static bool ExecuteSQLTextList(string[] strCommandTextList)
        {
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.Text;
            SqlConnection objConnection = new SqlConnection(strConnectionStatic);

            if (objConnection.State != ConnectionState.Open)
            {
                objConnection.Open();
            }
            SqlTransaction objTransaction = objConnection.BeginTransaction();

            try
            {
                ExecuteListCommand(objCommand, objConnection, objTransaction, CommandType.Text, strCommandTextList);
                objTransaction.Commit();
            }
            catch (Exception ex)
            {
                objTransaction.Rollback();
                Tips.AppendLine(ex.Message);
                return(false);
            }
            finally
            {
                objCommand.Dispose();
                objConnection.Close();
                objConnection.Dispose();
            }
            return(true);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回DatatSet
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strConnection">连接字符串</param>
        /// <param name="strCommandType">命令类型</param>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>DataSet</returns>
        public static DataSet ExecuteDataSet(string strConnection, CommandType strCommandType, string strCommandText)
        {
            SqlCommand objCommand = new SqlCommand(strCommandText);

            objCommand.CommandType = strCommandType;
            SqlConnection  objConnection = new SqlConnection(strConnection);
            SqlDataAdapter objAdapter    = new SqlDataAdapter(objCommand);
            DataSet        objDataSet    = new DataSet();

            try
            {
                PrepareCommand(objCommand, objConnection, null, strCommandType, strCommandText);

                objAdapter.Fill(objDataSet);
            }
            catch (Exception ex)
            {
                Tips.AppendLine(ex.Message);
            }
            finally
            {
                objAdapter.Dispose();
                objCommand.Dispose();
                objConnection.Close();
                objConnection.Dispose();
            }

            return(objDataSet);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回DataTable
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>DataTable</returns>
        public static DataTable ExecuteDataTable(string strCommandText)
        {
            SqlCommand objCommand = new SqlCommand(strCommandText);

            objCommand.CommandType = CommandType.Text;
            SqlConnection  objConnection = new SqlConnection(strConnectionStatic);
            SqlDataAdapter objAdapter    = new SqlDataAdapter(objCommand);
            DataTable      objTable      = new DataTable();

            try
            {
                PrepareCommand(objCommand, objConnection, null, CommandType.Text, strCommandText);

                objAdapter.Fill(objTable);
            }
            catch (Exception ex)
            {
                Tips.AppendLine(ex.Message);
            }
            finally
            {
                objAdapter.Dispose();
                objCommand.Dispose();
                objConnection.Close();
                objConnection.Dispose();
            }

            return(objTable);
        }
Exemplo n.º 25
0
 internal void SpawnText(Vector3 iniPosPass, string msgP = "")
 {
     //spwan a message
     if (msgP != "")
     {
         textMessage               = (Btn3D)General.Create(Root.menusTextMiddle, iniPosPass);
         textMessage.MoveSpeed     = 40f; //so fade happens
         textMessage.FadeDirection = "FadeIn";
         textMessage.GetComponent <GUIText>().text = msgP;
     }
     //spwans a tip
     else if (Program.MOUSEOVERTHIS != null)
     {
         if (Tips.ReturnTip(Program.MOUSEOVERTHIS.name) != "No tips")
         {
             if (tipHover)
             {
                 tipMenu               = (Btn3D)General.Create(Root.menusTextLeft, iniPosPass);
                 tipMenu.MoveSpeed     = 40f; //so fade happens
                 tipMenu.FadeDirection = "FadeIn";
                 tipMenu.GetComponent <GUIText>().text = Tips.ReturnTip(Program.MOUSEOVERTHIS.name);
                 tipHover = false;
             }
             else if (tipMenu.GetComponent <GUIText>().text != Tips.ReturnTip(Program.MOUSEOVERTHIS.name))
             {
                 tipMenu.GetComponent <GUIText>().text = Tips.ReturnTip(Program.MOUSEOVERTHIS.name);
                 tipMenu.transform.position            = iniPosPass;
             }
         }
         else if (Tips.ReturnTip(Program.MOUSEOVERTHIS.name) == "No tips")
         {
             DestroyTipMenu();
         }
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// 功能描述:执行无参数SQL语句或者存储过程,返回DataReader
        /// 创建人: 陈国迎
        /// 创建日期:2006-5-15
        /// </summary>
        /// <param name="strCommandText">命令文本</param>
        /// <returns>DataReader</returns>
        public static SqlDataReader ExecuteReader(string strCommandText)
        {
            SqlCommand    objCommand    = new SqlCommand();
            SqlConnection objConnection = new SqlConnection(strConnectionStatic);
            SqlDataReader objDataReader = null;

            try
            {
                PrepareCommand(objCommand, objConnection, null, CommandType.Text, strCommandText);
                objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception ex)
            {
                Tips.AppendLine(ex.Message);
            }
            finally
            {
                objDataReader.Dispose();
                objCommand.Dispose();
                objConnection.Close();
                objConnection.Dispose();
            }

            return(objDataReader);
        }
Exemplo n.º 27
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Debug.Log(Tips.GetRandomTip());
     }
 }
Exemplo n.º 28
0
        /// <summary>
        /// 更新全部书籍
        /// </summary>
        public static void BooksUpdate(object ob)
        {
            //获取全部书籍
            DataTable   dt    = SQLiteDBHelper.ExecuteDataTable("select *from Books", null);
            List <Book> Books = ModelConvertHelper <Book> .DataTableToList(dt);

            foreach (Book book in Books)
            {
                //获取初始搜索文本
                string html = GetHtml.GetHttpWebRequest(book.Url);

                BookSource bs = GetBookSource(book.Source);

                //检测书源有效性
                if (bs.Title is null)
                {
                    Tips tips = new Tips(book.Name + "的书源不存在,请检查书源是否已经被删除掉?");
                    tips.Show();
                    return;
                }
                //获取最新章节
                string LatestChapters = Tool.GetRegexStr(html, bs.NewestRegular).Trim();

                //获取更新时间
                string Update = Tool.GetRegexStr(html, bs.UpdateRegular).Trim();

                SQLiteDBHelper.ExecuteNonQuery("Update Books set 'Newest' = '" + LatestChapters + "', 'Update' = '" + Tool.GetUpdataDate(Update) + "' where Id =" + book.Id, null);
            }
            ((MainWindow)ob).Dispatcher.Invoke(new Action(() =>
            {
                ((MainWindow)ob).DataContext = DataFetch.GetBooks();
            }));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Refreshes the list of available tips.
        /// </summary>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation. </returns>
        private async Task RefreshTipsAsync()
        {
            try
            {
                // TODO: allow selecting the language and level classification
                Tips tipsEndpoint = new Tips(App.OAuth2Account, SupportedLanguage.English, LanguageLevelClassification.B1);
                this._tipsTask = Task.Run(async() => await tipsEndpoint.CallEndpointAsObjectAsync());
                await this._tipsTask;
            }
            catch
            {
            }

            this.OnPropertyChanged("IsNotCompleted");

            if (this._tipsTask.IsFaulted)
            {
                this.OnPropertyChanged("IsFaulted");
                this.OnPropertyChanged("ErrorMessage");
            }

            if (this._tipsTask.IsCanceled || this._tipsTask.IsFaulted)
            {
                this.ApplicationTips = new ReadOnlyObservableCollection <Tip>(new ObservableCollection <Tip>(new List <Tip>()));
            }
            else
            {
                this.ApplicationTips = new ReadOnlyObservableCollection <Tip>(new ObservableCollection <Tip>(this._tipsTask.Result));
                this.OnPropertyChanged("IsSuccessfullyCompleted");
            }

            this.OnPropertyChanged("SingleRandomTip");
        }
Exemplo n.º 30
0
    //错误提示Func
    private void ErrorNotify(int statues, object dataValue = null)
    {
        switch (statues)
        {
        case 1:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + "error result = 1");
            break;

        case 2:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + "error result = 2");
            break;

        case 3:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + "error result = 3");
            break;

        case 4:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + "error result = 4");
            break;

        case 5:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + "error result = 5");
            break;

        default:
            LogManager.Log("", LogManager.LogColor.Red);
            Tips.ShowMessage(this.GetType() + " Error result = " + statues);
            break;
        }
    }
Exemplo n.º 31
0
 void Start()
 {
     myRegion = GetComponent<Region>();
     background = GetComponent<Image>();
     backgroundColor = background.color;
     tips = GameObject.Find("Canvas").GetComponent<Tips>();
     background.color = Color.white;
 }
Exemplo n.º 32
0
 public void Start()
 {
     jsonString = Resources.Load<TextAsset>("Regions").text;
     regionData = JsonMapper.ToObject(jsonString);
     flavour = regionData[this.gameObject.name][0].ToString();
     nameText = transform.Find("Name").GetComponent<Text>();
     tips = GameObject.Find("Canvas").GetComponent<Tips>();
     nameText.text = this.gameObject.name;
     oppositionGrowth = true;
     demandsMet = new bool[3];
     tick();
     seats = 0;
 }
Exemplo n.º 33
0
 void Start()
 {
     techControl = GetComponent<TechControl>();
     tips = GetComponent<Tips>();
     int screenLength = screens.Length;
     distance = new float[screenLength];
     screenDistance = (int)Mathf.Abs(screens[1].GetComponent<RectTransform>().anchoredPosition.x - screens[0].GetComponent<RectTransform>().anchoredPosition.x);
     thresholdDistance = (screens[1].transform.position.x - screens[0].transform.position.x) * 0.9f;
     Vector2 newPosition = new Vector2 (-1534, panel.anchoredPosition.y);
     frameStart = frame.anchoredPosition;
     panel.anchoredPosition = newPosition;
     PausePanel.SetActive(false);
     minScreenNum = 1;
     MovingToMap = false;
 }
Exemplo n.º 34
0
        public Tips GetRandomTips()
        {
           

            Random r = new Random();
            int randomIndex = 0;

            randomIndex = r.Next(1, dbcontext.Tips.Count());

            Tips tips =  dbcontext.Tips.Where(t => t.IID == randomIndex).FirstOrDefault();
            string tp = tips.Text;
            Tips tipNew = new Tips();
            tipNew.Text = @tp.Replace("\\r\\n", Environment.NewLine);
            return tipNew;
        }