Ejemplo n.º 1
0
 protected void btnGuardar_Click(object sender, EventArgs e)
 {
     if (Session[KeyIDC] == null)
     {
         Data2.Class.Struct_Cliente CL = new Data2.Class.Struct_Cliente(
             txt_razonsocial.Text,
             txt_dnicuilcuit.Text,
             cmbpais.SelectedValue,
             cmbprovincia.SelectedValue,
             txt_localidad.Text,
             txt_domicilio.Text,
             txt_observaciones.Text,
             cmbsituacion.SelectedValue,
             Data2.Statics.Conversion.GetDecimal(txt_descuento.Text),
             txt_email.Text,
             UserId,
             Data2.Statics.Conversion.GetDecimal(txt_limite.Text),
             chk_Suspendida.Checked);
         CL.Guardar();
     }
     else
     {
         Data2.Class.Struct_Cliente SC = Data2.Class.Struct_Cliente.GetClient(int.Parse(Session[KeyIDC].ToString()), UserId);
         if (SC != null && Request[KeyIDC] != null)
         {
             SC.DESCUENTO       = Data2.Statics.Conversion.GetDecimal(txt_descuento.Text);
             SC.DNI             = txt_dnicuilcuit.Text;
             SC.DOMICILIO       = txt_domicilio.Text;
             SC.EMAIL           = txt_domicilio.Text;
             SC.LIMITEDECREDITO = Data2.Statics.Conversion.GetDecimal(txt_limite.Text);
             SC.LOCALIDAD       = txt_localidad.Text;
             SC.OBSERVACIONES   = txt_observaciones.Text;
             SC.PAIS            = cmbpais.SelectedValue;
             SC.PROVINCIA       = cmbprovincia.SelectedValue;
             SC.RS      = txt_razonsocial.Text;
             SC.TIPOIVA = cmbsituacion.SelectedValue;
             SC.Guardar();
             Session.Remove(KeyIDC);
             Response.Redirect(Request.RawUrl.Split('?')[0]);
         }
         else
         {
             Session.Remove(KeyIDC);
             HF_EU.Value = "0";
             Response.Redirect(Request.RawUrl.Split('?')[0]);
         }
     }
 }
Ejemplo n.º 2
0
        private void ConfigFields()
        {
            if (cmbprovincia.Items.Count == 0)
            {
                cmbprovincia.Items.Clear();
                List <Data2.Class.Struct_Provincia> LP = Data2.Class.Struct_Provincia.GetAll();
                Data2.Statics.Log.ADD(LP.Count.ToString(), this);
                if (LP != null && LP.Count > 0)
                {
                    for (int a = 0; a < LP.Count; a++)
                    {
                        ListItem LI = new ListItem(LP[a].getName(), LP[a].getName());

                        cmbprovincia.Items.Add(LI);
                    }
                }
            }

            if (Request[KeyIDC] != null && !IsPostBack)
            {
                Session.Remove(KeyIDC);
                Session.Add(KeyIDC, Request[KeyIDC].ToString());

                Data2.Class.Struct_Cliente SC = Data2.Class.Struct_Cliente.GetClient(int.Parse(Session[KeyIDC].ToString()), UserId);
                if (SC != null && !IsPostBack)
                {
                    txt_descuento.Text         = SC.DESCUENTO.ToString("#.00");
                    txt_dnicuilcuit.Text       = SC.DNI;
                    txt_domicilio.Text         = SC.DOMICILIO;
                    txt_email.Text             = SC.EMAIL;
                    txt_limite.Text            = SC.LIMITEDECREDITO.ToString("#.00");
                    txt_localidad.Text         = SC.LOCALIDAD;
                    txt_observaciones.Text     = SC.OBSERVACIONES;
                    txt_razonsocial.Text       = SC.RS;
                    cmbpais.SelectedValue      = SC.PAIS;
                    cmbprovincia.SelectedValue = SC.PROVINCIA;
                    cmbsituacion.SelectedValue = SC.TIPOIVA;
                    HF_EU.Value = SC.ID.ToString();
                }
            }
            else
            {
                HF_EU.Value = "0";
            }
        }
Ejemplo n.º 3
0
        public HttpResponseMessage SSC(string K, int idc)
        {
            Data2.Connection.D_StaticWebService SWS = new Data2.Connection.D_StaticWebService();
            int iduser = SWS.GetUserByPrivateKey(K);

            if (iduser != 0)
            {
                Data2.Class.Struct_Cliente MyClient = Data2.Class.Struct_Cliente.GetClient(idc, iduser);
                if (MyClient != null)
                {
                    string R = Data2.Statics.Conversion.GetJasonFromObject <Data2.Class.Struct_Cliente>(MyClient);
                    return(Request.CreateResponse(HttpStatusCode.OK, R));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, "null"));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "null"));
            }
        }
