protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Nome = txtMatricula.Text;

                BLL.BLL bll    = new BLL.BLL();
                var     result = bll.Login(txtMatricula.Text, txtSenha.Text);
                switch (result.Trim())
                {
                case "USUARIO CADASTRADO":
                    Usuario = txtMatricula.Text;
                    Response.Redirect("~/Ui/Home.aspx");
                    break;

                case "SENHA INVALIDA":
                    Mensagem.MensagemAlerta("SENHA INCORRETA");
                    TrocarSenha.Visible = true;
                    break;

                default:
                    Mensagem.MensagemAlerta(result.Trim());
                    break;
                }
            }
            catch (Exception)
            {
                Mensagem.MensagemAlerta("Erro Ao Executar Operação");
            }
        }
Beispiel #2
0
        protected void BucarTemperatura()
        {
            try
            {
                BLL.BLL bll    = new BLL.BLL();
                var     result = bll.ClimaTempo("455845");
                dynamic Clima  = JsonConvert.DeserializeObject(result);

                foreach (var i in Clima)
                {
                    pnlDetalhes.Visible   = true;
                    CidadeValue.Text      = i.First.city;
                    regiaoValue.Text      = i.Parent.location.region;
                    paisValue.Text        = i.First.country;
                    velocValue.Text       = string.Format("{0} KM/h", i.Parent.current_observation.wind.speed);
                    UmidadeValue.Text     = string.Format("{0}%", i.Parent.current_observation.atmosphere.humidity);
                    condicaoValue.Text    = i.Parent.current_observation.condition.text;
                    temperaturaValue.Text = string.Format("{0} ºC", i.Parent.current_observation.condition.temperature);
                    break;
                }
            }
            catch (Exception)
            {
                Mensagem.MensagemAlerta("Erro Ao Executar Operação");
            }
        }
        protected void btnPesquisar_Click(object sender, EventArgs e)
        {
            try
            {
                BLL.BLL bll    = new BLL.BLL();
                var     result = bll.ClimaTempo(ddlCidade.SelectedItem.Value);
                dynamic Clima  = JsonConvert.DeserializeObject(result);

                foreach (var i in Clima)
                {
                    pnlDetalhes.Visible   = true;
                    CidadeValue.Text      = i.First.city;
                    regiaoValue.Text      = i.Parent.location.region;
                    paisValue.Text        = i.First.country;
                    velocValue.Text       = string.Format("{0} KM/h", i.Parent.current_observation.wind.speed);
                    UmidadeValue.Text     = string.Format("{0}%", i.Parent.current_observation.atmosphere.humidity);
                    nascenteValue.Text    = i.Parent.current_observation.astronomy.sunrise;
                    poenteValue.Text      = i.Parent.current_observation.astronomy.sunset;
                    condicaoValue.Text    = i.Parent.current_observation.condition.text;
                    temperaturaValue.Text = string.Format("{0} ºC", i.Parent.current_observation.condition.temperature);
                    break;
                }
            }
            catch (Exception)
            {
                Mensagem.MensagemAlerta("Erro Ao Executar Operação");
            }
        }
        protected void lkBtnTrocarSenha_Click(object sender, EventArgs e)
        {
            try
            {
                int    numero = CodigoSeguranca();
                string num    = numero.ToString();
                num    = num.PadRight(8, '0');
                numero = Convert.ToInt32(num);

                BLL.BLL obj    = new BLL.BLL();
                var     result = obj.AlterarSenha(Nome, num);
                if (result.Trim() == "USUARIO NAO POSSUI CADASTRO")
                {
                    Mensagem.MensagemAlerta(Nome + " NÃO POSSUI CADASTRO!");
                    return;
                }

                EnviaEmail(numero, result.Trim());
                Mensagem.MensagemAlerta("SUA NOVA SENHA FOI ENVIADA PARA O EMAIL " + result.Trim());
            }
            catch (Exception)
            {
                Mensagem.MensagemAlerta("Erro Ao Executar Operação");
            }
        }
