private void LoadData() { OperationResult objOperationResult = new OperationResult(); //Llenado de combos Utils UtilComboBox = new Utils(); string Mode = Request.QueryString["Mode"].ToString(); int GroupId = -1, ParameterId = -1; if (Request.QueryString["i_GroupId"] != null) { GroupId = int.Parse(Request.QueryString["i_GroupId"].ToString()); } if (Request.QueryString["i_ParameterId"] != null) { ParameterId = int.Parse(Request.QueryString["i_ParameterId"].ToString()); } ViewState["strFilterExpression"] = string.Format("i_GroupId={0} && i_IsDeleted==0", ParameterId); if (Mode == "Edit") { // Obtener el usuario autenticado int intUserPersonId = ((ClientSession)Session["objClientSession"]).i_SystemUserId; // Bloquear algunos campos txtParameterId.Enabled = false; txtDescription.Enabled = false; // Get the Entity Data systemparameterDto objEntity = _objBL.GetSystemParameter(ref objOperationResult, GroupId, ParameterId); // Save the entity on the session Session["objEntity"] = objEntity; // Show the data on the form txtParameterId.Text = objEntity.i_ParameterId.ToString(); txtDescription.Text = objEntity.v_Value1; BindGrid(); } }
private void btnOK_Click(object sender, EventArgs e) { if (cboMedico.SelectedValue.ToString() == "-1") { MessageBox.Show("Seleccionar un médico tratante", " ¡ VALIDACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (_auxiliaryExams == null) { _auxiliaryExams = new List <ServiceComponentList>(); } // Save ListView / recorrer la lista de examenes seleccionados foreach (ListViewItem item in lvExamenesSeleccionados.Items) { var fields = item.SubItems; var ComponentId = fields[1].Text.Split('|'); var NombreComponente = fields[0].Text.Split('|'); MedicalExamBL objComponentBL = new MedicalExamBL(); componentDto objComponentDto = new componentDto(); OperationResult objOperationResult = new OperationResult(); foreach (var scid in ComponentId) { var conCargoA = -1; if (_type == "Hospi") { var oFrmType = new frmType(); oFrmType.ShowDialog(); if (oFrmType._conCargoA == "Médico") { conCargoA = 1; } else { conCargoA = 2; } } objComponentDto = objComponentBL.GetMedicalExam(ref objOperationResult, scid); SystemParameterBL oSp = new SystemParameterBL(); var o = oSp.GetSystemParameter(ref objOperationResult, 116, int.Parse(objComponentDto.i_CategoryId.ToString())); //Lógica de Aumento de Precio Base var porcentajes = o.v_Field.Split('-'); float p1 = porcentajes[0] == null ? 0 : float.Parse(porcentajes[0].ToString()); float p2 = porcentajes[1] == null ? 0 : float.Parse(porcentajes[1].ToString()); float pb = objComponentDto.r_BasePrice.Value; var precio_base = pb + (pb * p1 / 100) + (pb * p2 / 100); //FormPrecioComponente frm = new FormPrecioComponente("", "", ""); //frmConfigSeguros frm1 = new frmConfigSeguros(0, 0, 0, "", ""); ServiceComponentList auxiliaryExam = new ServiceComponentList(); servicecomponentDto objServiceComponentDto = new servicecomponentDto(); ServiceBL _ObjServiceBL = new ServiceBL(); TicketBL oTicketBL = new TicketBL(); if (_modo == "ASEGU") { #region OLD Logica antigua #region Conexion SAM //ConexionSigesoft conectasam = new ConexionSigesoft(); //conectasam.opensigesoft(); #endregion #region Query //var componente = NombreComponente[0].ToString(); //var cadena1 = "select PL.i_EsDeducible, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo from [dbo].[plan] PL where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' "; //SqlCommand comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft); //SqlDataReader lector = comando.ExecuteReader(); //int deducible = 0; //int coaseguro = 0; //decimal? importe = 0; //decimal? importeCo = 0; //while (lector.Read()) //{ // deducible = int.Parse(lector.GetValue(0).ToString()); coaseguro = int.Parse(lector.GetValue(1).ToString()); importe = decimal.Parse(lector.GetValue(2).ToString()); importeCo = decimal.Parse(lector.GetValue(3).ToString()); //} //lector.Close(); //string factores = ""; string aseguradoraName = ""; string organizationId = ""; //var factorGlobal = ""; //var cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId from Organization OO inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId where PR.v_ProtocolId ='" + _protocolId + "'"; //comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft); //lector = comando.ExecuteReader(); //while (lector.Read()) //{ // factores = lector.GetValue(0).ToString(); // var factorArray = factores.Split('|');// factores[0].ToString().Split('|'); // factorGlobal = factorArray[0]; // aseguradoraName = lector.GetValue(1).ToString(); // organizationId = lector.GetValue(2).ToString(); //} //lector.Close(); //string empresa = ""; //var cadena3 = "select v_Name from Organization OO where OO.v_OrganizationId ='" + organizationId + "'"; //comando = new SqlCommand(cadena3, connection: conectasam.conectarsigesoft); //lector = comando.ExecuteReader(); //while (lector.Read()) //{ // empresa = lector.GetValue(0).ToString(); //} //lector.Close(); #endregion #region Lógica PARA SABER SI ES DEDUCIBLE O COASEGURO //if (rbNuevaConsulta.Checked)// QUIERE DECIR QUE ES UNA NUEVA ATENCION Y DEBE SER CONSIDERADO COMO DEDUCIBLE SIN FACTOR //{ // factorGlobal = "1"; // coaseguro = 0; // importeCo = null; //} //else if (rbAdicional.Checked) // QUIERE DECIR QUE ES UN COMPONENTE ADICIONAL Y DEBE SER CONSIDERADO COMO COASEGURO CON FACTOR //{ // deducible = 0; // importe = null; //} #endregion #region Formulario //precio_base = (float)objComponentDto.r_PriceSegus;// se cambia el precio inicial por el SEGUS //frmConfigSeguros frm1 = new frmConfigSeguros(deducible, coaseguro, importe, precio_base.ToString(), factorGlobal, importeCo); //frm1.Text = aseguradoraName + " / " + empresa; //frm1.ShowDialog(); #endregion #endregion #region Obteniendo los campos de la BD ConexionSigesoft conectasam = new ConexionSigesoft(); conectasam.opensigesoft(); var componente = NombreComponente[0].ToString(); var cadena = "select i_KindOfService from component where v_ComponentId='" + objComponentDto.v_ComponentId + "'"; SqlCommand comando = new SqlCommand(cadena, connection: conectasam.conectarsigesoft); SqlDataReader lector = comando.ExecuteReader(); int i_KindOfService = 0; while (lector.Read()) { try { i_KindOfService = int.Parse(lector.GetValue(0).ToString()); } catch (Exception exception) { MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } lector.Close(); var cadena1 = "select PL.i_PlanId, PL.i_EsCoaseguro, PL.d_Importe, PL.d_ImporteCo " + "from [dbo].[plan] PL " + "where PL.v_IdUnidadProductiva='" + lineId + "' and PL.v_ProtocoloId='" + _protocolId + "' "; comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft); lector = comando.ExecuteReader(); string PlanId = ""; int coaseguro = 0; decimal?importe = 0; decimal?importeCo = 0; while (lector.Read()) { try { PlanId = lector.GetValue(0).ToString(); coaseguro = int.Parse(lector.GetValue(1).ToString()); importe = decimal.Parse(lector.GetValue(2).ToString()); importeCo = decimal.Parse(lector.GetValue(3).ToString()); } catch (Exception exception) { MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } lector.Close(); string factores = ""; string aseguradoraName = ""; string organizationId = ""; var factorGlobal = ""; var cadena2 = "select PR.r_PriceFactor, OO.v_Name, PR.v_CustomerOrganizationId " + "from Organization OO " + "inner join protocol PR On PR.v_AseguradoraOrganizationId = OO.v_OrganizationId " + "where PR.v_ProtocolId ='" + _protocolId + "'"; comando = new SqlCommand(cadena2, connection: conectasam.conectarsigesoft); lector = comando.ExecuteReader(); while (lector.Read()) { try { factores = lector.GetValue(0).ToString(); var factorArray = factores.Split('|');// factores[0].ToString().Split('|'); factorGlobal = factorArray[0]; aseguradoraName = lector.GetValue(1).ToString(); organizationId = lector.GetValue(2).ToString(); } catch (Exception exception) { MessageBox.Show(exception.Message, " ¡ ERROR !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } lector.Close(); #endregion #region Según el tipo de componente se hace el calculo switch (i_KindOfService) { //CLINICA case 1: { if (objComponentDto.r_PriceSegus != 0) { objServiceComponentDto.r_Price = objComponentDto.r_PriceSegus; objServiceComponentDto.d_SaldoPaciente = importe; objServiceComponentDto.d_SaldoAseguradora = (decimal)objComponentDto.r_PriceSegus - importe; } else { frmConfigSeguros frm1 = new frmConfigSeguros("1"); frm1.ShowDialog(); objServiceComponentDto.r_Price = (float)frm1.nuevoPrecio; objServiceComponentDto.d_SaldoPaciente = importe; objServiceComponentDto.d_SaldoAseguradora = frm1.nuevoPrecio - importe; } } break; //SERVICIOS AUXILIARES case 2: { if (objComponentDto.r_PriceSegus != 0) { objServiceComponentDto.r_Price = objComponentDto.r_PriceSegus * float.Parse(factorGlobal); objServiceComponentDto.d_SaldoPaciente = importeCo * (decimal)objServiceComponentDto.r_Price / 100; objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100; } else { frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal); frm1.ShowDialog(); objServiceComponentDto.r_Price = (float)frm1.nuevoPrecio; objServiceComponentDto.d_SaldoPaciente = importeCo * frm1.nuevoPrecio / 100; objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100; } } break; //HONORARIOS MÉDICOS Y/O QUIRURGICOS case 3: { if (objComponentDto.r_PriceSegus != 0) { objServiceComponentDto.r_Price = objComponentDto.r_PriceSegus * float.Parse(factorGlobal); objServiceComponentDto.d_SaldoPaciente = importeCo * (decimal)objServiceComponentDto.r_Price / 100; objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * (decimal)objServiceComponentDto.r_Price / 100; } else { frmConfigSeguros frm1 = new frmConfigSeguros(factorGlobal); frm1.ShowDialog(); objServiceComponentDto.r_Price = (float)frm1.nuevoPrecio; objServiceComponentDto.d_SaldoPaciente = importeCo * frm1.nuevoPrecio / 100; objServiceComponentDto.d_SaldoAseguradora = (100 - importeCo) * frm1.nuevoPrecio / 100; } } break; } #endregion objServiceComponentDto.v_ServiceId = _serviceId; objServiceComponentDto.i_ExternalInternalId = (int)Common.ComponenteProcedencia.Interno; objServiceComponentDto.i_ServiceComponentTypeId = 1; objServiceComponentDto.i_IsVisibleId = 1; objServiceComponentDto.i_IsInheritedId = (int)Common.SiNo.NO; objServiceComponentDto.d_StartDate = null; objServiceComponentDto.d_EndDate = null; objServiceComponentDto.i_index = 1; objServiceComponentDto.v_ComponentId = scid; objServiceComponentDto.i_IsInvoicedId = (int)Common.SiNo.NO; objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar; objServiceComponentDto.i_QueueStatusId = (int)Common.QueueStatusId.LIBRE; objServiceComponentDto.i_Iscalling = (int)Common.Flag_Call.NoseLlamo; objServiceComponentDto.i_Iscalling_1 = (int)Common.Flag_Call.NoseLlamo; objServiceComponentDto.i_IsManuallyAddedId = (int)Common.SiNo.NO; objServiceComponentDto.i_IsRequiredId = (int)Common.SiNo.SI; objServiceComponentDto.v_IdUnidadProductiva = txtUnidProdId.Text; objServiceComponentDto.i_MedicoTratanteId = int.Parse(cboMedico.SelectedValue.ToString()); if (rbNuevaConsulta.Checked) { objServiceComponentDto.i_TipoDesc = 1; } else if (rbAdicional.Checked) { objServiceComponentDto.i_TipoDesc = 2; } _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList()); #region Update a service agrega el PlanId cadena1 = "update service set " + "i_PlanId = '" + PlanId + "' " + "where v_ServiceId = '" + _serviceId + "' "; comando = new SqlCommand(cadena1, connection: conectasam.conectarsigesoft); lector = comando.ExecuteReader(); lector.Close(); #endregion } else { FormPrecioComponente frm = new FormPrecioComponente(NombreComponente[0].ToString(), precio_base.ToString(), ""); frm.ShowDialog(); objServiceComponentDto.i_ConCargoA = conCargoA; objServiceComponentDto.v_ServiceId = _serviceId; objServiceComponentDto.i_ExternalInternalId = (int)Common.ComponenteProcedencia.Interno; objServiceComponentDto.i_ServiceComponentTypeId = 1; objServiceComponentDto.i_IsVisibleId = 1; objServiceComponentDto.i_IsInheritedId = (int)Common.SiNo.NO; objServiceComponentDto.d_StartDate = null; objServiceComponentDto.d_EndDate = null; objServiceComponentDto.i_index = 1; objServiceComponentDto.r_Price = frm.Precio; objServiceComponentDto.v_ComponentId = scid; objServiceComponentDto.i_IsInvoicedId = (int)Common.SiNo.NO; objServiceComponentDto.i_ServiceComponentStatusId = (int)Common.ServiceStatus.PorIniciar; objServiceComponentDto.i_QueueStatusId = (int)Common.QueueStatusId.LIBRE; //objServiceComponentDto.i_IsRequiredId = (int)Common.SiNo.SI; objServiceComponentDto.i_Iscalling = (int)Common.Flag_Call.NoseLlamo; objServiceComponentDto.i_Iscalling_1 = (int)Common.Flag_Call.NoseLlamo; objServiceComponentDto.i_IsManuallyAddedId = (int)Common.SiNo.NO; objServiceComponentDto.i_IsRequiredId = (int)Common.SiNo.SI; objServiceComponentDto.v_IdUnidadProductiva = objComponentDto.v_IdUnidadProductiva; objServiceComponentDto.i_MedicoTratanteId = int.Parse(cboMedico.SelectedValue.ToString()); objServiceComponentDto.d_SaldoPaciente = 0; objServiceComponentDto.d_SaldoAseguradora = 0; _ObjServiceBL.AddServiceComponent(ref objOperationResult, objServiceComponentDto, Globals.ClientSession.GetAsList()); } } //Actualizo si son examenes adicionales if (_DataSource.Count > 0) { new AdditionalExamBL().UpdateAdditionalExamByComponentIdAndServiceId(ComponentId[0], _serviceId, Globals.ClientSession.i_SystemUserId); } } MessageBox.Show("Se grabo correctamente", " ¡ INFORMACIÓN !", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; }
private void LoadData() { OperationResult objOperationResult = new OperationResult(); //Llenado de combos Utils UtilComboBox = new Utils(); string Mode = Request.QueryString["Mode"].ToString(); int GroupId = -1, ParameterId = -1; if (Request.QueryString["i_GroupId"] != null) { GroupId = int.Parse(Request.QueryString["i_GroupId"].ToString()); } if (Request.QueryString["i_ParameterId"] != null) { ParameterId = int.Parse(Request.QueryString["i_ParameterId"].ToString()); } //Llenar combo ItemParameter Tree ddlParentParameterId.DataTextField = "Description"; ddlParentParameterId.DataValueField = "Id"; ddlParentParameterId.DataSimulateTreeLevelField = "Level"; ddlParentParameterId.DataEnableSelectField = "EnabledSelect"; List <DataForTreeViewSP> t = _objProxy.GetSystemParameterForComboTreeView(ref objOperationResult, GroupId).ToList(); ddlParentParameterId.DataSource = t; ddlParentParameterId.DataBind(); this.ddlParentParameterId.Items.Insert(0, new FineUI.ListItem("-- Seleccione --", "-1")); if (Mode == "New") { txtGroupId.Enabled = false; txtGroupId.Text = "0"; ddlParentParameterId.Enabled = false; // Autogenerar ID para el nuevo grupo var groupId = _objProxy.GetSystemParameterMaxGroupId(); txtGroupId.Text = groupId.ToString(); } else if (Mode == "Edit") { // Bloquear algunos campos txtGroupId.Enabled = false; txtParameterId.Enabled = false; ddlParentParameterId.Enabled = true; // Get the Entity Data systemparameterDto objEntity = _objProxy.GetSystemParameter(ref objOperationResult, GroupId, ParameterId); // Save the entity on the session Session["objEntity"] = objEntity; // Show the data on the form txtGroupId.Text = objEntity.i_GroupId.ToString(); txtParameterId.Text = objEntity.i_ParameterId.ToString(); txtDescription.Text = objEntity.v_Value1; if (objEntity.i_Sort.HasValue) { txtUserInterfaceOrder.Text = objEntity.i_Sort.Value.ToString(); } txtDescription2.Text = objEntity.v_Value2; txtField.Text = objEntity.v_Field; //Llenado de combos //Utils.LoadDropDownList(ddlParentGroupId, "Value1", "Id", _objProxy.GetSystemParameterForCombo(ref objOperationResult, 0), DropDownListAction.Select); //Utils.LoadDropDownList(ddlParentParameterId, "Value1", "Id", _objProxy.GetSystemParameterForCombo(ref objOperationResult, (int)objEntity.i_ParentGroupId), DropDownListAction.Select); //ddlParentGroupId.SelectedValue = objEntity.i_ParentGroupId.ToString(); ddlParentParameterId.SelectedValue = objEntity.i_ParentParameterId.ToString(); txtDescription2.Focus(true); if (GroupId == 0) { ddlParentParameterId.Enabled = false; } } if (Mode == "NewChildren") { txtGroupId.Text = GroupId.ToString(); txtGroupId.Enabled = false; // Autogenerar ID para el nuevo parametro var paramId = _objProxy.GetSystemParameterMaxParameterId(GroupId); txtParameterId.Text = paramId.ToString(); //txtParameterId.Enabled = false; txtUserInterfaceOrder.Focus(); } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { OperationResult objOperationResult = new OperationResult(); string Mode = Request.QueryString["Mode"].ToString(); string PersonId = ""; if (Request.QueryString["v_PersonId"] != null) { PersonId = Request.QueryString["v_PersonId"].ToString(); } if (Mode == "New") { familymedicalantecedentsDto personmedicalhistoryDtoDto = new familymedicalantecedentsDto(); var x = ddlDx.SelectedText.ToString().Split('|'); //Obtener Disease systemparameterDto objEntity = _objBL.GetSystemParameter(ref objOperationResult, 149, int.Parse(x[1].ToString())); personmedicalhistoryDtoDto.v_PersonId = Session["PersonId"].ToString(); personmedicalhistoryDtoDto.i_TypeFamilyId = int.Parse(x[1].ToString()); if (ddlDx.SelectedValue == "80" || ddlDx.SelectedValue == "81" || ddlDx.SelectedValue == "82" || ddlDx.SelectedValue == "83" || ddlDx.SelectedValue == "84") { personmedicalhistoryDtoDto.v_DiseasesId = Session["OtroDxId"].ToString(); } else { personmedicalhistoryDtoDto.v_DiseasesId = objEntity.v_Value1; } personmedicalhistoryDtoDto.v_Comment = txtComentario.Text; _objHistoryBL.AddFamiliar(ref objOperationResult, personmedicalhistoryDtoDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } else if (Mode == "Edit") { familymedicalantecedentsDto personmedicalhistoryDtoDto = (familymedicalantecedentsDto)Session["objEntity"]; var x = ddlDx.SelectedText.ToString().Split('|'); //Obtener Disease systemparameterDto objEntity = _objBL.GetSystemParameter(ref objOperationResult, 149, int.Parse(x[1].ToString())); //personmedicalhistoryDtoDto.v_DiseasesId = objEntity.v_Value1; if (ddlDx.SelectedValue == "80" || ddlDx.SelectedValue == "81" || ddlDx.SelectedValue == "82" || ddlDx.SelectedValue == "83" || ddlDx.SelectedValue == "84") { personmedicalhistoryDtoDto.v_DiseasesId = Session["OtroDxId"].ToString(); } else { personmedicalhistoryDtoDto.v_DiseasesId = objEntity.v_Value1; } personmedicalhistoryDtoDto.v_Comment = txtComentario.Text; personmedicalhistoryDtoDto.i_TypeFamilyId = int.Parse(x[1].ToString()); _objHistoryBL.UpdateFamiliar(ref objOperationResult, personmedicalhistoryDtoDto, ((ClientSession)Session["objClientSession"]).GetAsList()); } Session["GrupoFamiliarId"] = null; //Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { // Cerrar página actual y hacer postback en el padre para actualizar PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else // Operación con error { Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); // Se queda en el formulario. } }