Beispiel #1
0
    public Vehicle CreateVehicle(string model, string color, int numDoors, string[] options = string[0])
    {
        Vehicle vehicle = null;
        if (model.Equals("Civic")) {
            // Ooh! My favorite!
            vehicle = new Civic();
            vehicle.Doors = numDoors;
            vehicle.Color = color;
            vehicle.Options = options;
        } else if (model.Equals("Accord")) {
            // Only comes in 4 doors. So, ignore numDoors.
            vehicle = new Accord();
            vehicle.Color = color;
            vehicle.Options = options;
        } else if (model.Equals("CR-V")) {
            // Only comes in 4 doors. So, ignore numDoors.
            vehicle = new CRV();
            vehicle.Color = color;
            vehicle.Options = options;
        } else {
            throw new InvalidArgumentException("Cannot make requested model for Honda");
        }

        return vehicle;
    }
Beispiel #2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         cryRpt.SetParameterValue(PARAMFACT, NUMFACT.Text);
         cryRpt.SetParameterValue("REMISEPARAM", Globals.convertDN(REMVAL.Text));
         cryRpt.SetParameterValue("TIMBREPARAM", Globals.convertDN(TIMVAL.Text));
         cryRpt.SetParameterValue("Profil_Adresse", PROFIL);
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Beispiel #3
0
        public reportes_CR(int emp)
        {
            InitializeComponent();
            rpt_empleados emple = new rpt_empleados();

            CRV.Refresh();
            CRV.RefreshReport();
            CRV.ReportSource = emple;
        }
Beispiel #4
0
        public reportes_CR(string ss)
        {
            InitializeComponent();
            rpt_edades CR = new rpt_edades();

            CR.DataDefinition.FormulaFields["edad"].Text = "3";
            //CR.SetDataSource(ss.ToList());

            CRV.Refresh();
            CRV.ReportSource = CR;
        }
Beispiel #5
0
    public ActionResult buildVehicle(string make, string model, string color, int numDoors, string[] options = string[0])
    {
        Vehicle vehicle = null;
        if (make.Equals("Honda")) {
            if (model.Equals("Civic")) {
                // Ooh! My favorite!
                vehicle = new Civic();
                vehicle.Doors = numDoors;
                vehicle.Color = color;
                vehicle.Options = options;
            } else if (model.Equals("Accord")) {
                // Only comes in 4 doors. So, ignore numDoors.
                vehicle = new Accord();
                vehicle.Color = color;
                vehicle.Options = options;
            } else if (model.Equals("CR-V")) {
                // Only comes in 4 doors. So, ignore numDoors.
                vehicle = new CRV();
                vehicle.Color = color;
                vehicle.Options = options;
            } else {
                throw new InvalidArgumentException("Cannot make requested model for Honda");
            }
        } else if (make.Equals("Chevrolet")) {
            if (model.Equals("Suburban")) {
                vehicle = new Suburban();
                vehicle.Doors = numDoors;
                vehicle.Color = color;
                vehicle.Options = options;
            } else if (model.Equals("Silverado")) {
                vehicle = new Silverado();
                vehicle.Doors = numDoors;
                vehicle.Color = color;
                vehicle.Options = options;
            } else {
                throw new InvalidArgumentException("Cannot make requested model for Chevrolet");
            }
        } else if (make.Equals("BMW")) {
            // Pompus luxury vehicle.
        } else if (make.Equals("Ferrari")) {
            // Not likely in my lifetime.
        } else if (make.Equals("Lamborghini")) {
            // I wish.
        }

        // Save.
        this.vehicleContext.Attach(vehicle);
        this.vehicleContext.SaveAll();

        // Display our newly created vehicle.
        return View("BuildVehicle", vehicle);
    }