Beispiel #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            object x = comboBox1.SelectedValue;

            BLL.BLL xx = new BLL.BLL();
            int     a  = Convert.ToInt32(xx.SlipwayMage_a(x));

            if (a >= listBox1.Items.Count)
            {
                for (int loop = 0; loop < listBox1.Items.Count; loop++)
                {
                    object  c   = comboBox1.SelectedValue;
                    object  b   = listBox1.Items[loop];
                    BLL.BLL lb1 = new BLL.BLL();
                    lb1.SlipwayManage_listbox1(c, b);
                }
                for (int loop = 0; loop < listBox2.Items.Count; loop++)
                {
                    object  c   = listBox2.Items[loop];
                    BLL.BLL lb2 = new BLL.BLL();
                    lb2.SlipwayManage_listbox2(c);
                }
                MessageBox.Show("更改成功");
            }
            else
            {
                string message = string.Format("船台容纳不了这么多船最多容纳{0}艘船", a);
                MessageBox.Show(message, "提醒");
            }
        }
Beispiel #6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0)
     {
         MessageBox.Show("请填写完整信息", "提示");
     }
     else
     {
         ec.Name    = textBox1.Text;
         ec.Address = textBox2.Text;
         ec.Phoneno = textBox3.Text;
         BLL.BLL bc    = new BLL.BLL();
         int     count = Convert.ToInt32(bc.AddCustomer(ec));
         if (count == 0)
         {
             AddBoat ab = new AddBoat();
             ab.ec = this.ec;
             this.Hide();
             ab.ShowDialog();
             this.Show();
         }
         else
         {
             MessageBox.Show("用户名已被占用", "提示");
         }
     }
 }
        private async void SignInButton_Click(object sender, RoutedEventArgs e)
        {
            BLL.BLL   b = new BLL.BLL();
            DTO_Login u = new DTO_Login();

            u.username = Email.Text;
            u.password = Password.Text;
            var result = await b.Login(u);
        }
Beispiel #8
0
 public FormBauChon(ThanhVien tv)
 {
     InitializeComponent();
     thanhVien = tv;
     bll       = new BLL.BLL();
     MaTV      = bll.GetMaTV(thanhVien);
     LoadListView(lvUngVien);
     LoadListView(lvBauChon);
 }
 protected void btnSalvar_Click(object sender, EventArgs e)
 {
     try
     {
         BLL.BLL obj = new BLL.BLL();
         obj.AtualizarUsuario(txtId.Text, txtNome.Text, txtSobrenome.Text, ddlCidade.SelectedValue, ddlEstado.SelectedValue, ddlPais.SelectedValue, ddlSexo.SelectedValue, ddlEstadoCivil.SelectedValue);
         Mensagem.MensagemAlerta("Operação Concluida");
     }
     catch (Exception ex)
     {
         Mensagem.MensagemAlerta("Erro Ao Executar Operação");
     }
 }
Beispiel #10
0
        //public DataTable CartProducts()
        //{
        //    BLL.BLL balobj = new BLL.BLL();
        //    DataSet ds = new DataSet();
        //    Cart cart = new Cart();

        //    DataTable dt = cart.itemTable();
        //    DataTable dtt = cart.ViewCartTable();
        //    DataTable dtt1 = cart.ViewCartTable();

        //    ds = balobj.Get_Products("");
        //    dt = HttpContext.Current.Session["Cart"] as DataTable;

        //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //    {
        //        dtt.Rows.Add(ds.Tables[0].Rows[i]["ProductID"].ToString(),
        //                   ds.Tables[0].Rows[i]["Productname"].ToString(),
        //                   GlobalVarables.Image_Url() + ds.Tables[0].Rows[i]["Product_ImgUrl"].ToString(),
        //                   "0",
        //                   ds.Tables[0].Rows[i]["DistributorPrice"].ToString(),
        //                   ds.Tables[0].Rows[i]["DistributorPrice"].ToString());
        //    }
        //    if (dt != null & dtt != null)
        //    {
        //        if (dt.Rows.Count > 0 & dtt.Rows.Count > 0)
        //        {
        //            var result = from dataRows1 in dtt.AsEnumerable()
        //                         join dataRows2 in dt.AsEnumerable()
        //                         on dataRows1.Field<string>("ProductID") equals dataRows2.Field<string>("Productid")
        //                         select dtt1.LoadDataRow(new object[]
        //                    {
        //                        dataRows1.Field<string>("ProductID"),
        //                        dataRows1.Field<string>("Productname"),
        //                        dataRows1.Field<string>("Product_ImgUrl"),
        //                        dataRows2.Field<string>("Quantity"),
        //                        dataRows1.Field<string>("Unitmrpprice"),
        //                        (Convert.ToDouble(dataRows2.Field<string>("Quantity")) * Convert.ToDouble(dataRows1.Field<string>("Unitmrpprice"))).ToString(),
        //                        dataRows2.Field<string>("Size"),
        //                        dataRows2.Field<string>("Color")
        //                    }, false);
        //            return result.CopyToDataTable();
        //        }
        //        else
        //            return dtt1;
        //    }
        //    else
        //        return dtt1;
        //}
        public DataTable CartProducts()
        {
            BLL.BLL balobj = new BLL.BLL();
            DataSet ds     = new DataSet();
            Cart    cart   = new Cart();

            DataTable dt   = cart.itemTable();
            DataTable dtt  = cart.ViewCartTable();
            DataTable dtt1 = cart.ViewCartTable();

            ds = balobj.Get_Products("");
            dt = HttpContext.Current.Session["Cart"] as DataTable;

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                dtt.Rows.Add(ds.Tables[0].Rows[i]["ProductID"].ToString(),
                             ds.Tables[0].Rows[i]["Productname"].ToString(),
                             GlobalVarables.Image_Url() + ds.Tables[0].Rows[i]["Product_ImgUrl"].ToString(),
                             "0",
                             ds.Tables[0].Rows[i]["DistributorPrice"].ToString(),
                             ds.Tables[0].Rows[i]["DistributorPrice"].ToString());
            }
            if (dt != null & dtt != null)
            {
                if (dt.Rows.Count > 0 & dtt.Rows.Count > 0)
                {
                    var result = from dataRows1 in dtt.AsEnumerable()
                                 join dataRows2 in dt.AsEnumerable()
                                 on dataRows1.Field <string>("ProductID") equals dataRows2.Field <string>("Productid")
                                 select dtt1.LoadDataRow(new object[]
                    {
                        dataRows1.Field <string>("ProductID"),
                        dataRows1.Field <string>("Productname"),
                        dataRows1.Field <string>("Product_ImgUrl"),
                        dataRows2.Field <string>("Quantity"),
                        dataRows1.Field <string>("Unitmrpprice"),
                        (Convert.ToDouble(dataRows2.Field <string>("Quantity")) * Convert.ToDouble(dataRows1.Field <string>("Unitmrpprice"))).ToString()
                    }, false);

                    return(result.CopyToDataTable());
                }
                else
                {
                    return(dtt1);
                }
            }
            else
            {
                return(dtt1);
            }
        }
        private void BoutonEffacer_Click(object sender, RoutedEventArgs e)
        {
            BLL.BLL BLL_DELETE_CONTACT = new BLL.BLL();

            if (BLL_DELETE_CONTACT.deleteContact(phoneAeffacer.Text))
            {
                messageDelete.Text = "Contact deleted";
                phoneAeffacer.Text = "";
            }
            else
            {
                messageDelete.Text = "No contact found";
            }
        }
Beispiel #12
0
        private void FindCustomer_Load(object sender, EventArgs e)
        {
            BLL.BLL ss = new BLL.BLL();
            DataSet ds = ss.FindCustomer_Selecr();
            int     hs = ds.Tables[0].Rows.Count;

            listBox1.DisplayMember = "name";
            listBox1.ValueMember   = "phoneno";
            listBox1.DataSource    = ds.Tables[0];
            if (listBox1.Items.Count != 0)
            {
                listBox1.SelectedIndex = 0;
            }
        }
