public ListPage()
 {
     InitializeComponent();
     books         = new List <Book>();
     sQLiteManager = new SQLiteManager();
     RefreshData();
 }
Beispiel #2
0
 /// <summary>
 /// Init a database. </summary>
 /// <param name="context"> application context. </param>
 /// <param name="dbName"> database (file) name. </param>
 /// <param name="version"> schema version. </param>
 /// <param name="tableName"> table name. </param>
 /// <param name="schema"> specimen value. </param>
 /// <param name="errorListener"> optional error listener. </param>
 public EngagementStorage(Context context, string dbName, int version, string tableName, ContentValues schema, ErrorListener errorListener)
 {
     /* Prepare SQLite manager */
     mContext       = context;
     mManager       = new SQLiteManager(context, dbName, version, tableName, schema);
     mErrorListener = errorListener;
 }
Beispiel #3
0
 private void Guardar_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(PesoText.Text) > 0)
     {
         try
         {
             OracleManager.VerificarIntegridadBaseDeDatos(_MarcasUsuario.ID_Planta);
             _MarcasUsuario.Peso = Convert.ToInt32(PesoText.Text);
             InsertarEnBasesDeDatos(_MarcasUsuario);
             Limpiar_UI();
             MessageBox.Show("Datos Guardados con éxito.Serás redireccionado " +
                             "a la página web.", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
             SQLiteManager.CambiarEstado_App(3);
             _MarcasUsuario.Clear_Session();
         }
         catch (Exception _error)
         {
             EscribirEnLog("Error al Ingresar Datos. Error: " + _error.Message);
             MessageBox.Show("Intermitencia de enlace detectada, pruebe nuevamente.", "Información",
                             MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1,
                             MessageBoxOptions.DefaultDesktopOnly);
         }
     }
     else
     {
         MessageBox.Show("El peso ingresado no puede ser 0.", "Alerta",
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1,
                         MessageBoxOptions.DefaultDesktopOnly);
     }
 }
    /// <summary>
    /// Type=1003 应用被启用<para/>
    /// 处理 酷Q 的插件启动事件回调
    /// </summary>
    /// <param name="sender">事件的触发对象</param>
    /// <param name="e">事件的附加参数</param>
    public void AppEnable(object sender, CQAppEnableEventArgs e)
    {
        // 当应用被启用后,将收到此事件。
        // 如果酷Q载入时应用已被启用,则在_eventStartup(Type=1001,酷Q启动)被调用后,本函数也将被调用一次。
        // 如非必要,不建议在这里加载窗口。(可以添加菜单,让用户手动打开窗口)
        try
        {
            ApiModel.setModel(e.CQApi, e.CQLog);
            SQLiteManager.GetInstance();
            FileOptions.GetInstance();
            GuildBattle.InitFile();

            DirectoryInfo root    = new DirectoryInfo(e.CQApi.AppDirectory);
            FileInfo[]    files   = root.GetFiles();
            string        pattern = @"Data\-(\d+)\.ini";
            foreach (FileInfo info in files)
            {
                if (Regex.IsMatch(info.Name, pattern))
                {
                    Match temp = Regex.Match(info.Name, pattern);
                    GuildBattle.GetInstance(long.Parse(temp.Groups[1].Value));
                }
            }
        } catch (Exception exception)
        {
            e.CQLog.Warning("AppEnable", exception);
        }
    }
Beispiel #5
0
        private void GetInfOfDataBase(out string firstName, out string lastName)
        {
            firstName = string.Empty;
            lastName  = string.Empty;

            string connectionString = SQLiteManager.GetConnectionString(this.PathToDataBase);

            using (SQLiteConnection connection = new SQLiteConnection(connectionString))
            {
                connection.Open();
                using (SQLiteCommand command = new SQLiteCommand(
                           $"SELECT * FROM person WHERE {DbFieldId} = {DbRowId}",
                           connection))
                {
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            firstName = reader[$"{DbFieldFirstName}"].ToString();
                            lastName  = reader[$"{DbFieldLastName}"].ToString();
                        }
                    }
                }

                connection.Close();
            }
        }
