/// <summary> /// Envia los cambios del sy_EmpresasDataset a la base de datos. /// </summary> public static void Update(sy_EmpresasDataset dataSet) { ApplicationAssert.Check(dataSet != null, "El argumento dataSet no debe ser nulo.", ApplicationAssert.LineNumber); ApplicationAssert.Check(dataSet.sy_Empresas.Rows.Count > 0, "La tabla dataSet.sy_EmpresasDataTable debe poseer alguna fila.", ApplicationAssert.LineNumber); mz.erp.dataaccess.sy_Empresas.Update(dataSet); }
//Fin Tarea 0000122 public LogIn() { InitializeComponent(); //mzCEUsuarios.FillFromDataSource(mz.erp.businessrules.sy_Usuarios.GetList().sy_Usuarios, "IdUsuario","Nombre",100,"ID","Nombre","Nombre"); //Cristian Tarea 00000122 // ApplicationConfiguration.updateConnectionString((String)comboEmpresas.Value); //mzCEUsuarios.FillFromDataSource(mz.erp.businessrules.sy_Usuarios.GetListActivos(), "IdUsuario","Nombre",100,"ID","Nombre","Nombre"); sy_EmpresasDataset _data = sy_Empresas.GetList(); comboEmpresas.Items.Clear(); comboPerfiles.Items.Clear(); multiEmpresa = Variables.GetValueBool("Login.MultiEmpresa"); int baseActual = 0; foreach (sy_EmpresasDataset.sy_EmpresasRow _row in _data.sy_Empresas.Rows) { comboEmpresas.Items.Add(_row.BaseDeDatos, _row.Descripcion); if (ApplicationConfiguration.GetDatabase().Equals(_row.BaseDeDatos)) { baseActual = (comboEmpresas.Items.Count - 1); } } if (multiEmpresa) { if (comboEmpresas.Items.Count > 0) { if (comboEmpresas.Items.Count == 1) { mzCEUsuarios.Focus(); mzCEUsuarios.Select(); } else { comboEmpresas.Focus(); comboEmpresas.Select(); } } } //end if principal else { mzCEUsuarios.FillFromDataSource(mz.erp.businessrules.sy_Usuarios.GetListActivos(), "IdUsuario", "Nombre", 100, "ID", "Nombre", "Nombre"); comboEmpresas.SelectedIndex = baseActual; mzCEUsuarios.Focus(); mzCEUsuarios.Select(); } //fin Tarea 00000122 }
//Cristian Tarea 0000122 20110505 private long recuperarIdEmpresa(String BDEmpresa) { using (sy_EmpresasDataset _data = sy_Empresas.GetList()) { foreach (sy_EmpresasDataset.sy_EmpresasRow _row in _data.sy_Empresas.Rows) { if (_row.BaseDeDatos.Equals(BDEmpresa)) { ; } { return(_row.IdEmpresa); } } return(0); } }
private void mzCEUsuarios_ValueChanged(object sender, System.EventArgs e) { //Cristian Tarea 0000122 20110505 comboPerfiles.Items.Clear(); long idEmpresa = 1; if (multiEmpresa && !comboEmpresas.Text.Equals(String.Empty) && (string)mzCEUsuarios.Value != string.Empty) { idEmpresa = this.recuperarIdEmpresa((String)comboEmpresas.Value); } else { using (sy_EmpresasDataset _data = sy_Empresas.GetList()) { /* * comboEmpresas.Items.Clear(); * comboPerfiles.Items.Clear(); * int baseActual = 0; * foreach (sy_EmpresasDataset.sy_EmpresasRow _row in _data.sy_Empresas.Rows) * { * comboEmpresas.Items.Add(_row.BaseDeDatos, _row.Descripcion); * if (ApplicationConfiguration.GetDatabase().Equals(_row.BaseDeDatos)) { baseActual = (int)_row.IdEmpresa; } * } * if (comboEmpresas.Items.Count > 0) * { * comboEmpresas.SelectedIndex = baseActual; * } */ } }//End Else using (sy_PerfilesDataset _data = sy_Perfiles.GetList(idEmpresa, (string)mzCEUsuarios.Value)) { foreach (sy_PerfilesDataset.sy_PerfilesRow _row in _data.sy_Perfiles.Rows) { comboPerfiles.Items.Add(_row.IdPerfil, _row.Descripcion); } if (comboPerfiles.Items.Count > 0) { comboPerfiles.SelectedIndex = 0; } } //Fin Tarea 00000122 }
private void editUserName_Leave(object sender, System.EventArgs e) { using (sy_EmpresasDataset _data = sy_Empresas.GetList()) { comboEmpresas.Items.Clear(); comboPerfiles.Items.Clear(); foreach (sy_EmpresasDataset.sy_EmpresasRow _row in _data.sy_Empresas.Rows) { comboEmpresas.Items.Add(_row.IdEmpresa, _row.Descripcion); } if (comboEmpresas.Items.Count > 0) { comboEmpresas.SelectedIndex = 0; } } }
public static sy_EmpresasDataset GetList(string IdUsuario) { sy_EmpresasDataset data = new sy_EmpresasDataset(); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.TableMappings.Add("Table", "sy_Empresas"); SqlCommand cmd = new SqlCommand("Pr_sy_Empresas_GetList_By_Usuario", dbhelper.Connection.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdUsuario", SqlDbType.VarChar)); cmd.Parameters["@IdUsuario"].Value = IdUsuario; adapter.SelectCommand = cmd; adapter.Fill(data); return(data); }
public static sy_EmpresasDataset.sy_EmpresasRow GetByPk(long IdEmpresa) { sy_EmpresasDataset data = new sy_EmpresasDataset(); SqlCommand cmd = new SqlCommand("Pr_sy_Empresas_GetByPk", dbhelper.Connection.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdEmpresa", SqlDbType.BigInt)); cmd.Parameters["@IdEmpresa"].Value = IdEmpresa; SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.TableMappings.Add("Table", "sy_Empresas"); adapter.Fill(data); if (data.sy_Empresas.Rows.Count == 1) { return((sy_EmpresasDataset.sy_EmpresasRow)data.sy_Empresas.Rows[0]); } return(null); }
public static sy_EmpresasDataset GetList() { sy_EmpresasDataset data = new sy_EmpresasDataset(); return(( sy_EmpresasDataset )GetList(data)); }
public static void Update(sy_EmpresasDataset dataSet) { Update(dataSet.sy_Empresas); }