Beispiel #13
0
        private void SlipwayManage_Load(object sender, EventArgs e)
        {
            BLL.BLL ss  = new BLL.BLL();
            DataSet ds1 = ss.SlipwayManage_Sx();
            int     hs1 = ds1.Tables[0].Rows.Count;

            comboBox1.DisplayMember = "name";
            comboBox1.ValueMember   = "id";
            comboBox1.DataSource    = ds1.Tables[0];
            if (comboBox1.Items.Count != 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
Beispiel #14
0
        public void populate(int type_tri)
        {
            ListFirstName.Text = "";
            ListLastName.Text  = "";
            ListEmail.Text     = "";
            ListPhone.Text     = "";
            ListAge.Text       = "";

            BLL.BLL BLL_affiche_contact = new BLL.BLL();

            String[] mesContacts = BLL_affiche_contact.afficheConatct(type_tri); // si l'on ne donne pas en parametre soit 0 pour le tir par age soit 1 pour le tri par firstName, alors n'importe quelle valeur int renverra le tableau de contact par defaut(renvoie le tableau pris en parametre sans aucun traitement la dessus)
            string   FirstNames  = "";
            string   LastNames   = "";
            string   emails      = "";
            string   phones      = "";
            string   ages        = "";
            int      nbcntFnd    = 0;

            if (mesContacts != null && mesContacts.Length > 0)
            {
                foreach (String contacts in mesContacts)
                {
                    string[] splitableString = contacts.Split(',');
                    string   FirstName       = splitableString[0];
                    FirstNames += FirstName + "\n";
                    string LastName = splitableString[1];
                    LastNames += LastName + "\n";
                    string email = splitableString[2];
                    emails += email + "\n";
                    string numTelephone = splitableString[3];
                    phones += numTelephone + "\n";
                    string age = splitableString[4];
                    ages += age + "\n";
                    nbcntFnd++;
                }


                ListFirstName.Text = FirstNames;
                ListLastName.Text  = LastNames;
                ListEmail.Text     = emails;
                ListPhone.Text     = phones;
                ListAge.Text       = ages;

                nbContactFound.Content = nbcntFnd + " contact(s) found";
            }
            else
            {
                nbContactFound.Content = "No Contacts. Insert new contacts";
            }
        }
Beispiel #15
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            GUI.AddSlipway asw = new AddSlipway();
            this.Hide();
            asw.ShowDialog();
            this.Show();
            BLL.BLL ss  = new BLL.BLL();
            DataSet ds1 = ss.SlipwayManage_Sx();
            int     hs1 = ds1.Tables[0].Rows.Count;

            comboBox1.DisplayMember = "name";
            comboBox1.ValueMember   = "id";
            comboBox1.DataSource    = ds1.Tables[0];
        }
Beispiel #16
0
 private void BoutonLogin_Click(object sender, RoutedEventArgs e)
 {
     BLL.BLL bll = new BLL.BLL(iD.Text);
     if (bll.login(password.Text) == true)
     {
         Contacts_View fenetreContact = new Contacts_View();
         fenetreContact.Show();
         this.Close();
     }
     else
     {
         messageLogin.Content = "Incorrect ID or password";
     }
 }
Beispiel #17
0
 private void button2_Click(object sender, EventArgs e)
 {
     Entity.Customer ec = new Entity.Customer();
     ec.Address = textBox1.Text;
     ec.Phoneno = textBox2.Text;
     BLL.BLL bb = new BLL.BLL();
     try
     {
         bb.Update(ec);
         MessageBox.Show("更新成功");
     }
     catch
     {
         MessageBox.Show("更新失败");
     }
 }
Beispiel #18
0
        private void BoutonRegister_Click(object sender, RoutedEventArgs e)
        {
            BLL.BLL Bll_registrer = new BLL.BLL(RegisterID.Text);
            Bll_registrer.registrerUtilisateur(RegisterFirtsName.Text, RegisterSecondName.Text, RegisterEmail.Text, RegisterID.Text, RegisterPassword.Text);
            RegisterFirtsName.Text  = "";
            RegisterSecondName.Text = "";
            RegisterEmail.Text      = "";
            RegisterID.Text         = "";
            RegisterPassword.Text   = "";

            //Reaffichage de la fenetre de login pour permettre a l'utilisateur de se connecter a son compte
            this.Hide();
            MainWindow login = new MainWindow();

            login.Show();
        }
Beispiel #19
0
        public static bool login(System.Web.SessionState.HttpSessionState session, string accno, string pwd)
        {
            DataSet loginds = new DataSet();

            BLL.BLL balobj = new BLL.BLL();
            loginds = balobj.Account_Login(accno, pwd);
            if (GlobalVarables.chkdataset(loginds))
            {
                session["member"] = loginds.Tables[0].Rows[0]["AccountNo"].ToString();
                return(true);
            }
            else
            {
                return(false);
            }
        }
 private void BoutonEditContact_Click(object sender, RoutedEventArgs e)
 {
     BLL.BLL BLL_EDIT_CONTACT = new BLL.BLL();
     if (BLL_EDIT_CONTACT.editContact(editContactFirtsName.Text, editContactSecondName.Text, editContactEmail.Text, editContactPhone.Text, editContactAge.Text))
     {
         editContactFirtsName.Text  = "";
         editContactSecondName.Text = "";
         editContactEmail.Text      = "";
         editContactPhone.Text      = "";
         editContactAge.Text        = "";
         messageEditContact.Content = "Contact edited";
     }
     else
     {
         messageEditContact.Content = "Contact not found";
     }
 }
Beispiel #21
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItems.Count == 0)
     {
         MessageBox.Show("没有船只被选中请选择");
     }
     else
     {
         label2.Text = "";
         BLL.BLL         bl = new BLL.BLL();
         Entity.Customer cs = new Entity.Customer();
         cs.Phoneno = Convert.ToString(listBox1.SelectedValue);
         Entity.Customer cs1 = bl.FindCustomer(cs);
         textBox1.Text = cs1.Address;
         textBox2.Text = cs1.phoneno;
         label2.Text   = "注册编号:" + cs1.Boat1.Stateregistrationno + "   制造商:" + cs1.Boat1.Manufacturer + "    船长:" + cs1.Boat1.length + "\r\n" + "     年份:" + cs1.Boat1.Validity + "";
     }
 }
