コード例 #1
0
        private void savebtn_Click(object sender, EventArgs e)
        {
            if (codetxt.Text == "0")
            {
                Business_Layer.Encrypt en = new Business_Layer.Encrypt();

                if (employeetxt.Text == "" || approvetxt.Text == "" ||
                    userpicture.Image == null)
                {
                    Presentation_Layer.Alerts.AlertMessage.Show("No se permiten campos vacios", Alerts.AlertMessage.AlertType.error);
                }
                else
                {
                    if (confirmpasstxt.Text == passtxt.Text)
                    {
                        passtxt.Text        = en.Encriptapass(passtxt.Text);
                        confirmpasstxt.Text = en.Encriptapass(confirmpasstxt.Text);
                        this.userpicture.Image.Save(im, System.Drawing.Imaging.ImageFormat.Jpeg);
                        linq.Insert_Usuario(codeform, usernametxt.Text, passtxt.Text, im.GetBuffer(), rolecombobox.SelectedIndex + 1, approvetxt.Text.Trim(), "Inactivo");
                        linq.SubmitChanges();
                        Presentation_Layer.Alerts.AlertMessage.Show("Registro Agregado con Exito", Alerts.AlertMessage.AlertType.success);
                        dbcode();
                        Clean();
                    }
                    else
                    {
                        Presentation_Layer.Alerts.AlertMessage.Show("Las contraseñas no coinciden", Alerts.AlertMessage.AlertType.error);
                        passtxt.Clear();
                        confirmpasstxt.Clear();
                    }
                }
            }
            else
            {
                //actualizacion
            }
        }