Exemplo n.º 1
0
        //Функция создания по
        private int addSoftwareIntoDB(ResultTableRows allInfo)
        {
            configProxyForLoadDataFromBDAndExecute("INSERT INTO Software VALUES(" +
                                                   checkExistVendorInDB(allInfo).ToString() + ",NULL,0,'" + allInfo.po + "',0);");
            ConverterSingleColumnFromDataSet converter = new ConverterSingleColumnFromDataSet();

            return(int.Parse(converter.convert(configProxyForLoadDataFromBDAndExecute(
                                                   "SELECT SoftwareID FROM Software WHERE Code='" + allInfo.po + "'"))[0]));
        }
Exemplo n.º 2
0
        //Функция создания пользователя
        private int addUserIntoDB(string userName, string host)
        {
            configProxyForLoadDataFromBDAndExecute("INSERT INTO Users VALUES('" + userName +
                                                   "','" + host + "')");
            ConverterSingleColumnFromDataSet converter = new ConverterSingleColumnFromDataSet();

            return(int.Parse(converter.convert(configProxyForLoadDataFromBDAndExecute(
                                                   "SELECT UserID FROM Users WHERE name='" + userName + "' AND host='" + host +
                                                   "'"))[0]));
        }
Exemplo n.º 3
0
        //Функция получения id vendor по его имени
        private int checkExistVendorInDB(ResultTableRows allInfo)
        {
            ConverterSingleColumnFromDataSet converter = new ConverterSingleColumnFromDataSet();
            DataSet ds = configProxyForLoadDataFromBDAndExecute(
                "SELECT VendorID FROM Vendor WHERE Name='" + allInfo.vendor + "'");

            if (converter.convert(ds) != null)
            {
                return(int.Parse(converter.convert(ds)[0]));
            }
            else
            {
                addVendorIntoDB(allInfo);
                ds = configProxyForLoadDataFromBDAndExecute(
                    "SELECT VendorID FROM Vendor WHERE Name='" + allInfo.vendor + "'");
                return(int.Parse(converter.convert(ds)[0]));
            }
        }