Beispiel #22
0
 private void BoutonNewContact_Click(object sender, RoutedEventArgs e)
 {
     BLL.BLL BLL_AddContact = new BLL.BLL();
     if (NewContactFirtsName.Text.Trim().CompareTo("") != 0 || NewContactSecondName.Text.Trim().CompareTo("") != 0 || NewContactEmail.Text.Trim().CompareTo("") != 0 || NewContactPhone.Text.Trim().CompareTo("") != 0 || NewContactAge.Text.Trim().CompareTo("") != 0)
     {
         BLL_AddContact.AddNewContact(NewContactFirtsName.Text, NewContactSecondName.Text, NewContactEmail.Text, NewContactPhone.Text, NewContactAge.Text);
         NewContactFirtsName.Text  = "";
         NewContactSecondName.Text = "";
         NewContactEmail.Text      = "";
         NewContactPhone.Text      = "";
         NewContactAge.Text        = "";
         addContactMessage.Content = "Contact insert";
     }
     else
     {
         addContactMessage.Content = "Insert new contact informations";
     }
 }
        private void BoutonRechercher_Click(object sender, RoutedEventArgs e)
        {
            BLL.BLL BLL_RESEARCH_CONTACT = new BLL.BLL();

            List <string[]> mesContact_trouver = BLL_RESEARCH_CONTACT.searchContact(phoneARechercher.Text);

            if (mesContact_trouver != null && mesContact_trouver.Count > 0)
            {
                string firstNames      = "";
                string secondNames     = "";
                string emails          = "";
                string phones          = "";
                string ages            = "";
                int    nbrContactFound = 0;

                foreach (string[] maListContact in mesContact_trouver)
                {
                    firstNames  += maListContact[0] + "\n";
                    secondNames += maListContact[1] + "\n";
                    emails      += maListContact[2] + "\n";
                    phones      += maListContact[3] + "\n";
                    ages        += maListContact[4] + "\n";

                    nbrContactFound++;
                }
                listFirstNameFound.Text  = firstNames;
                listSecondNameFound.Text = secondNames;
                listEmailFound.Text      = emails;
                listPhoneFound.Text      = phones;
                listAgeFound.Text        = ages;
                messageRecherche.Text    = nbrContactFound + " contact(s) found";
            }
            else
            {
                listFirstNameFound.Text  = "";
                listSecondNameFound.Text = "";
                listEmailFound.Text      = "";
                listPhoneFound.Text      = "";
                listAgeFound.Text        = "";
                messageRecherche.Text    = "No contact found";
            }
        }
