public void Cargar_Arbol_Empleado() { Service.EmpleadoCentroCosto ECC = new Service.EmpleadoCentroCosto(); if (MyStuff.UsaWCF == true) { DS_Empleado = objWCF.Arbol_Empleado(); } else { DS_Empleado = ECC.Arbol_Empleado(); } trv_ctrl_Empleado.CargaDS(DS_Empleado); trv_ctrl_Empleado.ValueMember = "iCodEmpleado"; trv_ctrl_Empleado.DisplayMember = "NombreCompleto"; }
public string Obtiene_Nombre_Empleado(int iCodEmpleadoVal) { string resultado = string.Empty; if (iCodEmpleadoVal > 0) { if (DS_Empleado.Tables[0].Rows.Count > 0) { foreach (DataRow row in DS_Empleado.Tables[0].Rows) { if (Convert.ToString(row[1]).Trim() == Convert.ToString(iCodEmpleadoVal)) { //blnEncontrado = true; resultado = Convert.ToString(row[0]).TrimEnd(); break; } } } Service.EmpleadoCentroCosto ECC = new Service.EmpleadoCentroCosto(); if (MyStuff.UsaWCF == true) { DS_Empleado_CentroCosto = objWCF.Recupera_Empleado_CentroCosto(iCodEmpleadoVal); } else { DS_Empleado_CentroCosto = ECC.Recupera_Empleado_CentroCosto(iCodEmpleadoVal); } if (DS_Empleado_CentroCosto.Tables[0].Rows.Count > 0) { iCodEmpleadoCentroCosto = Convert.ToInt32(DS_Empleado_CentroCosto.Tables[0].Rows[0].ItemArray[0].ToString().Trim()); lueCentroCosto.EditValue = DS_Empleado_CentroCosto.Tables[0].Rows[0].ItemArray[1].ToString().Trim(); } else { iCodEmpleadoCentroCosto = 0; lueCentroCosto.EditValue = lueCentroCosto.Properties.NullText; } } return(resultado); }
private void GuardarToolStripMenuItem_Click(object sender, EventArgs e) { try { if (iCodEmpleadoCentroCosto > 0) { Service.EmpleadoCentroCosto ECC = new Service.EmpleadoCentroCosto(); if (MyStuff.UsaWCF == true) { objWCF.Modifica_Empleado_CentroCosto(iCodEmpleadoCentroCosto, lueCentroCosto.EditValue.ToString().Trim()); } else { ECC.Modifica_Empleado_CentroCosto(iCodEmpleadoCentroCosto, lueCentroCosto.EditValue.ToString().Trim()); } } else { Service.EmpleadoCentroCosto ECC = new Service.EmpleadoCentroCosto(); if (MyStuff.UsaWCF == true) { objWCF.Graba_Empleado_CentroCosto(iCodEmpleado, lueCentroCosto.EditValue.ToString().Trim()); } else { ECC.Graba_Empleado_CentroCosto(iCodEmpleado, lueCentroCosto.EditValue.ToString().Trim()); } } Cargar_Arbol_Empleado(); } catch (Exception) { MessageBox.Show("Datos Guardados Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } }