コード例 #1
0
ファイル: BusinessLogicTest.cs プロジェクト: ramirobr/DQBase
 public void ObtenerCicloVentasTest()
 {
     BusinessLogic target = new BusinessLogic(); // TODO: Initialize to an appropriate value
     DateTime fechaInicio = new DateTime(2008,03,1); // TODO: Initialize to an appropriate value
     DateTime fechaFin = new DateTime(2008,03,31); // TODO: Initialize to an appropriate value
     List<GetCicloVentasResult> expected = null; // TODO: Initialize to an appropriate value
     List<GetCicloVentasResult> actual;
     actual = target.ObtenerCicloVentas(fechaInicio, fechaFin);
     Assert.AreNotEqual(expected, actual);
 }
コード例 #2
0
        private void BindGrid(bool loadFromSession)
        {
            try
            {
                List<GetCicloVentasResult> ciclos = null;
                if (loadFromSession)
                {
                    ciclos = Session["ciclos"] as List<GetCicloVentasResult>;
                }
                else
                {
                    IVentas bdd = new BusinessLogic();
                    DateTime fechaInicio;
                    DateTime fechaFin;
                    ListItem selectedItem;
                    int mes = 0;
                    int year = 0;
                    if (!string.IsNullOrEmpty(ddlPeriodo.SelectedValue))
                    {
                        selectedItem = ddlPeriodo.SelectedItem;
                        mes = int.Parse(selectedItem.Value);
                        year = int.Parse(selectedItem.Text.Split('-').Where(val => !string.IsNullOrEmpty(val)).ToArray()[1]);
                    }
                    else
                        throw new Exception("Seleccione un mes");
                    FechasDelMes(mes, year, out fechaInicio, out fechaFin);
                    ciclos = bdd.ObtenerCicloVentas(fechaInicio, fechaFin);
                    Session.Add("ciclos", ciclos);
                }
                GridCiclos.DataSource = ciclos;
                GridCiclos.DataBind();

                if (ciclos == null || ciclos.Count ==0)
                {
                    lblError.Visible = true;
                    lblError.Text = "No existen ventas subidas";
                    lblError.ForeColor = Color.Green;
                    return;
                }
                btnPublicar.Visible = true;
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }