Esempio n. 1
0
        protected void Btn_Guardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (TextBox_Nombre.Text == "")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el nombre del cliente.");
                }
                else if (TextBox_Domicilio.Text == "")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el domicilio del cliente.");
                }
                else if (TextBox_Telefono.Text == "")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el número telefónico del cliente.");
                }
                else if (ComboBox_Proyecto.Text == "")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe seleccionar el Proyecto donde está ubicado el Lote.");
                }
                else if (TextBox_Lote.Text == "")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el Número del Lote.");
                }
                else if (SpinEdit_Areas.Text == "" || SpinEdit_Areas.Text == "0")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el Área del Lote.");
                }
                else if (SpinEdit_PrecioVara.Text == "" || SpinEdit_PrecioVara.Text == "0")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el Precio de la Vara Cuadrada.");
                }
                else if (SpinEdit_Interes.Text == "" || SpinEdit_Interes.Text == "0")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar la Tasa de Interés a aplicar.");
                }
                else if (SpinEdit_Plazo.Text == "" || SpinEdit_Plazo.Text == "0")
                {
                    Toast.ShowToast(this, Toast.ToastType.Error, "Debe ingresar el Plazo del Crédito.");
                }
                else
                {
                    clsProformas Proforma = new clsProformas();
                    Proforma.IdProforma = Convert.ToInt32(lblIdProforma.Text);
                    Proforma.Nombre     = TextBox_Nombre.Text;
                    Proforma.Domicilio  = TextBox_Domicilio.Text;
                    Proforma.Telefono   = TextBox_Telefono.Text;
                    Proforma.Email      = TextBox_Email.Text;
                    Proforma.Proyecto   = ComboBox_Proyecto.Text.Trim();
                    Proforma.Lote       = TextBox_Lote.Text;
                    Proforma.Area       = Convert.ToDouble(SpinEdit_Areas.Text);
                    Proforma.PrecioVara = Convert.ToDouble(SpinEdit_PrecioVara.Text);
                    Proforma.Prima      = Convert.ToDouble(SpinEdit_Prima.Text);
                    Proforma.Interes    = Convert.ToInt32(SpinEdit_Interes.Text);
                    Proforma.Plazo      = Convert.ToInt32(SpinEdit_Plazo.Text);

                    FG._NombreUsuario = HttpContext.Current.User.Identity.Name;
                    string IdentityUser = FG.CrearIdentificadorUsuario(FG._NombreUsuario);
                    string IdProforma   = Neg.AgregarActualizarProforma(Proforma, IdentityUser);
                    string MsjSQL       = FG.Obtener_MensajeSQL(IdentityUser);
                    if (MsjSQL != "")
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "err_msg", "alert('" + MsjSQL + "');", true);
                        return;
                    }
                    else
                    {
                        lblIdProforma.Text   = IdProforma;
                        Btn_Imprimir.Enabled = true;
                        CargarDatos(IdProforma);
                        Toast.ShowToast(this, Toast.ToastType.Success, "Registro Guardado con éxito.");
                        GridView_Proformas.DataBind();
                    }
                }
            }
            catch (Exception Ex)
            {
                FG.Controlador_Error(Ex, Page.Response);
            }
        }