Exemple #1
0
        public cContractsHire()
        {
            id_contract_hire = -1;
            returned         = -1;
            db db = new db();

            if (db.dbOpen())
            {
                equipment_in_contract = 1 + Convert.ToInt32(db.executeScalar("SELECT equioment_in_contract FROM equioments_in_contract ORDER by equioment_in_contract DESC "));
            }
            db.dbClose();
        }
Exemple #2
0
        public bool save()
        {
            db db = new db();

            if (!db.dbOpen())
            {
                return(false);
            }

            string saveQuery = "";

            if (id_equipment < 0)
            {
                saveQuery = getQuery("i");
            }
            else
            {
                saveQuery = getQuery("u");
            }

            if (!db.executeParamQuery(saveQuery,
                                      new DictionaryEntry("@brand", brand),
                                      new DictionaryEntry("@model", model),
                                      new DictionaryEntry("@color", color),
                                      new DictionaryEntry("@size", size),
                                      new DictionaryEntry("@number", number),
                                      new DictionaryEntry("@cost", cost),
                                      new DictionaryEntry("@in_stock", in_stock),
                                      new DictionaryEntry("@type", type)

                                      ))
            {
                db.dbClose(); return(false);
            }
            if (id_equipment < 0)
            {
                id_equipment = Convert.ToInt32(db.executeScalar("SELECT last_insert_rowid()"));
            }
            db.dbClose();

            return(true);
        }
Exemple #3
0
        public bool save()
        {
            db db = new db();

            if (!db.dbOpen())
            {
                return(false);
            }

            string saveQuery = "";

            if (id_contract_hire < 0)
            {
                saveQuery = getQuery("i");
            }
            else
            {
                saveQuery = getQuery("u");
            }

            if (!db.executeParamQuery(saveQuery,
                                      new DictionaryEntry("@id_client", id_client),
                                      new DictionaryEntry("@equipment_in_contract", equipment_in_contract),
                                      new DictionaryEntry("@object_of_pledge", object_of_pledge),
                                      new DictionaryEntry("@rent", rent),
                                      new DictionaryEntry("@start_time", start_time),
                                      new DictionaryEntry("@end_time", end_time),
                                      new DictionaryEntry("@returned", returned)
                                      ))
            {
                db.dbClose(); return(false);
            }
            if (id_contract_hire < 0)
            {
                id_contract_hire = Convert.ToInt32(db.executeScalar("SELECT last_insert_rowid()"));
            }
            db.dbClose();

            return(true);
        }
Exemple #4
0
        public bool save()
        {
            db db = new db();

            if (!db.dbOpen())
            {
                return(false);
            }

            string saveQuery = "";

            if (id_client < 0)
            {
                saveQuery = getQuery("i");
            }
            else
            {
                saveQuery = getQuery("u");
            }

            if (!db.executeParamQuery(saveQuery,
                                      new DictionaryEntry("@fio", fio),
                                      new DictionaryEntry("@phone", phone),
                                      new DictionaryEntry("@address", address),
                                      new DictionaryEntry("@passport", passport)

                                      ))
            {
                db.dbClose(); return(false);
            }
            if (id_client < 0)
            {
                id_client = Convert.ToInt32(db.executeScalar("SELECT last_insert_rowid()"));
            }
            db.dbClose();

            return(true);
        }
Exemple #5
0
        public bool addStock()
        {
            db db = new db();

            if (!db.dbOpen())
            {
                return(false);
            }
            in_stock = Convert.ToInt32(db.executeScalar(string.Format("SELECT in_stock FROM equipments WHERE id_equipment = {0}", id_equipment)));

            string saveQuery = string.Format("UPDATE equipments SET in_stock = @in_stock  WHERE id_equipment = {0}", id_equipment);


            if (!db.executeParamQuery(saveQuery,
                                      new DictionaryEntry("@in_stock", in_stock + 1)
                                      ))
            {
                db.dbClose(); return(false);
            }
            db.dbClose();

            return(true);
        }