Exemplo n.º 1
0
        public override async Task <bool> process()
        {
            var    _xconn    = xmlMsgIn.Data.Element("connection");           //get the connection data
            string _dataBase = _xconn.Element("DataBase").Value.ToString();   //get the database
            var    _server   = new cServer(_xconn.Element("server"));         //create the server object from the connection data
            string _sql      = xmlMsgIn.Data.Element("sql").Value.ToString(); //get the sql

            using (var _conn = new cAccesoDatosNet(_server, _dataBase))       //create the normal connection

                using (var _rs = new DynamicRS(_sql, _conn))                  // create the normal recordset
                {
                    try
                    {
                        await _rs.OpenAsync();             //execute the recordset

                        xmlMsgOut           = _rs.XMLData; //create the msgout xml data
                        xmlMsgOut.Root.Name = "result";
                    }
                    catch (Exception ex)
                    {
                        xmlMsgOut = XDocument.Parse((new XElement("result", "ERROR: " + ex.Message)).ToString()); //returns error
                    }
                }
            MsgOut = xmlMsgOut.ToString();
            return(true);
        }
Exemplo n.º 2
0
        public override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            //constructor stuff
            cImageFileList = new ListImageFile();
            cUnitNumber    = UnitRepair.cUnitNumber;
            cRepairCode    = UnitRepair.cRepairCode;
            cCount         = 0;
            using (var _rs = new DynamicRS("Select FileName,FilePath,Thumbnail,len=len(Thumbnail),IdPicture from PicturesRepairs where RepairCode='" + cRepairCode + "' and UnitNumber='" + cUnitNumber + "' order by xfec", Values.gDatos))
            {
                await _rs.OpenAsync();

                while (!_rs.EOF)
                {
                    Bitmap    _bm    = BitmapFactory.DecodeByteArray((byte[])_rs["Thumbnail"], 0, Convert.ToInt32(_rs["len"]));
                    ImageFile elFile = new ImageFile(_rs["FileName"].ToString(), _bm);
                    elFile.IdPicture = _rs["IdPicture"].ToString();
                    await cImageFileList.Add(elFile);

                    _rs.MoveNext();
                }
            }
            //cRSOld.Open("Select FileName,FilePath,Thumbnail,len=len(Thumbnail),IdPicture from PicturesRepairs where RepairCode='" + cRepairCode + "' and UnitNumber='" + cUnitNumber + "' order by xfec", Values.gDatos);
            //while (!cRSOld.EOF)
            //{
            //    Bitmap _bm = BitmapFactory.DecodeByteArray((byte[])cRSOld["Thumbnail"], 0, Convert.ToInt32(cRSOld["len"]));
            //    ImageFile elFile = new ImageFile(cRSOld["FileName"].ToString(), _bm);
            //    elFile.IdPicture = cRSOld["IdPicture"].ToString();
            //    await cImageFileList.Add(elFile);
            //    cRSOld.MoveNext();
            //}
            //cRSOld.Close();
            //
        }
Exemplo n.º 3
0
        private async void btnProcess_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("This will update the DHCP server assignments and will restart the service.\n Are you sure? ", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                foreach (var server in serverList1.ListServers.Where(s => s.CheckBox.Checked == true))
                {
                    string _configFile = "";
                    //create the temp File
                    using (var _RSD = new DynamicRS("Select * from vDHCPConfig where COD3='" + server.Info.COD3 + "'", Values.gDatos))
                    {
                        await _RSD.OpenAsync();

                        string _group = "";

                        while (!_RSD.EOF)
                        {
                            if (_RSD["Group"].ToString() != _group)
                            {
                                if (_group != "")
                                {
                                    _configFile += "\t}\n";
                                }
                                _group       = _RSD["Group"].ToString();
                                _configFile += "# " + _group + '\n' + "group " + _group + "{" + '\n';
                            }
                            _configFile += "\t# " + _RSD["Comment"].ToString() + '\n';
                            _configFile += "\thost " + _RSD["Host"].ToString() + " {" + '\n';
                            _configFile += "\t\thardware ethernet " + _RSD["MAC"].ToString() + ";" + '\n';
                            _configFile += "\t\tfixed-address " + _RSD["IP"].ToString() + ";" + '\n';
                            _configFile += "\t\t}\n";
                            _RSD.MoveNext();
                        }
                        _configFile += "\t}\n";
                        _RSD.Close();
                    }
                    server.Info.FileName    = string.Format("/etc/dhcp/{0}_NET.conf", server.Info.COD3);
                    server.Info.FileContent = _configFile;
                }
                //execute tasks
                await serverList1.ExecuteCommandInServers();
            }
        }