コード例 #1
0
ファイル: Notas.cs プロジェクト: DonSaul/PensamientoCreativo
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(Txttitle.Text) && string.IsNullOrEmpty(Txttitle.Text))
            {
                MessageBox.Show("Inserte un titulo valido");
            }
            else
            {
                if (string.IsNullOrWhiteSpace(TxtCont.Text) && string.IsNullOrEmpty(TxtCont.Text))
                {
                    MessageBox.Show("Inserte un contenidovalido");
                }
                else
                {
                    if (edit == false && codigo != null && nombrecur != null)
                    {
                        try
                        {
                            curson = codigo + Txttitle.Text;
                            ObjetoCD.InsertNote(periodo, Txttitle.Text, TxtCont.Text, user, nombrecur, codigo, curson);
                            Cargar();

                            Chou();

                            limpiarform();
                        }
                        catch (Exception ex)
                        {
                            reload();
                        }
                    }
                }
            }

            if (ed == 0)
            {
                if (edit == true && codigo != null && nombrecur != null)
                {
                    ed = 1;

                    if (string.IsNullOrWhiteSpace(Txttitle.Text) && string.IsNullOrEmpty(Txttitle.Text))
                    {
                        MessageBox.Show("Inserte un titulo valido");
                    }
                    else
                    {
                        if (string.IsNullOrWhiteSpace(TxtCont.Text) && string.IsNullOrEmpty(TxtCont.Text))
                        {
                            MessageBox.Show("Inserte un contenidovalido");
                        }
                        else
                        {
                            try
                            {
                                curson = codigo + Txttitle.Text;
                                ObjetoCD.EditarCon(Txttitle.Text, TxtCont.Text, Idcont, user, nombrecur, codigo, curson);
                                Cargar();
                                ed = 0;
                                MessageBox.Show("Se Actualizó el Campo Correctamente");
                                edit = false;
                                Chou();
                                limpiarform();
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("error ");
                                reload();
                            }
                        }
                    }
                }
            }
            else
            {
                main m = new main(user);

                m.btnVer.PerformClick();
            }
        }