Beispiel #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            string c = textBox1.Text;

            BLL.BLL As    = new BLL.BLL();
            int     count = Convert.ToInt32(As.AddSlipWay_SS(c));

            if (count == 0)
            {
                Entity.Slipway es = new Entity.Slipway();
                string         a  = textBox2.Text;
                int            result;
                if (int.TryParse(a, out result))
                {
                    try
                    {
                        es.Name   = textBox1.Text;
                        es.Volume = Convert.ToInt32(textBox2.Text);
                        BLL.BLL bb = new BLL.BLL();
                        bb.AddSlipway(es);
                        MessageBox.Show("添加船台成功");
                    }

                    catch (FormatException)
                    {
                        MessageBox.Show("容纳船数必须为数字");
                    }
                    catch
                    {
                        MessageBox.Show("添加船台失败");
                    }
                }
                else
                {
                    MessageBox.Show("请检查容纳船数是否为数字", "提醒");
                }
            }
            else
            {
                MessageBox.Show("船台名已存在");
            }
        }
Beispiel #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Mensagem.buttonOk += Mensagem_buttonOk;
            if (!IsPostBack)
            {
                try
                {
                    ValidaUsuario();
                    BLL.BLL obj    = new BLL.BLL();
                    var     result = obj.Detalhes(Usuario);

                    lblNomeValue.Text     = result.ElementAt(1) + result.ElementAt(2);
                    lblCadastroValue.Text = string.IsNullOrEmpty(result.ElementAt(9).Trim())? " " : FormatarData(result.ElementAt(9));
                }
                catch (Exception)
                {
                    Mensagem.MensagemAlerta("Erro Ao Executar Operação");
                }
            }
        }
        protected void btnBuscarMatricula_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                BLL.BLL obj    = new BLL.BLL();
                var     result = obj.Detalhes(txtId.Text);

                txtNome.Text                 = result.ElementAt(1);
                txtSobrenome.Text            = result.ElementAt(2);
                ddlCidade.SelectedIndex      = Convert.ToInt32(result.ElementAt(3));
                ddlEstado.SelectedIndex      = Convert.ToInt32(result.ElementAt(4));
                ddlPais.SelectedIndex        = Convert.ToInt32(result.ElementAt(5));
                ddlSexo.SelectedIndex        = (result.ElementAt(6) == "M") ? 1 : 2;
                ddlEstadoCivil.SelectedIndex = Convert.ToInt32(result.ElementAt(7));
                ddlCidade.DataBind();
            }
            catch (Exception ex)
            {
                Mensagem.MensagemAlerta("Erro Ao Executar Operação");
            }
        }