Beispiel #6
0
 private void Button5_Click(object sender, EventArgs e)
 {
     try
     {
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = NUMFACT.Text;
         ParameterFieldDefinitions parameterFields          = cryRpt.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields[PARAMFACT];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
     try
     {
         DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();
         PdfRtfWordFormatOptions    formatOptions = new PdfRtfWordFormatOptions();
         NOMFICHJOINT = Nommail + " " + DateTime.Now.ToString("yyyy_MM_dd HH_mm_ss");
         diskFileDestinationOptions.DiskFileName = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         MyProject.Forms.Mail.chemin.Text        = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         ExportOptions exportOptions  = cryRpt.ExportOptions;
         ExportOptions exportOptions2 = exportOptions;
         exportOptions2.ExportDestinationType = ExportDestinationType.DiskFile;
         exportOptions2.ExportFormatType      = ExportFormatType.PortableDocFormat;
         exportOptions2.DestinationOptions    = diskFileDestinationOptions;
         exportOptions2.FormatOptions         = formatOptions;
         exportOptions2 = null;
         cryRpt.Export();
         MyProject.Forms.Mail.Show();
         MyProject.Forms.Mail.BringToFront();
         MyProject.Forms.Mail.pathT.Text = "C:\\SIGC utility\\Fichier joint\\" + NOMFICHJOINT + ".pdf";
         MyProject.Forms.Mail.AjoutFJ_Click(RuntimeHelpers.GetObjectValue(sender), e);
     }
     catch (Exception ex3)
     {
         ProjectData.SetProjectError(ex3);
         Exception ex4 = ex3;
         Interaction.MsgBox(ex4.ToString(), MsgBoxStyle.OkOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Beispiel #7
0
 public void Frm_Fact_Load(object sender, EventArgs e)
 {
     try
     {
         LB_Article.SelectedItem = "Profil Nb";
         if (Operators.CompareString(TYPEFACT, "D", false) == 0)
         {
             PARAMFACT    = "NUMDEVIS";
             TABLEFACT    = "DEVIS";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Devis.rpt";
             Label1.Text  = "Entrer Num Devis";
             Button1.Text = "Afficher Devis";
             Nommail      = "Devis";
             Text         = "Devis";
         }
         else if (Operators.CompareString(TYPEFACT, "F", false) == 0)
         {
             PARAMFACT    = "NUMTICKET";
             TABLEFACT    = "TICKET";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Facture.rpt";
             Label1.Text  = "Entrer Num Facture";
             Button1.Text = "Afficher Facture";
             Text         = "Facture";
             Nommail      = "Facture";
         }
         else if (Operators.CompareString(TYPEFACT, "TIC", false) == 0)
         {
             PARAMFACT    = "NUMTICKET";
             TABLEFACT    = "TICKET";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_Ticket.rpt";
             Label1.Text  = "Entrer Num Ticket";
             Button1.Text = "Afficher Ticket";
             Text         = "Ticket";
             Nommail      = "Ticket";
         }
         else if (Operators.CompareString(TYPEFACT, "BC", false) == 0)
         {
             PARAMFACT    = "NUMBC";
             TABLEFACT    = "BONC";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_BC.rpt";
             Label1.Text  = "Entrer Num Bon C.";
             Button1.Text = "Afficher Bon C.";
             Text         = "Bon Commande";
             Nommail      = "BC";
         }
         else if (Operators.CompareString(TYPEFACT, "BL", false) == 0)
         {
             PARAMFACT    = "NUMBL";
             TABLEFACT    = "BONL";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_BL.rpt";
             Label1.Text  = "Entrer Num Bon L.";
             Button1.Text = "Afficher Bon L.";
             Text         = "Bon livraison";
             Nommail      = "BL";
         }
         else if (Operators.CompareString(TYPEFACT, "DA", false) == 0)
         {
             PARAMFACT    = "NUMDEVIS";
             TABLEFACT    = "A_DEVIS";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_Devis.rpt";
             Label1.Text  = "Entrer Num Devis";
             Button1.Text = "Afficher Devis Achat";
             Text         = "Devis Achat";
             Nommail      = "Devis Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "BCA", false) == 0)
         {
             PARAMFACT    = "NUMBONC";
             TABLEFACT    = "A_BONC";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_BONC.rpt";
             Label1.Text  = "Entrer Num Bon C.";
             Button1.Text = "Afficher Bon C.";
             Text         = "Bon Commande Achat";
             Nommail      = "BC Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "BLA", false) == 0)
         {
             PARAMFACT    = "NUMBONL";
             TABLEFACT    = "A_BONL";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_BONL.rpt";
             Label1.Text  = "Entrer Num Bon L.";
             Button1.Text = "Afficher Bon L.";
             Text         = "Bon livraison Achat";
             Nommail      = "BL Achat";
         }
         else if (Operators.CompareString(TYPEFACT, "FA", false) == 0)
         {
             PARAMFACT    = "NUMFACT";
             TABLEFACT    = "A_FACTURE";
             CHEMINRPT    = "C:\\SIGC utility\\Reports\\Report_A_Facture.rpt";
             Label1.Text  = "Entrer Num Facture";
             Button1.Text = "Afficher Facture";
             Text         = "Facture Achat";
             Nommail      = "Facture Achat";
         }
         if (Globals.conn.State == ConnectionState.Closed)
         {
             Globals.conn.Open();
         }
         Globals.cmd.Connection  = Globals.conn;
         Globals.cmd.CommandText = "select REMISE,TIMBRE from " + TABLEFACT + " where NUM_FACT ='" + NUMFACT.Text + "'";
         MySqlDataReader mySqlDataReader = Globals.cmd.ExecuteReader();
         Globals.cmd.CommandType = CommandType.Text;
         if (mySqlDataReader.Read())
         {
             string text = mySqlDataReader["REMISE"].ToString();
             if (string.IsNullOrEmpty(text) | decimal.Compare(Globals.convertDN(text), decimal.Zero) == 0)
             {
                 REMISE.Checked = false;
                 REMVAL.Visible = false;
                 REMVAL.Text    = "0";
             }
             else
             {
                 REMISE.Checked = true;
                 REMVAL.Visible = true;
                 REMVAL.Text    = text;
             }
             string text2 = mySqlDataReader["TIMBRE"].ToString();
             if (string.IsNullOrEmpty(text2) | decimal.Compare(Globals.convertDN(text2), decimal.Zero) == 0)
             {
                 TIMBRE.Checked = false;
                 TIMVAL.Visible = false;
                 TIMVAL.Text    = "0";
             }
             else
             {
                 TIMBRE.Checked = true;
                 TIMVAL.Visible = true;
                 TIMVAL.Text    = text2;
             }
         }
         mySqlDataReader.Close();
         mySqlDataReader.Dispose();
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
         cryRpt.Load(CHEMINRPT);
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = true;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = cryRpt.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         cryRpt.SetParameterValue(PARAMFACT, NUMFACT.Text);
         if (Operators.CompareString(TYPEFACT, "TIC", false) != 0)
         {
             cryRpt.SetParameterValue("REMISEPARAM", Globals.convertDN(REMVAL.Text));
             cryRpt.SetParameterValue("TIMBREPARAM", Globals.convertDN(TIMVAL.Text));
             cryRpt.SetParameterValue("Profil_Adresse", PROFIL);
         }
         CRV.ReportSource = cryRpt;
         CRV.Refresh();
         Nom_mail.Text = Nommail;
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Beispiel #8
0
 private void FrmFacture_Load(object sender, EventArgs e)
 {
     try
     {
         ReportDocument reportDocument = new ReportDocument();
         reportDocument.Load("C:\\SIGC utility\\Reports\\Report_Facture.rpt");
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = false;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = reportDocument.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         if (Operators.CompareString(NUMFACT.Text, "", false) != 0)
         {
             parameterDiscreteValue.Value = NUMFACT.Text;
         }
         else
         {
             parameterDiscreteValue.Value = "0";
         }
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["NUMTICKET"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Beispiel #9
0
 private void Stat_Stock_Load(object sender, EventArgs e)
 {
     try
     {
         MySqlCommand     mySqlCommand     = new MySqlCommand();
         MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand);
         DataSet          dataSet          = new DataSet();
         if (Globals.conn.State == ConnectionState.Closed)
         {
             Globals.conn.Open();
         }
         mySqlCommand.Connection  = Globals.conn;
         mySqlCommand.CommandText = "select distinct REFART from ARTICLE_D";
         mySqlDataAdapter.Fill(dataSet, "list");
         AutoCompleteStringCollection autoCompleteStringCollection = new AutoCompleteStringCollection();
         ReportDocument reportDocument;
         ConnectionInfo connectionInfo;
         Tables         tables;
         checked
         {
             int num = dataSet.Tables[0].Rows.Count - 1;
             for (int i = 0; i <= num; i++)
             {
                 autoCompleteStringCollection.Add(dataSet.Tables[0].Rows[i]["REFART"].ToString());
             }
             REFART.AutoCompleteSource       = AutoCompleteSource.CustomSource;
             REFART.AutoCompleteCustomSource = autoCompleteStringCollection;
             REFART.AutoCompleteMode         = AutoCompleteMode.Suggest;
             reportDocument = new ReportDocument();
             reportDocument.Load("C:\\SIGC utility\\Reports\\Report_Suivi_Stock.rpt");
             connectionInfo = new ConnectionInfo();
             ConnectionInfo connectionInfo2 = connectionInfo;
             connectionInfo2.ServerName         = "erp_db";
             connectionInfo2.DatabaseName       = "";
             connectionInfo2.UserID             = Globals.BDUSER;
             connectionInfo2.Password           = Globals.BDPW;
             connectionInfo2.IntegratedSecurity = false;
             connectionInfo2 = null;
             TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
             TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
             tables = reportDocument.Database.Tables;
         }
         IEnumerator enumerator = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table          table          = (Table)enumerator.Current;
                 TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = REFART.Text;
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["REFART_P"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         base.WindowState = FormWindowState.Maximized;
         ReportDocument reportDocument = new ReportDocument();
         reportDocument.Load("C:\\SIGC utility\\Reports\\Report_perso_imprim.rpt");
         ConnectionInfo connectionInfo  = new ConnectionInfo();
         ConnectionInfo connectionInfo2 = connectionInfo;
         connectionInfo2.ServerName         = "erp_db";
         connectionInfo2.DatabaseName       = "";
         connectionInfo2.UserID             = Globals.BDUSER;
         connectionInfo2.Password           = Globals.BDPW;
         connectionInfo2.IntegratedSecurity = false;
         connectionInfo2 = null;
         TableLogOnInfos tableLogOnInfos = new TableLogOnInfos();
         TableLogOnInfo  tableLogOnInfo  = new TableLogOnInfo();
         Tables          tables          = reportDocument.Database.Tables;
         IEnumerator     enumerator      = default(IEnumerator);
         try
         {
             enumerator = tables.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 Table table = (Table)enumerator.Current;
                 tableLogOnInfo = table.LogOnInfo;
                 tableLogOnInfo.ConnectionInfo = connectionInfo;
                 table.ApplyLogOnInfo(tableLogOnInfo);
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         ParameterValues        parameterValues        = new ParameterValues();
         ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
         parameterDiscreteValue.Value = CODE_PERSO.Text;
         ParameterFieldDefinitions parameterFields          = reportDocument.DataDefinition.ParameterFields;
         ParameterFieldDefinition  parameterFieldDefinition = parameterFields["code_perso"];
         parameterValues = parameterFieldDefinition.CurrentValues;
         parameterValues.Clear();
         parameterValues.Add(parameterDiscreteValue);
         parameterFieldDefinition.ApplyCurrentValues(parameterValues);
         CRV.ReportSource = reportDocument;
         CRV.Refresh();
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         Exception ex2 = ex;
         MessageBox.Show(ex2.Message);
         ProjectData.ClearProjectError();
     }
     finally
     {
         if (Globals.conn != null)
         {
             Globals.conn.Close();
         }
     }
 }
Beispiel #11
0
        public reportes_CR(string empresa, string localidad, string cuit, string estudio, string desde, string hasta, string domicilio,
                           string per_pagado, string per_NO_pagado, string per_NO_declarado, string per_total,
                           string aporte_ley, string aporte_socio, string total_aportes, string depositado, string intereses,
                           string total_capital, string total_deuda, double cuit2

                           )
        //txt_actas_pagados.Text, txt_actas_no_pagados.Text, txt_actas_no_declarados.Text,  txt_actas_total_periodos.Text,
        //txt_actas_aporte2.Text, txt_actas_aportes_socio.Text, txt_actas_depositado.Text, txt_actas_intereses.Text,
        //txt_actas_total_con_interes.Text
        {
            InitializeComponent();
            rpt_consulta_empresa CR = new rpt_consulta_empresa();


            //System.Configuration. .ConfigurationSettings.AppSettings["ConexionCadena"].ToString();

            //System.Configuration. .ConfigurationSettings.AppSettings["ConexionCadena"].ToString();
            //CR.DataSourceConnections[0].SetConnection("192.168.1.253", "sindicato", false);
            //CR.DataSourceConnections[0].SetLogon("sec", "nosenose101");

            //CR.DataSourceConnections = db_sindicato.impresion_comprobante;
            CR.DataDefinition.FormulaFields["empresa"].Text          = "'" + empresa + "'";
            CR.DataDefinition.FormulaFields["localidad"].Text        = "'" + localidad + "'";
            CR.DataDefinition.FormulaFields["cuit"].Text             = "'" + cuit + "'";
            CR.DataDefinition.FormulaFields["estudio"].Text          = "'" + estudio + "'";
            CR.DataDefinition.FormulaFields["desde"].Text            = "'" + desde + "'";
            CR.DataDefinition.FormulaFields["hasta"].Text            = "'" + hasta + "'";//"'" + hasta.Substring(0, 2) + "-" + hasta.Substring(3, 8) + "-" + hasta.Substring(9, 1) + "'";
            CR.DataDefinition.FormulaFields["domicilio"].Text        = "'" + domicilio + "'";
            CR.DataDefinition.FormulaFields["per_pagado"].Text       = "'" + per_pagado + "'";
            CR.DataDefinition.FormulaFields["per_NO_pagado"].Text    = "'" + per_NO_pagado + "'";
            CR.DataDefinition.FormulaFields["per_NO_declarado"].Text = "'" + per_NO_declarado + "'";
            CR.DataDefinition.FormulaFields["per_total"].Text        = "'" + per_total + "'";
            CR.DataDefinition.FormulaFields["aporte_ley"].Text       = "'" + aporte_ley + "'";
            CR.DataDefinition.FormulaFields["aporte_total"].Text     = "'" + total_aportes + "'";
            CR.DataDefinition.FormulaFields["aporte_socio"].Text     = "'" + aporte_socio + "'";
            CR.DataDefinition.FormulaFields["depositado"].Text       = "'" + depositado + "'";
            CR.DataDefinition.FormulaFields["intereses"].Text        = "'" + intereses + "'";
            CR.DataDefinition.FormulaFields["capital"].Text          = "'" + total_capital + "'";
            CR.DataDefinition.FormulaFields["total_deuda"].Text      = "'" + total_deuda + "'";

            var actas_involucradas = (from act in db_sindicato.ACTAS
                                      where act.CUIT == Convert.ToInt64(cuit2)
                                      select new
            {
                Fecha = String.Format("{0:d}", act.DESDE),                          // act.FECHA == null ? "" :  act.FECHA.ToString(),
                Acta = Convert.ToInt64(act.ACTA).ToString(),                        // act.ACTA == null ? "" : act.ACTA.ToString(),//.ToString(),
                //cuit = act.CUIT.ToString() ,
                Desde = String.Format("{0:MM/yyyy}", act.DESDE),                    // act.DESDE.Value.Month.ToString() + "/" + act.DESDE.Value.Year.ToString() ,
                Hasta = String.Format("{0:MM/yyyy}", act.HASTA),                    // act.HASTA.Value.Month.ToString() + "/" + act.HASTA.Value.Year.ToString() ,
                Deudatotal = String.Format("{0:C}", act.DEUDATOTAL),
                Cobradototalmente = act.COBRADOTOTALMENTE == null ? "NO" : act.COBRADOTOTALMENTE,
                Inspector = act.INSPECTOR
            }).ToList();

            CR.Subreports[0].SetDataSource(actas_involucradas);

            var act_ = actas_involucradas.ToList();
            var comprobantes_actas = (from comp in db_sindicato.COBROS
                                      where comp.CUIT == Convert.ToDouble(cuit2)
                                      select new
            {
                //cobro_id = comp.Id,
                //cuota = (comp.CONCEPTO == "2") ? (comp.CUOTAX.ToString() + " de " + comp.CANTIDAD_CUOTAS.ToString()) : ("Anticipo"),
                //fecha_venc = comp.FECHA_VENC,
                acta = comp.ACTA,
                FECHARECAUDACION = comp.FECHARECAUDACION,
                RECIBO = comp.RECIBO,
                TOTAL = comp.TOTAL
            }).ToList();


            foreach (var item in comprobantes_actas)
            {
                impresion_actas comp_act = new impresion_actas();
                comp_act.num3    = Convert.ToDecimal(item.acta);
                comp_act.fecha1  = item.FECHARECAUDACION;
                comp_act.num1    = Convert.ToDecimal(item.RECIBO);
                comp_act.importe = Convert.ToDecimal(item.TOTAL);
                db_sindicato.impresion_actas.InsertOnSubmit(comp_act);
                db_sindicato.SubmitChanges();
            }

            //CR.Subreports[1].SetDataSource(db_sindicato.impresion_actas);
            //CR.Subreports[1].Refresh();
            CRV.ReportSource = CR;

            CRV.RefreshReport();
        }