Beispiel #6
0
        private void Closing_Event(object sender, FormClosingEventArgs e)
        {
            if (_userSession.Grado == 0 && _userSession.Intento == 1)
            {
                DialogResult result = MessageBox.Show("Esta aplicación es necesaria para los procesos de Toma de " +
                                                      "Grado. ¿Está seguro que realmente desea cerrarla?", "Confirmación",
                                                      MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (result == DialogResult.OK)
                {
                    WindowState = FormWindowState.Minimized;
                    _userSession.Clear_Session();
                    Limpiar_UI();
                    SQLiteManager.CambiarEstado_App(4);

                    //if (PuertoSerial.IsOpen)
                    //    PuertoSerial.Close();
                    //SQLiteManager.CambiarEstado_App(4);
                }
                else
                {
                    e.Cancel = true;
                }
            }
            else
            {
                MessageBox.Show("NO PUEDES CANCELAR LUEGO DE HABER LEIDO EL GRADO.", "ALERTA",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                e.Cancel = true;
            }
        }
Beispiel #7
0
    public string GetHelpTroopNum()
    {
        List <SQLiteManager.HelpTroopData> helpTroopData = SQLiteManager.GetInstance().GetHelpTroopNum(group, 10);
        string output = "【代刀数统计(含补刀)】";

        int  totalTroop = 0, totalReimburseTroop = 0;
        long allTotalDamage = 0;  // 所有人代刀总伤害

        foreach (SQLiteManager.HelpTroopData data in helpTroopData)
        {
            totalTroop          += data.count;
            totalReimburseTroop += data.reimburseCount;
            allTotalDamage      += data.totalDamage;
            output += "\n" + GetUserName(group, data.qq) + "\t\t" + (data.count - data.reimburseCount).ToString();
            if (data.reimburseCount > 0)
            {
                output += "(+" + data.reimburseCount.ToString() + ")";
            }
            output += "刀\t伤害: " + data.totalDamage.ToString();
        }
        output += "\n【总代刀数(含补刀)】 " + (totalTroop - totalReimburseTroop).ToString();
        if (totalReimburseTroop > 0)
        {
            output += "(+" + totalReimburseTroop.ToString() + ")";
        }
        output += " 刀";
        output += "\n【代刀总伤害】 " + allTotalDamage.ToString();
        return(output);
    }
Beispiel #8
0
        private void getItemsData()
        {
            DataTable     itemsTable = new DataTable();
            SQLiteManager mngr       = new SQLiteManager();

            itemsTable = mngr.getListItems("WINDOWS");
            mngr.ConnectionClose();
            foreach (DataRow row in itemsTable.Rows)
            {
                if (row[0].ToString().Equals(tableBD))
                {
                    itemsInWidth  = Convert.ToInt32(row[1]);
                    itemsInHeight = Convert.ToInt32(row[2]);
                    itemSpace     = Convert.ToDouble(row[3]);
                    itemWidth     = Convert.ToDouble(row[5]);
                    itemHeight    = Convert.ToDouble(row[4]);
                    try
                    {
                        fontSize = Convert.ToDouble(row[6]);
                    }
                    catch
                    {
                        fontSize = 14.0;
                    }

                    break;
                }
            }
            itemsCount = itemsInWidth * itemsInHeight;
        }
Beispiel #9
0
 private void TickEvent(object sender, EventArgs e)
 {
     HoraInfo.Text = DateTime.Now.ToString("HH:mm:ss");
     if (SQLiteManager.DebeEjecutarse())
     {
         BringToFront();
         Show();
         TopMost = true;
         RefractoIcon.Visible = false;
         WindowState          = FormWindowState.Maximized;
         SetearUI_Session(_userSession);
         SQLiteManager.EliminarRegistro(_userSession.Id_Recepcion);
         OracleManager.VerificarIntegridadBaseDeDatos(_userSession.Id_Planta);
         SQLiteManager.CambiarEstado_App(2);
     }
     if (SQLiteManager.DebeMinimizarse())
     {
         Limpiar_UI();
         //SQLiteManager.CambiarEstado_App(0);
         WindowState = FormWindowState.Minimized;
         _userSession.Clear_Session();
         Hide();
         RefractoIcon.Visible = true;
         RefractoIcon.ShowBalloonTip(1000);
     }
     else
     {
         _cooperado.BringToFront();
     }
 }
Beispiel #10
0
 public Romanero_Vista()
 {
     InitializeComponent();
     SQLiteManager.CheckFolders();
     _cooperado = new Cooperado_Vista();
     SetearSegundaPantalla();
     SetearFechaHora();
     SetearNombrePlanta();
     _cooperado.PlantaInfo.Text = Nombre_Planta;
     PlantaInfo.Text            = Nombre_Planta;
     WindowState = FormWindowState.Minimized;
     //SetStartUp();
     OracleManager.SetConfiguracionDePuerto(PuertoSerial, _MarcasUsuario.ID_Planta, 2);
     TopMost            = true;
     _cooperado.TopMost = true;
     try
     {
         PuertoSerial.Open();
     }
     catch (Exception _error)
     {
         MessageBox.Show("Configuración del Serial Incorrecta. Error: " + _error.Message, "ERROR FATAL",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     //EscribirEnLog(GetExecutingDirectoryName());
     //PowerModeChangedEventHandler += new SystemEvents_PowerModeChanged();
 }
        private List <string[]> GetInfOfDataBase()
        {
            var result = new List <string[]>();

            string connectionString = SQLiteManager.GetConnectionString(this.PathToDataBase);

            using (SQLiteConnection connection = new SQLiteConnection(connectionString))
            {
                connection.Open();
                using (SQLiteCommand command = new SQLiteCommand(
                           $"SELECT * FROM person",
                           connection))
                {
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var firstName = reader[$"{DbFieldFirstName}"].ToString();
                            var lastName  = reader[$"{DbFieldLastName}"].ToString();
                            result.Add(new string[] { firstName, lastName });
                        }
                    }
                }

                connection.Close();
                return(result);
            }
        }
Beispiel #12
0
 private void InsertarEnBaseDeDatos(Session _userSession)
 {
     ScreenManager.TomarPantallazo(_userSession);
     SQLiteManager.InsertarDatos(_userSession);
     OracleManager.InsertarDatosEnPasarela(_userSession);
     OracleManager.InsertarFotoRecepcion(_userSession);
 }
 public InsertPage()
 {
     InitializeComponent();
     Title = "Kişi Ekle";
     _btnInsert.Clicked += _btnInsert_Clicked;
     manager             = new SQLiteManager <Person>();
 }
 // Token: 0x060000E8 RID: 232 RVA: 0x00007314 File Offset: 0x00005514
 private static byte[] ExtractPrivateKey4(string file)
 {
     byte[] array = new byte[24];
     try
     {
         Console.WriteLine("Key source file: " + file);
         if (!File.Exists(file))
         {
             Console.WriteLine("Source file UNKNOWN");
             return(array);
         }
         SQLiteManager sqliteManager = new SQLiteManager(file);
         sqliteManager.ReadTable("metaData");
         string        value         = sqliteManager.GetValue(0, "item1");
         string        value2        = sqliteManager.GetValue(0, "item2)");
         Asn1DerObject asn1DerObject = new Asn1Der().Parse(Encoding.Default.GetBytes(value2));
         byte[]        data          = asn1DerObject.objects[0].objects[0].objects[1].objects[0].Data;
         byte[]        data2         = asn1DerObject.objects[0].objects[1].Data;
         MozillaPBE    mozillaPBE    = new MozillaPBE(Encoding.Default.GetBytes(value), Encoding.Default.GetBytes(string.Empty), data);
         mozillaPBE.Compute();
         string input = TripleDESHelper.DESCBCDecryptor(mozillaPBE.Key, mozillaPBE.IV, data2, PaddingMode.None);
         Console.WriteLine(new string('=', 20));
         Console.WriteLine("Global salt found for encrypt: [" + FirefoxBase.CalcHex(value) + "]");
         Console.WriteLine("Entry salt found for encrypt: [" + FirefoxBase.CalcHex(data) + "]");
         Console.WriteLine("СheckPwd key for encrypt : [" + FirefoxBase.CalcHex(mozillaPBE.Key) + "]");
         Console.WriteLine("СheckPwd IV for encrypt: [" + FirefoxBase.CalcHex(mozillaPBE.IV) + "]");
         Console.WriteLine("Decrypted chiper: [" + FirefoxBase.CalcHex(input) + "]");
         Console.WriteLine(new string('=', 20));
         sqliteManager.ReadTable("nssPrivate");
         int    rowCount = sqliteManager.GetRowCount();
         string s        = string.Empty;
         for (int i = 0; i < rowCount; i++)
         {
             if (sqliteManager.GetValue(i, "a102") == Encoding.Default.GetString(FirefoxBase.MagicNumber1))
             {
                 s = sqliteManager.GetValue(i, "a11");
                 break;
             }
         }
         Asn1DerObject asn1DerObject2 = new Asn1Der().Parse(Encoding.Default.GetBytes(s));
         data       = asn1DerObject2.objects[0].objects[0].objects[1].objects[0].Data;
         data2      = asn1DerObject2.objects[0].objects[1].Data;
         mozillaPBE = new MozillaPBE(Encoding.Default.GetBytes(value), Encoding.Default.GetBytes(string.Empty), data);
         mozillaPBE.Compute();
         Console.WriteLine(new string('=', 20));
         Console.WriteLine("ChiperT found after encrypt: [" + FirefoxBase.CalcHex(data2) + "]");
         Console.WriteLine("Global salt found after encrypt: [" + FirefoxBase.CalcHex(value) + "]");
         Console.WriteLine("Entry salt found after encrypt: [" + FirefoxBase.CalcHex(data) + "]");
         Console.WriteLine("СheckPwd key after encrypt : [" + FirefoxBase.CalcHex(mozillaPBE.Key) + "]");
         Console.WriteLine("СheckPwd IV after encrypt: [" + FirefoxBase.CalcHex(mozillaPBE.IV) + "]");
         array = Encoding.Default.GetBytes(TripleDESHelper.DESCBCDecryptor(mozillaPBE.Key, mozillaPBE.IV, data2, PaddingMode.PKCS7));
         Console.WriteLine("Decrypted private key: [" + FirefoxBase.CalcHex(array) + "]");
         Console.WriteLine(new string('=', 20));
     }
     catch (Exception value3)
     {
         Console.WriteLine(value3);
     }
     return(array);
 }
    public string GetTodayDamage(long group, long qq)
    {
        List <string> temp = new List <string>();
        List <SQLiteManager.Damage> damages = SQLiteManager.GetInstance().GetTodayDamages(group, qq);
        string output = "[" + GuildBattle.GetUserName(group, qq) + "] 今日对BOSS造成的伤害:";

        if (damages.Count == 0)
        {
            output += "\n无记录";
            return(output);
        }

        long allDamage = 0;

        for (int i = 0; i < damages.Count; ++i)
        {
            temp.Add(damages[i].troop.ToString() + "队伤害: " + damages[i].damage.ToString());
            allDamage += damages[i].damage;
        }
        temp.Sort();

        for (int i = 0; i < temp.Count; ++i)
        {
            output += "\n" + temp[i];
        }
        output += "\n[今日伤害总计] " + allDamage.ToString();
        return(output);
    }
Beispiel #16
0
 public bool CreateExcelReport()
 {
     bool result;
     try
     {
         var mySQLManager = new MySQLManager();
         var reports = mySQLManager.GetAllReports();
         var sqliteManager = new SQLiteManager();
         var discountInformations = sqliteManager.GetDiscountPercentagesPerCompany();
         var reportsWithDiscounts = from r in reports
                                    join di in discountInformations on r.CompanyID equals di.CompanyID
                                    select new DiscountedReport
                                    {
                                        CompanyName = r.CompanyName,
                                        ProductName = r.ProductName,
                                        Price = r.Price * (decimal)(1 - (di.DiscountPercent / 100.00)),
                                        Quantity = r.Quantity,
                                        TotalRevenue = r.TotalRevenue * (decimal)(1 - (di.DiscountPercent / 100.00)),
                                        TotalDiscount = r.TotalRevenue * (decimal)(di.DiscountPercent / 100.00)
                                    };
         var file = CreateDirAndFile();
         WriteReportDataToFile(file, reportsWithDiscounts);
         result = true;
     }
     catch (Exception)
     {
         result = false;
     }
     return result;
 }
Beispiel #17
0
 public static SQLiteManager getInstance()
 {
     if (ins == null)
     {
         ins = new SQLiteManager();
     }
     return(ins);
 }
 public SQLiteHandler()
 {
     m_manager = new SQLiteManager("envelope");
     if (m_manager.isNewDatabase())
     {
         Initialize();
     }
 }
Beispiel #19
0
        public void BindData()
        {
            this.IsRefreshing = true;
            SQLiteManager manager = new SQLiteManager();

            Person            = new ObservableCollection <PersonModel>(manager.GetAll().ToList());
            this.IsRefreshing = false;
        }
Beispiel #20
0
        public static SQLiteRowData getDefaultView()
        {
            SQLite.SQLiteRowData dafaultView = new SQLite.SQLiteRowData();
            dafaultView = SQLiteManager.SharedInstance().GetItemForKey("SelectedSettingDefaultView").Result;


            return(dafaultView);
        }
Beispiel #21
0
        /// <summary>
        /// Obtiene datos del pais.
        /// </summary>
        public void GetDataPais()
        {
            // Pais
            Pais p;

            // Obtengo pais
            p = SQLiteManager.Connection().GetProvincia(ID_Pais);

            // Compruebo datos
            if (p == null)
            {
                // Obtengo pais del servidor
                RestManager.Connection().GetData((int)URIS.GetPais, new string[] { ID_Pais.ToString() }, null, (arg) =>
                {
                    // Compruebo datos
                    if (!string.IsNullOrWhiteSpace(arg))
                    {
                        // Deserializo JSON
                        NSDictionary data = (NSDictionary)NSJsonSerialization.Deserialize(arg, 0, out NSError e);

                        // Leo datos
                        foreach (NSString key in data.Keys)
                        {
                            switch (key.ToString().ToLower())
                            {
                            case "id_pais":
                                ID_Pais = (int)(NSNumber)data.ValueForKey(key);
                                break;

                            case "nombre":
                                Nombre_Pais = data.ValueForKey(key).ToString();
                                break;
                            }
                        }

                        // Guardo en SQLite
                        SQLiteManager.Connection().SetPais(this);
                    }

                    // Continuo
                    lock (l)
                    {
                        Monitor.Pulse(l);
                    }
                });

                // Espero
                lock (l)
                {
                    Monitor.Wait(l);
                }
            }
            else
            {
                // Cargo nombre
                Nombre_Pais = p.Nombre_Pais;
            }
        }
Beispiel #22
0
 public void SetDamage(long lessBlood)
 {
     data.damage = bossdata[data.bossNumber - 1] - lessBlood;
     CaculateAllDamage();
     SaveData();
     SQLiteManager.GetInstance().AddLog(group, "已将BOSS剩余血量重置为 " + GetBossLessDamage().ToString());
     ApiModel.CQApi.SendGroupMessage(group, "已将BOSS血量数据重置!" +
                                     "\n" + "该BOSS剩余HP: " + GetBossLessDamage().ToString());
 }
Beispiel #23
0
 public bool SetSL(long qq)
 {
     if (GetSLStatus(qq) > 0)
     {
         return(false);
     }
     SQLiteManager.GetInstance().SetSL(group, qq);
     return(true);
 }
Beispiel #24
0
 public bool RemoveSL(long qq)
 {
     if (GetSLStatus(qq) == -1)
     {
         return(false);
     }
     SQLiteManager.GetInstance().RemoveSL(group, qq);
     return(true);
 }
 public PersonDetailPage(Person _person)
 {
     InitializeComponent();
     Title        = "Kişi Düzenle";
     manager      = new SQLiteManager <Person>();
     this._person = _person;
     GetInfo();
     _btnUpdate.Clicked += _btnUpdate_Clicked;
 }
Beispiel #26
0
 public static void saveDefaultView(string selectedDefaultView)
 {
     if (selectedDefaultView != null)
     {
         SQLite.SQLiteRowData data = new SQLite.SQLiteRowData();
         data = new SQLiteRowData("SelectedSettingDefaultView", selectedDefaultView);
         SQLiteManager.SharedInstance().SaveItem(data);
     }
 }
Beispiel #27
0
 public static void saveTimePeriod(string selectedTimePeriod)
 {
     if (selectedTimePeriod != null)
     {
         SQLite.SQLiteRowData data = new SQLite.SQLiteRowData();
         data = new SQLiteRowData("SelectedSettingTimePeriod", selectedTimePeriod);
         SQLiteManager.SharedInstance().SaveItem(data);
     }
 }
Beispiel #28
0
        public static SQLiteRowData getTimePeriod()
        {
            SQLiteRowData dataValueTime = new SQLite.SQLiteRowData();

            dataValueTime = SQLiteManager.SharedInstance().GetItemForKey("SelectedSettingTimePeriod").Result;


            return(dataValueTime);
        }
        public App()
        {
            InitializeComponent();

            MainPage = new NavigationPage(new MainPage());

            var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyData.db");

            dbManager = new SQLiteManager(path);
        }
Beispiel #30
0
        /// <Docs>If the fragment is being re-created from
        ///  a previous saved state, this is the state.</Docs>
        /// <summary>
        /// Raises the create event.
        /// </summary>
        /// <param name="savedInstanceState">Saved instance state.</param>
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (Arguments.ContainsKey(ArgActivityId))
            {
                mActivityId = Arguments.GetInt(ArgActivityId);
            }
            mSqlite = SQLiteManager.Instance;
        }
Beispiel #31
0
 public void SetProjectBoxItems()
 {
     projectsBox.Items.Clear();
     string[] projects = new SQLiteManager().PathsRepository.GetAllTitles().ToArray();
     projectsBox.Items.AddRange(projects);
     if (projectsBox.Items.Count > 0)
     {
         projectsBox.SelectedIndex = 0;
     }
 }
Beispiel #32
0
 public SQLiteHelper(String localfilePath, SQLiteManager sqLiteManager)
 {
     this.manager = sqLiteManager;
     this.localFilePath = localfilePath;
 }
Beispiel #33
0
 static void Init()
 {
     _instance = (SQLiteManager)EditorWindow.GetWindow (typeof(SQLiteManager));
 }
Beispiel #34
0
 /// <summary>
 /// <list type="bullet">
 /// <item>Initialises Inventory interface</item>
 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
 /// <item>use default URI if connect string is empty.</item>
 /// </list>
 /// </summary>
 /// <param name="dbconnect">connect string</param>
 override public void Initialise(string connect)
 {
     database = new SQLiteManager(connect);
 }
Beispiel #35
0
        private void ToMySQLButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;
            var mySqlManager = new MySQLManager();
            mySqlManager.ClearMySqlDb();
            result = mySqlManager.LoadAllReportsDataFromSQLServer();
            var sqLiteManager = new SQLiteManager();
            sqLiteManager.DeleteAllEntities("Discounts");
            var reportsEngine = new ReportsEngine();
            var discounts = reportsEngine.GetDiscountsInfo();

            foreach (var discount in discounts)
            {
                result = sqLiteManager.CreateDiscountForCompany(discount.CompanyId, discount.TypeID);
            }

            if (result)
            {
                Result.Text = "Import to MySQL has been successfully completed!";
                Result.Foreground = Brushes.Green;
            }
            else
            {
                Result.Text = "Import to MySQL failed!";
                Result.Foreground = Brushes.Red;
            }
        }
 public void Prepare(SQLiteManager data)
 {
     this.data = data;
             Display ();
 }