Beispiel #27
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            listBox2.Items.Clear();
            object a = comboBox1.SelectedValue;

            BLL.BLL SS  = new BLL.BLL();
            DataSet ds2 = SS.SlipwayManage_SS(a);
            int     hs2 = ds2.Tables[0].Rows.Count;

            for (int loop = 0; loop < hs2; loop++)
            {
                listBox1.Items.Add(ds2.Tables[0].Rows[loop].ItemArray[0].ToString());
            }
            BLL.BLL BB  = new BLL.BLL();
            DataSet ds3 = BB.SlipwayManage_BB();
            int     hs3 = ds3.Tables[0].Rows.Count;

            for (int loop = 0; loop < hs3; loop++)
            {
                listBox2.Items.Add(ds3.Tables[0].Rows[loop].ItemArray[0].ToString());
            }
        }
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ConfirmarCodigo.Visible)
                {
                    /*VIEW STATE*/
                    Nome  = txtCdMatricula.Text;
                    Senha = txtCdSenha.Text;
                    Email = txtCdEmail.Text;

                    BLL.BLL obj    = new BLL.BLL();
                    var     result = obj.CadastrarUsuario(Nome, null, Email);

                    if (!string.IsNullOrEmpty(result.Trim()))
                    {
                        if (result.Trim() == "USUARIO JA POSSUI CADASTRO")
                        {
                            Mensagem.MensagemAlerta(result.Trim());
                            return;
                        }
                        else if (result.Trim() == "EMAIL JÁ POSSUI CADASTRO")
                        {
                            Mensagem.MensagemAlerta(result.Trim());
                            return;
                        }
                    }
                    int numero = CodigoSeguranca();
                    CodSeguranca = numero.ToString();

                    /*Envia email com codigo de segurança*/
                    EnviaEmail(numero, Email);

                    ConfirmarCodigo.Visible       = true;
                    btnCadastrar.Text             = "CADASTRAR";
                    txtCdMatricula.Enabled        = false;
                    txtCdEmail.Enabled            = false;
                    txtCdSenha.Enabled            = false;
                    txtConfirmaSenha.Enabled      = false;
                    btnCadastrar.CausesValidation = false;
                }
                else
                {
                    if (!(CodSeguranca == txtCodigo.Text))
                    {
                        Mensagem.MensagemAlerta("Codigo Invalido!");
                        return;
                    }

                    BLL.BLL obj = new BLL.BLL();
                    obj.CadastrarUsuario(Nome, Senha, Email);
                    Mensagem.MensagemAlerta("USUARIO CADASTRADO COM SUCESSO!");
                    Usuario = Nome;
                    Response.Redirect("~/Ui/Home.aspx");
                }
            }
            catch (Exception ex)
            {
                Mensagem.MensagemAlerta("Erro Ao executar Operação");
            }
        }
Beispiel #29
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0 || textBox3.Text.Length == 0 || textBox4.Text.Length == 0 || textBox5.Text.Length == 0 || textBox6.Text.Length == 0 || (radioButton1.Checked == false && radioButton2.Checked == false) || (radioButton3.Checked == false && radioButton4.Checked == false && radioButton5.Checked == false))
     {
         MessageBox.Show("请填写完整信息", "提示");
     }
     else
     {
         string a = textBox3.Text;
         string b = textBox5.Text;
         string c = textBox6.Text;
         int    result;
         if (int.TryParse(a, out result) && int.TryParse(b, out result) && int.TryParse(c, out result))
         {
             Entity.Boat eb = new Entity.Boat();
             eb.Stateregistrationno = textBox4.Text;
             eb.Manufacturer        = textBox1.Text;
             eb.Length        = Convert.ToInt32(textBox3.Text);
             eb.Customerphone = ec.phoneno;
             eb.Validity      = textBox2.Text;
             eb.sail          = Convert.ToInt32(textBox5.Text);
             eb.keel          = Convert.ToInt32(textBox6.Text);
             if (radioButton1.Checked)
             {
                 eb.type = '1';
             }
             else if (radioButton2.Checked)
             {
                 eb.type = '2';
             }
             if (radioButton3.Checked)
             {
                 eb.energe = '1';
             }
             else if (radioButton4.Checked)
             {
                 eb.energe = '2';
             }
             else if (radioButton5.Checked)
             {
                 eb.energe = '3';
             }
             BLL.BLL bb = new BLL.BLL();
             int     xs = Convert.ToInt32(bb.AddBoat_SS(eb));
             if (xs == 0)
             {
                 int count = Convert.ToInt32(bb.AddBoat(eb, ec));
                 if (count == 0)
                 {
                     MessageBox.Show("添加游艇成功");
                 }
                 else
                 {
                     MessageBox.Show("添加游艇失败");
                 }
             }
             else
             {
                 MessageBox.Show("数据库中查找到相同船只");
             }
         }
         else
         {
             MessageBox.Show("请检查长度、帆数、龙骨深度是否为数字", "提示");
         }
     }
 }