Ejemplo n.º 4
0
        private void ConfigFields()
        {
            if (cmbprovincia.Items.Count == 0)
            {
                cmbprovincia.Items.Clear();
                List <Data2.Class.Struct_Provincia> LP = Data2.Class.Struct_Provincia.GetAll();
                Data2.Statics.Log.ADD(LP.Count.ToString(), this);
                if (LP != null && LP.Count > 0)
                {
                    for (int a = 0; a < LP.Count; a++)
                    {
                        ListItem LI = new ListItem(LP[a].getName(), LP[a].getName());

                        cmbprovincia.Items.Add(LI);
                    }
                }
            }

            DetalleCC.Visible = false;

            if (Request[KeyMOV] != null & Request[KeyValue] != null & Request[Keyidc] != null)
            {
                int     idc   = int.Parse(Request[Keyidc]);
                decimal mount = Data2.Statics.Conversion.GetDecimal(Request[KeyValue]);
                Data2.Class.Struct_Cliente SC = Data2.Class.Struct_Cliente.GetClient(idc, UserId);
                if (SC != null)
                {
                    SC.insertMovCliente(mount, Request[KeyMOV].ToUpper());
                    Response.Redirect(Request.RawUrl.Split('?')[0] + "?MSG=OK");
                }
            }

            if (Request["MSG"] != null)
            {
                MessageOK.Visible = true;
            }
            else
            {
                MessageOK.Visible = false;
            }

            if (Request[KeyVCC] != null && !IsPostBack)
            {
                Data2.Class.Struct_Cliente _Cliente = Data2.Class.Struct_Cliente.GetClient(int.Parse(Request[KeyVCC].ToString()), UserId);
                if (_Cliente != null)
                {
                    String DataCliente = "";

                    DetalleCC.Visible = true;
                    List <Data2.Class.Struct_DetalleCuentaCorriente> DCC = _Cliente.GetDetalleCC();
                    if (DCC != null)
                    {
                        decimal total = 0;
                        for (int a = 0; a < DCC.Count; a++)
                        {
                            string detalle;
                            string idfactura = "0";



                            switch (DCC[a].TIPOCC)
                            {
                            case Data2.Class.Struct_DetalleCuentaCorriente.TipoDetalleCC.Entrega:
                                detalle = "Entrega";
                                total   = total - DCC[a].Monto;
                                break;

                            case Data2.Class.Struct_DetalleCuentaCorriente.TipoDetalleCC.Factura:
                                detalle   = "Factura";
                                idfactura = DCC[a].IdFactura.ToString();
                                total     = total + DCC[a].Monto;
                                break;

                            case Data2.Class.Struct_DetalleCuentaCorriente.TipoDetalleCC.Inicializacion:
                                detalle = "Inicio";
                                total   = total + DCC[a].Monto;
                                break;

                            default: detalle = "Error";
                                break;
                            }
                            AddRowDetalleCC(DCC[a].Fecha.ToShortDateString(), detalle, idfactura, DCC[a].Monto.ToString("#.00"));
                        }
                        AddRowTotal("Total:", total.ToString("#.00"));
                    }
                }
            }


            if (Request[KeyIDC] != null && !IsPostBack)
            {
                Session.Remove(KeyIDC);
                Session.Add(KeyIDC, Request[KeyIDC].ToString());

                Data2.Class.Struct_Cliente SC = Data2.Class.Struct_Cliente.GetClient(int.Parse(Session[KeyIDC].ToString()), UserId);
                if (SC != null && !IsPostBack)
                {
                    txt_descuento.Text         = SC.DESCUENTO.ToString("#.00");
                    txt_dnicuilcuit.Text       = SC.DNI;
                    txt_domicilio.Text         = SC.DOMICILIO;
                    txt_email.Text             = SC.EMAIL;
                    txt_limite.Text            = SC.LIMITEDECREDITO.ToString("#.00");
                    txt_localidad.Text         = SC.LOCALIDAD;
                    txt_observaciones.Text     = SC.OBSERVACIONES;
                    txt_razonsocial.Text       = SC.RS;
                    cmbpais.SelectedValue      = SC.PAIS;
                    cmbprovincia.SelectedValue = SC.PROVINCIA;
                    cmbsituacion.SelectedValue = SC.TIPOIVA;
                    HF_EU.Value = SC.ID.ToString();
                }
            }
            else
            {
                HF_EU.Value = "0";
            }
        }