private void btnConfig_Click(object sender, EventArgs e)
        {
            try
            {
                string ip = txtIPAddress.Text;
                BLL.tb_gateway_config        c = new BLL.tb_gateway_config();
                List <BLL.tb_gateway_config> l = c.LoadConfig();

                //  c.tb_id = Convert.ToInt32(l[0]);
                c.tb_id     = 1;
                c.ipaddress = ip;
                c.port      = txtPort.Text;
                c.password  = txtPassword.Text;
                c.username  = txtUserName.Text;
                c.tsc1      = txtServerNumber.Text;
                c.tsc2      = txtServiceNumber2.Text;
                c.t15       = txtServiceNumber15.Text;
                c.UpdateConfig(c);
                MessageBox.Show("Updated");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            {
            }
        }
Beispiel #2
0
        private void frmAddUser_Load(object sender, EventArgs e)
        {
            BLL.tb_gateway_config        c = new BLL.tb_gateway_config();
            List <BLL.tb_gateway_config> l = c.LoadConfig();

            if (l.Count > 0)
            {
                ipaddress  = l[0].ipaddress;
                port       = l[0].port;
                username   = l[0].password;
                welcomemsg = l[0].welcomemsg;
                password   = l[0].password;
            }
        }
        public bool SaveConfig(tb_gateway_config config)
        {
            bool saved = false;

            try
            {
                dc.tb_gateway_configs.InsertOnSubmit(config);
                dc.SubmitChanges();
            }
            catch (Exception en)
            {
                throw en;
            }
            return(saved);
        }
        private void frmConfigurations_Load(object sender, EventArgs e)
        {
            BLL.tb_gateway_config        c = new BLL.tb_gateway_config();
            List <BLL.tb_gateway_config> l = c.LoadConfig();

            if (l.Count > 0)
            {
                txtIPAddress.Text       = l[0].ipaddress;
                txtPort.Text            = l[0].port;
                txtPassword.Text        = l[0].password;
                txtUserName.Text        = l[0].username;
                txtServerNumber.Text    = l[0].tsc1;
                txtServiceNumber2.Text  = l[0].tsc2;
                txtServiceNumber15.Text = l[0].t15;
            }
        }
        public void UpdateConfig(tb_gateway_config con)
        {
            try
            {
                tb_gateway_config u = dc.tb_gateway_configs.Single(us => us.tb_id == con.tb_id);
                u.ipaddress = con.ipaddress;
                u.port      = con.port;
                u.username  = con.username;
                u.password  = con.password;
                u.t15       = con.t15;
                u.tsc1      = con.tsc1;
                u.tsc2      = con.tsc2;
                dc.SubmitChanges();
            }



            catch (Exception ex)
            {
                throw ex;
            }
        }
 partial void Deletetb_gateway_config(tb_gateway_config instance);
 partial void Updatetb_gateway_config(tb_gateway_config instance);
 partial void Inserttb_gateway_config(tb_gateway_config instance);