public override String CreateFile(DataTable data) { String fileName = FileSettings.fileName("CNBVInusuales"); using (StreamWriter file = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath(FileSettings.filePath + fileName), false)) { for (int i = 0; i < data.Rows.Count; i++) { CNBVInusualesBean information = new CNBVInusualesBean(true); //the class validate the fields and set its correct format information.PeriodoReporte = DateTime.Now.ToString("yyyyMMdd"); information.Folio = Convert.ToString(1 + i); information.OrganoSupervisor = data.Rows[i][4].ToString(); information.ClaveSujetoObligado = data.Rows[i][5].ToString(); information.Localidad = data.Rows[i][6].ToString(); information.CodigoPostal = data.Rows[i][7].ToString(); information.TipoOperacion = data.Rows[i][8].ToString(); information.InstrumentoMonetario = data.Rows[i][9].ToString(); information.NumeroCuenta = data.Rows[i][10].ToString(); information.Monto = data.Rows[i][11].ToString().Trim() != String.Empty ? Convert.ToDecimal(data.Rows[i][11].ToString()) : 0; information.Moneda = data.Rows[i][12].ToString(); information.FechaOperacion = data.Rows[i][13].ToString(); information.FechaDeteccion = data.Rows[i][14].ToString(); information.Nacionalidad = data.Rows[i][15].ToString(); information.TipoPersona = data.Rows[i][16].ToString(); information.RazonSocial = data.Rows[i][17].ToString(); information.Nombre = data.Rows[i][18].ToString(); information.ApellidoPaterno = data.Rows[i][19].ToString(); information.ApellidoMaterno = data.Rows[i][20].ToString(); information.RFC = data.Rows[i][21].ToString(); information.CURP = data.Rows[i][22].ToString(); information.FechaNacimiento = data.Rows[i][23].ToString(); information.Domicilio = data.Rows[i][24].ToString(); information.Colonia = data.Rows[i][25].ToString(); information.Ciudad = data.Rows[i][26].ToString(); information.Telefono = data.Rows[i][27].ToString(); information.ActividadEconomica = data.Rows[i][28].ToString(); information.ConsecutivoCuentas = data.Rows[i][29].ToString(); information.NumeroCuentaC = data.Rows[i][30].ToString(); information.ClaveSujetoObligadoC = data.Rows[i][31].ToString(); information.NombreTitularCuenta = data.Rows[i][32].ToString(); information.ApellidoPaternoC = data.Rows[i][33].ToString(); information.ApellidoMaternoC = data.Rows[i][34].ToString(); information.DescripcionOperacion = data.Rows[i][35].ToString(); information.Razones = data.Rows[i][36].ToString(); file.Write(information.ToString()); file.Write(Environment.NewLine); } } return(fileName); }
protected void btnBuscarCliente_Click(object sender, ImageClickEventArgs e) { try { CNBVInusualesBean data = ReportsOperations.Get(txtNumCliente.Text.Trim()); Session["Object"] = data; ddlNumControl.Items.Clear(); txtCliente.Text = data.RazonSocial; LlenarDropDowns.NumeroControl(ddlNumControl, txtNumCliente.Text.Trim()); } catch (Exception ex) { throw ex; } }
protected void btnReportar_Click(object sender, EventArgs e) { try { CNBVInusualesBean data = Session["Object"] as CNBVInusualesBean; data.NumeroCuenta = ddlNumControl.SelectedItem.Text; data.Monto = Convert.ToDecimal(txtMonto.Text.Trim()); data.Moneda = ddlMoneda.SelectedItem.Value; data.InstrumentoMonetario = ddlInstumentoMonetario.SelectedItem.Value; data.TipoOperacion = ddlTipoOperacion.SelectedItem.Value; data.DescripcionOperacion = ddlDescripcionOperacion.SelectedItem.Text; data.Razones = txtCausa.Text.Trim(); ReportsOperations.Save(data, rblTipoReporte.SelectedValue); LimpiarCampos(); MostarMensaje(true); } catch (Exception ex) { MostarMensaje(false); throw ex; } }
public static void Save(CNBVInusualesBean data, String tipoReporte) { try { String query = String.Format(@"INSERT INTO xCnbvSOFOMES (FechaOperacion, ApellidoPaterno1, ApellidoMaterno1, Nombre, Domicilio, Ciudad, Colonia, Telefono, FechaNacCons, Nacionalidad, RFC, CURP, Localidad, RazConsInusual, TipoReporte, Moneda, InstrumentoMon, TipoOperacion, DescrOpera, RazonSocial, TipoPersona, OrganoSup, ClaveSujOb1, CodigoPostSuc, NumCueConOpe, Monto, FechaDetOper, ActividadEco, PeriodoRep) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}','{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}', '{21}', '{22}', '{23}', '{24}', {25}, '{26}', '{27}', '{28}')", DateTime.Now.ToString("yyyyMMdd"), data.ApellidoPaterno, data.ApellidoMaterno, data.Nombre, data.Domicilio, data.Ciudad, data.Colonia, data.Telefono, data.FechaNacimiento, data.Nacionalidad, data.RFC, data.CURP, data.Localidad, data.Razones, tipoReporte, data.Moneda, data.InstrumentoMonetario, data.TipoOperacion, data.DescripcionOperacion, data.RazonSocial, data.TipoPersona, data.OrganoSupervisor, data.ClaveSujetoObligado, /*data.Localidad , */ data.CodigoPostal, data.NumeroCuenta, data.Monto, data.FechaDeteccion, data.ActividadEconomica, DateTime.Now.ToString("yyyyMM")); DataBaseSettings db = new DataBaseSettings(); db.ExecuteQuery(query); } catch (Exception ex) { throw ex; } }
public static CNBVInusualesBean Get(String cusID) { CNBVInusualesBean data = new CNBVInusualesBean(true); try { String query = String.Format(@"select case when D.DESCR = 'MEXICO' then '1' else '2' end as 'Nacionalidad', case when A.clave <> '9' then '1' else '2' end AS 'TipoPersona', C.OrganoSupervisor, C.ClaveSujetoObligado, C.Localidad, C.CodigoPostal, A.[RazonSocial], A.[Nombre], A.[ApellidoPaterno], A.[ApellidoMaterno], A.[taxlocid] RFC, A.[CURP], --[FechaNacCons], A.[Domicilio], A.[Colonia], A.[Ciudad], A.[Phone] Telefono, AP.new_ClaveSITI from xDatosGenerales C, xSOAddress A LEFT JOIN PaymentsCustomer B ON A.CUSTID = B.PKCUSTOMERSL LEFT OUTER JOIN COUNTRY D ON A.COUNTRY = D.CountryID LEFT JOIN PaymentsOportunity PO on B.PKCustomer = PO.FKCliente LEFT JOIN [HERMES].[CREDIJAL_MSCRM].dbo.Opportunity O ON O.opportunityID = PO.PKOportunity LEFT JOIN [HERMES].[CREDIJAL_MSCRM].dbo.new_ActividadPreponderante AP ON AP.new_actividadpreponderanteId = O.new_actividadpreponderante where A.custid = '{0}'", cusID); DataBaseSettings db = new DataBaseSettings(); DataTable aux = db.GetDataTable(query); if (aux.Rows.Count > 0) { data.Nacionalidad = aux.Rows[0]["Nacionalidad"] != DBNull.Value ? aux.Rows[0]["Nacionalidad"].ToString() : String.Empty; data.RazonSocial = aux.Rows[0]["RazonSocial"] != DBNull.Value ? aux.Rows[0]["RazonSocial"].ToString() : String.Empty; data.Nombre = aux.Rows[0]["Nombre"] != DBNull.Value ? aux.Rows[0]["Nombre"].ToString() : String.Empty; data.ApellidoPaterno = aux.Rows[0]["ApellidoPaterno"] != DBNull.Value ? aux.Rows[0]["ApellidoPaterno"].ToString() : String.Empty; data.ApellidoMaterno = aux.Rows[0]["ApellidoMaterno"] != DBNull.Value ? aux.Rows[0]["ApellidoMaterno"].ToString() : String.Empty; data.RFC = aux.Rows[0]["RFC"] != DBNull.Value ? aux.Rows[0]["RFC"].ToString() : String.Empty; data.CURP = aux.Rows[0]["CURP"] != DBNull.Value ? aux.Rows[0]["CURP"].ToString() : String.Empty; data.Domicilio = aux.Rows[0]["Domicilio"] != DBNull.Value ? aux.Rows[0]["Domicilio"].ToString() : String.Empty; data.Colonia = aux.Rows[0]["Colonia"] != DBNull.Value ? aux.Rows[0]["Colonia"].ToString() : String.Empty; data.Ciudad = aux.Rows[0]["Ciudad"] != DBNull.Value ? aux.Rows[0]["Ciudad"].ToString() : String.Empty; data.Telefono = aux.Rows[0]["Telefono"] != DBNull.Value ? aux.Rows[0]["Telefono"].ToString() : String.Empty; // data.TipoPersona = aux.Rows[0]["TipoPersona"] != DBNull.Value ? aux.Rows[0]["TipoPersona"].ToString() : String.Empty; data.OrganoSupervisor = aux.Rows[0]["OrganoSupervisor"] != DBNull.Value ? aux.Rows[0]["OrganoSupervisor"].ToString() : String.Empty; data.ClaveSujetoObligado = aux.Rows[0]["ClaveSujetoObligado"] != DBNull.Value ? aux.Rows[0]["ClaveSujetoObligado"].ToString() : String.Empty; data.Localidad = aux.Rows[0]["Localidad"] != DBNull.Value ? aux.Rows[0]["Localidad"].ToString() : String.Empty; data.CodigoPostal = aux.Rows[0]["CodigoPostal"] != DBNull.Value ? aux.Rows[0]["CodigoPostal"].ToString() : String.Empty; // data.FechaOperacion = DateTime.Now.ToString("yyyyMMdd"); data.FechaDeteccion = DateTime.Now.ToString("yyyyMMdd"); data.ActividadEconomica = aux.Rows[0]["new_ClaveSITI"] != DBNull.Value ? aux.Rows[0]["new_ClaveSITI"].ToString() : String.Empty; } } catch (Exception ex) { throw ex; } return(data); }