Exemple #1
0
        private void Get_Push_Notify_Tick(object sender, EventArgs e)
        {
            string sql_Exect = string.Format("Exec sp_Get_Notify @UserName='******'", Form_Main.user.Username);

            try
            {
                //string sLink = Form_Main.URL_API + "/api/IPC247/sp_extension_GetDataByQueryString?str_Query=" + sql_Exect;
                //var json = API.API_GET_Rep(sLink);

                //var jsondata = JObject.Parse(json).GetValue("Data");
                //DataTable dt = (DataTable)JsonConvert.DeserializeObject(jsondata.ToString(), (typeof(DataTable)));
                DataSet ds = SQLHelper.ExecuteDataSetByQuery(sql_Exect);
                if (ds != null && ds.Tables.Count == 2)
                {
                    DataTable dt = ds.Tables[0];
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            string Caption = dt.Rows[i]["Caption"].ToString();
                            string Body    = dt.Rows[i]["Body"].ToString();
                            int    AutoFormDelay;
                            int.TryParse(dt.Rows[i]["AutoFormDelay"].ToString(), out AutoFormDelay);
                            alertControl1.AutoFormDelay = AutoFormDelay;
                            ///AppData/Image/switchtimescalesto_32x32.png"
                            alertControl1.Show(this, Caption, Body, "", Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/AppData/Image/switchtimescalesto_32x32.png"), null);
                        }
                    }
                    #region Kiểm tra version sử dụng
                    dt = ds.Tables[1];
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string _version = System.Windows.Forms.Application.ProductVersion;
                        if (_version == dt.Rows[0][0].ToString())
                        {
                            Time_Close = -1;
                        }
                        else
                        {
                            //
                            if (Time_Close == 0)
                            {
                                Application.Exit();
                            }
                            else
                            {
                                XtraMessageBox.Show("Đã có version mới!, Vui lòng khởi động lại phần mềm. HOẶC PHẦN MỀM TỰ KHỞI ĐỘNG LẠI SAU 5 PHÚT", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                Time_Close = 0;
                            }
                        }
                    }
                    #endregion Kiểm tra version sử dụng
                }
                else
                {
                    API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_Main", "Get_Push_Notify_Tick()", sql_Exect + "\r\n" + "Không có kết quả trả về"));
                }
            }
            catch (Exception ex)
            {
                API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Form_Main", "Get_Push_Notify_Tick()", sql_Exect + "\r\n" + ex.ToString()));
            }
        }