private void LoadComboBox()
        {
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddlAptitud, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 124), DropDownListAction.All);
            Utils.LoadDropDownList(ddlTipoESO, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 118), DropDownListAction.All);
            Utils.LoadDropDownList(ddlProtocolo, "Value1", "Id", _objProtocolBL.GetProtocolBySystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId), DropDownListAction.Select);

            var UsuarioMaster = ((ClientSession)Session["objClientSession"]).v_UserName;

            if (UsuarioMaster == "ricardo.rueda.sj")
            {
                var ObtenerEmpresasCliente = new ProtocolBL().DevolverTodasEmpresas(ref objOperationResult);
                //txtEmpresa.Text = ObtenerEmpresasCliente.CustomerOrganizationName;
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);
            }
            else
            {
                var ObtenerEmpresasCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
                //txtEmpresa.Text = ObtenerEmpresasCliente.CustomerOrganizationName;
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);
                //ddlEmpresa.Enabled = false;
                //ddlEmpresa.se
            }
        }
Beispiel #2
0
        public IHttpActionResult SaveProtocols(MultiDataModel multi)
        {
            ProtocolList data   = JsonConvert.DeserializeObject <ProtocolList>(multi.String1);
            var          result = ProtocolBL.SaveProtocols(data, multi.Int1, multi.Int2);

            return(Ok(result));
        }
        private void LoadComboBox()
        {
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddltipoServicioBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 119), DropDownListAction.All);
            Utils.LoadDropDownList(ddlColaBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 120), DropDownListAction.All);
            Utils.LoadDropDownList(ddlEstadoCitaBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 122), DropDownListAction.All);
            //var ObtenerEmpresaCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser_(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
            //txtEmpresa.Text = ObtenerEmpresaCliente.CustomerOrganizationName;
            //Session["EmpresaClienteId"] = ObtenerEmpresaCliente.IdEmpresaCliente;

            var UsuarioMaster = ((ClientSession)Session["objClientSession"]).v_UserName;

            //ricardo.rueda.sj
            if (UsuarioMaster == "aaa")
            {
                var ObtenerEmpresasCliente = new ProtocolBL().DevolverTodasEmpresas(ref objOperationResult);
                //txtEmpresa.Text = ObtenerEmpresasCliente.CustomerOrganizationName;
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);
            }
            else
            {
                var ObtenerEmpresasCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
                //txtEmpresa.Text = ObtenerEmpresasCliente.CustomerOrganizationName;
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);
                //ddlEmpresa.Enabled = false;
                //ddlEmpresa.se
            }

            dpFechaInicioBus.SelectedDate = DateTime.Now;
        }
Beispiel #4
0
        public IHttpActionResult GetAllProtocol(MultiDataModel multidata)
        {
            BoardProtocol data   = JsonConvert.DeserializeObject <BoardProtocol>(multidata.String1);
            var           result = ProtocolBL.GetAllProtocol(data);

            return(Ok(result));
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            foreach (var item in _TempProtocolSystemUSerExternalList)
            {
                List <protocolsystemuserDto> x = new ProtocolBL().GetAllSystemUserExternalBySystemUserId(item.i_SystemUserId);

                for (int i = 0; i < x.Count(); i++)
                {
                    x[i].v_ProtocolId = _ProtocolId;
                }

                new ProtocolBL().AddProtocolSystemUser(ref objOperationResult, x, item.i_SystemUserId, Globals.ClientSession.GetAsList(), false);

                if (objOperationResult.Success == 1)  // Operación sin error
                {
                    MessageBox.Show("Se grabo correctamente.", "INFORMACION!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else  // Operación con error
                {
                    if (objOperationResult.ErrorMessage != null)
                    {
                        MessageBox.Show(objOperationResult.ErrorMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        MessageBox.Show(Constants.GenericErrorMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        // Se queda en el formulario.
                    }
                }
            }
        }
Beispiel #6
0
        private void mnuGridDeleteMedicalExam_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            // Obtener los IDs de la fila seleccionada

            DialogResult Result = MessageBox.Show("¿Está seguro de eliminar este registro?:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "¡ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                //Buscar si el componente C está en un protocolo P. Si está en un protocolo P, NO SE PUEDE ELIMINAR EL COMPONENTE C. En cualquier otro caso -> EL COMPONENTE C SE PUEDE ELIMINAR.
                ProtocolBL objProtocolBL = new ProtocolBL();

                if (objProtocolBL.ValidateComponentElimination(ref objOperationResult, strMedicalExamId) == true)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque está referenciado en un protocolo.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                var _objData = _objMedicalExamFieldsBL.GetMedicalExamFieldsPagedAndFiltered(ref objOperationResult, 0, null, "", "v_ComponentId ==" + "\"" + strMedicalExamId + "\"");

                if (_objData.Count > 0)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque tiene campos registrados.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    _objMedicalExamBL.DeleteMedicalExam(ref objOperationResult, strMedicalExamId, Globals.ClientSession.GetAsList());
                    btnFilter_Click(sender, e);
                }
            }
        }
Beispiel #7
0
        private void loadCombo()
        {
            ProtocolBL      oProtocolBL        = new ProtocolBL();
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddlProtocoloId, "v_Name", "Id", oProtocolBL.DevolverProtocolosPorEmpresaOnly(Session["EmpresaClienteId"].ToString()), DropDownListAction.Select);
        }
Beispiel #8
0
        private void LoadComboBox()
        {
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddlTipoESO, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 118), DropDownListAction.All);
            var RolId = ((ClientSession)Session["objClientSession"]).i_RoleId;

            if (RolId == 1)
            {
                var clientOrganization = new ProtocolBL().GetOrganizationCustumer(ref objOperationResult);
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", clientOrganization, DropDownListAction.All);
                ddlEmpresa.Enabled = true;
            }
            else
            {
                var ObtenerEmpresasCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresa, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);

                ddlEmpresa.SelectedValue = Session["EmpresaClienteId"].ToString();
            }



            Utils.LoadDropDownList(ddlProtocolo, "Value1", "Id", _objProtocolBL.GetProtocolBySystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId), DropDownListAction.All);
        }
        private void btnSearchProtocol_Click(object sender, EventArgs e)
        {
            Configuration.frmProtocolManagement frm = new Configuration.frmProtocolManagement("View", int.Parse(ddlServiceTypeId.SelectedValue.ToString()), int.Parse(ddlMasterServiceId.SelectedValue.ToString()));
            frm.ShowDialog();
            _ProtocolId = frm._pstrProtocolId;
            if (_ProtocolId == null)
            {
                return;
            }
            OperationResult objOperationResult = new OperationResult();
            ProtocolBL      _objProtocoltBL    = new ProtocolBL();
            protocolDto     objProtocolDto     = new protocolDto();
            ProtocolList    objProtocol        = new ProtocolList();

            objProtocol = _objProtocoltBL.GetProtocolById(ref objOperationResult, _ProtocolId);

            txtProtocolId.Text                   = objProtocol.v_ProtocolId;
            txtViewProtocol.Text                 = objProtocol.v_Protocol;
            txtViewOrganization.Text             = objProtocol.v_Organization;
            txtViewLocation.Text                 = objProtocol.v_Location;
            txtViewGroupOccupation.Text          = objProtocol.v_GroupOccupation;
            txtViewGes.Text                      = objProtocol.v_Ges;
            txtViewComponentType.Text            = objProtocol.v_EsoType;
            txtViewOccupation.Text               = objProtocol.v_Occupation;
            txtViewIntermediaryOrganization.Text = objProtocol.v_IntermediaryOrganization;
            txtIntermediaryOrganization.Text     = objProtocol.v_OrganizationInvoice;
        }
Beispiel #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            MedicalExamFieldValuesBL _objMedicalExamFieldValuesBL = new MedicalExamFieldValuesBL();
            OperationResult          objOperationResult           = new OperationResult();
            // Obtener los IDs de la fila seleccionada

            DialogResult Result = MessageBox.Show("¿Está seguro de eliminar este registro?:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "¡ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (Result == System.Windows.Forms.DialogResult.Yes)
            {
                // Delete the item
                //Buscar si el componente C está en un protocolo P.Si está en un protocolo -> NO SE PUEDE ELIMINAR EL CAMPO X.En cualquier otro caso -> EL CAMPO X SE PUEDE ELIMINAR.
                ProtocolBL objProtocolBL = new ProtocolBL();

                if (objProtocolBL.ValidateComponentElimination(ref objOperationResult, strMedicalExamId) == true)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque está referenciado en un protocolo.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string strMedicalExamFieldId = grdDataMedicalExamFields.Selected.Rows[0].Cells[0].Value.ToString();

                var _objData = _objMedicalExamFieldValuesBL.GetMedicalExamFieldValuesPagedAndFiltered(ref objOperationResult, 0, null, "", "v_MedicalExamFieldsId ==" + "\"" + strMedicalExamFieldId + "\"");
                if (_objData.Count > 0)
                {
                    MessageBox.Show("Este registro no se puede eliminar porque tiene campos registrados.", "¡ADVERTENCIA!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    _objMedicalExamFieldsBL.DeleteMedicalExamFields(ref objOperationResult, strMedicalExamId, strMedicalExamFieldId, Globals.ClientSession.GetAsList());

                    BindGridMedicalExamFields(strMedicalExamId);
                }
            }
        }
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            OperationResult    objOperationResult = new OperationResult();
            List <FileInfoDto> objDetailData      = Session["objMainEntityDetail"] as List <FileInfoDto>;
            FileInfoDto        fileInfo           = null;

            foreach (var item in objDetailData)
            {
                //Obtener CategoriaId
                //var oKeyValues = (KeyValueDTO)ddlComponentId.SelectedItem;
                var CategoriaId = int.Parse(ddlConsultorio.SelectedValue.ToString());

                //Obtener lista de componentes de un protocolo por su categoria
                ProtocolBL oProtocolBL = new ProtocolBL();
                var        ListaComponentesCategoria = oProtocolBL.GetProtocolComponents(ref objOperationResult, item.ProtocolId).FindAll(p => p.i_CategoryId == CategoriaId);

                var OrdenDescListaComponentesCategoria = ListaComponentesCategoria.OrderBy(o => o.v_ComponentId).ToList();



                var oserviceComponent = oServiceBL.GetServiceComponentByServiceIdAndComponentId(item.ServiceId, OrdenDescListaComponentesCategoria[0].v_ComponentId);
                if (oserviceComponent != null)
                {
                    string serviceComponentId = oserviceComponent.v_ServiceComponentId;


                    LoadFileNoLock(item.RutaLarga);

                    fileInfo = new FileInfoDto();

                    fileInfo.Id                 = null;
                    fileInfo.PersonId           = item.PersonId;
                    fileInfo.ServiceComponentId = serviceComponentId;
                    fileInfo.FileName           = item.RutaCorta;
                    fileInfo.Description        = "";
                    fileInfo.ByteArrayFile      = _file;
                    //fileInfo.ThumbnailFile = Common.Utils.imageToByteArray1(pbFile.Image);
                    fileInfo.Action = (int)ActionForm.Add;

                    // Grabar
                    oServiceBL.AddMultimediaFileComponent(ref objOperationResult, fileInfo, ((ClientSession)Session["objClientSession"]).GetAsList());
                }

                //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.
                }
            }
        }
Beispiel #12
0
        public frmAddUserExternal(string pstrProtocolId)
        {
            OperationResult objOperationResult = new OperationResult();
            ProtocolBL      objProtocolBL      = new ProtocolBL();
            var             obj = objProtocolBL.GetProtocolById(ref objOperationResult, pstrProtocolId);

            _EmpresaId  = obj.v_CustomerOrganizationId;
            _ProtocolId = pstrProtocolId;

            InitializeComponent();
        }
        protected void ddlEmpresaCliente_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProtocolBL oProtocolBL = new ProtocolBL();

            if (ddlEmpresaCliente.SelectedValue.ToString() != "-1")
            {
                var x = ddlEmpresaCliente.SelectedValue.ToString().Split('|');
                var o = oProtocolBL.DevolverProtocolosPorEmpresa(x[0].ToString(), x[1].ToString());

                Utils.LoadDropDownList(ddlProtocoloId, "v_Name", "v_ProtocolId", o, DropDownListAction.Select);
            }
        }
Beispiel #14
0
        private void LoadComboBox()
        {
            OperationResult objOperationResult = new OperationResult();

            Utils.LoadDropDownList(ddltipoServicioBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 119), DropDownListAction.All);
            Utils.LoadDropDownList(ddlColaBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 120), DropDownListAction.All);
            Utils.LoadDropDownList(ddlEstadoCitaBus, "Value1", "Id", _objSystemParameterBL.GetSystemParameterForCombo(ref objOperationResult, 122), DropDownListAction.All);
            var ObtenerEmpresaCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);

            txtEmpresa.Text             = ObtenerEmpresaCliente.CustomerOrganizationName;
            Session["EmpresaClienteId"] = ObtenerEmpresaCliente.IdEmpresaCliente;

            dpFechaInicioBus.SelectedDate = DateTime.Now;
        }
Beispiel #15
0
        public IHttpActionResult GetPriceProtocolComponentByProtocolId(string protocolId)
        {
            var   result = ProtocolBL.GetProtocolComponentByProtocolId(protocolId);
            float resp   = 0;

            if (result.ListProtocolComponents != null)
            {
                if (result.ListProtocolComponents.Count > 0)
                {
                    resp = result.ListProtocolComponents.Sum(x => x.Price);
                }
            }
            return(Ok(resp));
        }
Beispiel #16
0
        private void btnMove_Click(object sender, EventArgs e)
        {
            ProtocolSystemUSerExternalList objProtocolSystemUSerExternalList = new ProtocolSystemUSerExternalList();

            if (_TempProtocolSystemUSerExternalList == null)
            {
                _TempProtocolSystemUSerExternalList = new List <ProtocolSystemUSerExternalList>();
            }
            int SystemUserID = int.Parse(treeViewUserExternal.SelectedNode.Name.ToString());
            //Busco en la lista temporal si ya se agrego el item seleccionado
            var findResult = _TempProtocolSystemUSerExternalList.Find(p => p.i_SystemUserId == SystemUserID);

            if (findResult == null)
            {
                //Verificar si el usuario se encuentra en otra empresa
                //Verificar cuantos protocolos està asigando este usuario
                var ListaProtocolos = new ProtocolBL().GetProtocolbySystemUserId(SystemUserID);

                //Verificar si el usuario esta en una empresa diferente
                if (ListaProtocolos.FindAll(p => p.v_CustomerOrganizationId != _EmpresaId).Count() > 0)
                {
                    MessageBox.Show("El usuario: " + treeViewUserExternal.SelectedNode.Text + " ya se encuentra asiganado a la empresa: " + ListaProtocolos[0].v_CustomerOrganizationName, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                objProtocolSystemUSerExternalList.v_UserName     = treeViewUserExternal.SelectedNode.Text;
                objProtocolSystemUSerExternalList.i_SystemUserId = int.Parse(treeViewUserExternal.SelectedNode.Name.ToString());
                //objProtocolSystemUSerExternalList.v_ProtocolId =
                _TempProtocolSystemUSerExternalList.Add(objProtocolSystemUSerExternalList);
            }
            else
            {
                MessageBox.Show("Este Usuario ya se encuentra en la lista", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            var dataList = _TempProtocolSystemUSerExternalList;

            grdDataUserExternal.DataSource = new ProtocolSystemUSerExternalList();
            grdDataUserExternal.DataSource = dataList;
            grdDataUserExternal.Refresh();

            if (grdDataUserExternal.Rows.Count() > 0)
            {
                btnSave.Enabled = true;
            }
            else
            {
                btnSave.Enabled = false;
            }
        }
Beispiel #17
0
        private void btnSearchProtocol_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            ProtocolBL      oProtocolBL        = new ProtocolBL();

            //List<ProtocolComponentList> ProtocolComponentList = new List<BE.ProtocolComponentList>();


            Configuration.frmProtocolManagement frm = new Configuration.frmProtocolManagement("View", -1, -1);
            frm.ShowDialog();
            if (frm._pstrProtocolId != null)
            {
                _ProtocolId = frm._pstrProtocolId;
            }

            if (frm.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            if (_ProtocolId == null)
            {
                return;
            }

            ProtocolBL   _objProtocoltBL = new ProtocolBL();
            protocolDto  objProtocolDto  = new protocolDto();
            ProtocolList objProtocol     = new ProtocolList();

            objProtocol = _objProtocoltBL.GetProtocolById(ref objOperationResult, _ProtocolId);

            txtProtocolName.Text = objProtocol.v_Protocol;
            txtOrganitation.Text = objProtocol.v_Organization;
            txtContact.Text      = objProtocol.v_ContacName;
            txtAdress.Text       = objProtocol.v_Address;
            txttypeProtocol.Text = objProtocol.v_EsoType;

            //ProtocolComponentList = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId);

            //foreach (var item in ProtocolComponentList)
            //{
            //    CostoTotal += (float)item.r_Price;
            //}

            //grdData.DataSource = ProtocolComponentList;
            //txtTotal.Text = CostoTotal.ToString();
            //Calcular();
            txtNroTrabajadores.Focus();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OperationResult objOperationResult = new OperationResult();
                btnAgregar.OnClientClick = winEdit.GetSaveStateReference(hfRefresh.ClientID) + winEdit.GetShowReference("FRM052.aspx");
                //btnAsignarProtocolo.OnClientClick = Window1.GetSaveStateReference(hfRefresh.ClientID) + Window1.GetShowReference("FRM050A.aspx");
                dpFechaInicio.SelectedDate = DateTime.Now;

                var ObtenerEmpresasCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
                Session["EmpresaClienteId"] = ObtenerEmpresasCliente[0].IdEmpresaCliente;
                Utils.LoadDropDownList(ddlEmpresaCliente, "CustomerOrganizationName", "IdEmpresaCliente", ObtenerEmpresasCliente, DropDownListAction.All);

                ddlEmpresaCliente.SelectedValue = Session["EmpresaClienteId"].ToString();
                Utils.LoadDropDownList(ddlProtocoloId, "Value1", "Id", oProtocolBL.GetProtocolBySystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId), DropDownListAction.Select);
            }
        }
Beispiel #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         OperationResult objOperationResult = new OperationResult();
         dpFechaInicio.SelectedDate = DateTime.Now.AddDays(-1); //DateTime.Parse("25/07/2014");
         dpFechaFin.SelectedDate    = DateTime.Now;             // DateTime.Parse("25/07/2014");
         LoadComboBox();
         btnNewCertificado.OnClientClick      = winEdit1.GetSaveStateReference(hfRefresh.ClientID) + winEdit1.GetShowReference("../ExternalUser/FRM031B.aspx");
         btnNewFichaOcupacional.OnClientClick = winEdit2.GetSaveStateReference(hfRefresh.ClientID) + winEdit2.GetShowReference("../ExternalUser/FRM031H.aspx");
         btnNewExamenes.OnClientClick         = winEdit3.GetSaveStateReference(hfRefresh.ClientID) + winEdit3.GetShowReference("../ExternalUser/FRM031E.aspx");
         btnAdjuntar.OnClientClick            = Window1.GetSaveStateReference(hfRefresh.ClientID) + Window1.GetShowReference("../ExternalUser/FRM031G.aspx");
         var ObtenerEmpresaCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);
         txtEmpresa.Text             = ObtenerEmpresaCliente.CustomerOrganizationName;
         Session["EmpresaClienteId"] = ObtenerEmpresaCliente.IdEmpresaCliente;
     }
 }
        private void ClonAction()
        {
            OperationResult             objOperationResult        = new OperationResult();
            protocolDto                 _protocolDTO              = new protocolDto();
            ProtocolBL                  _protocolBL               = new ProtocolBL();
            protocolcomponentDto        oprotocolcomponentDto     = null;
            List <protocolcomponentDto> _protocolcomponentListDTO = new List <protocolcomponentDto>();

            // Obtener los IDs de la fila seleccionada
            string ProtocolId = grdData.DataKeys[grdData.SelectedRowIndex][0].ToString();

            _protocolDTO              = _protocolBL.GetProtocol(ref objOperationResult, ProtocolId);
            _protocolDTO.v_Name       = _protocolDTO.v_Name + "_Copia";
            _protocolDTO.v_ProtocolId = null;
            // Componentes del protocolo
            var dataListPc = _protocolBL.GetProtocolComponents(ref objOperationResult, ProtocolId);

            foreach (var item in dataListPc)
            {
                oprotocolcomponentDto = new protocolcomponentDto();

                oprotocolcomponentDto.v_ProtocolComponentId = item.v_ProtocolComponentId;
                oprotocolcomponentDto.v_ProtocolId          = item.v_ProtocolId;
                oprotocolcomponentDto.v_ComponentId         = item.v_ComponentId;
                oprotocolcomponentDto.r_Price           = item.r_Price;
                oprotocolcomponentDto.i_OperatorId      = item.i_OperatorId;
                oprotocolcomponentDto.i_Age             = item.i_Age;
                oprotocolcomponentDto.i_GenderId        = item.i_GenderId;
                oprotocolcomponentDto.i_IsConditionalId = item.i_IsConditionalId;
                oprotocolcomponentDto.i_IsDeleted       = item.i_IsDeleted;
                //oprotocolcomponentDto.i_InsertUserId = item.i_InsertUserId;
                //oprotocolcomponentDto.d_InsertDate = item.d_InsertDate;
                //oprotocolcomponentDto.i_UpdateUserId = item.i_UpdateUserId;
                oprotocolcomponentDto.d_UpdateDate       = item.d_UpdateDate;
                oprotocolcomponentDto.i_IsConditionalIMC = item.i_IsConditionalIMC;
                oprotocolcomponentDto.r_Imc          = item.r_Imc;
                oprotocolcomponentDto.i_IsAdditional = item.i_isAdditional;
                _protocolcomponentListDTO.Add(oprotocolcomponentDto);
            }


            _protocolBL.AddProtocol(ref objOperationResult, _protocolDTO, _protocolcomponentListDTO, ((ClientSession)Session["objClientSession"]).GetAsList());
        }
        private void ShowReport()
        {
            var DetalleFactura = new FacturacionBL().ComisionVendedor("", _EmpresaCliente, _EmpresaSede, _FechaInicio.Value.Date, _FechaFin.Value.Date, -1);

            List <ComisionVendedorList> Lista = new List <ComisionVendedorList>();
            ComisionVendedorList        oComisionVendedorList;

            foreach (var item in DetalleFactura)
            {
                //Verificar si es protocolo con comisión
                oComisionVendedorList = new ComisionVendedorList();
                bool Result = new ServiceBL().EsProtocoloComision(item.IdService);

                if (Result)
                {
                    oComisionVendedorList.v_ServicioId = item.IdService;

                    //Obtener datos del protocolo
                    var Protocolo = new ProtocolBL().GetProtocolByService(item.IdService);

                    oComisionVendedorList.Protocolo     = Protocolo.v_Name;
                    oComisionVendedorList.Comision      = Protocolo.Comision;
                    oComisionVendedorList.Costo         = item.Total;
                    oComisionVendedorList.CostoComision = oComisionVendedorList.Costo.Value.ToString() + " - " + oComisionVendedorList.Comision.Value.ToString() + "%";
                    oComisionVendedorList.Vendedor      = Protocolo.v_NombreVendedor;
                    oComisionVendedorList.SubTotal      = oComisionVendedorList.Costo.Value * oComisionVendedorList.Comision.Value / 100;

                    Lista.Add(oComisionVendedorList);
                }

                if (Lista.Count > 0)
                {
                    txtNombreVendedor.Text = Lista[0].Vendedor.ToString();
                    txtEmpresaCliente.Text = _NombreEmpresaCliente;

                    txtTotalPagar.Text = Lista.Sum(p => p.SubTotal).ToString();
                    grdData.DataSource = Lista;
                }
            }
        }
Beispiel #22
0
        private void btnSearchProtocol_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();

            Configuration.frmProtocolManagement frm = new Configuration.frmProtocolManagement("View", -1, -1);
            frm.ShowDialog();
            _ProtocolId = frm._pstrProtocolId;
            if (_ProtocolId == null)
            {
                return;
            }

            ProtocolBL   _objProtocoltBL = new ProtocolBL();
            protocolDto  objProtocolDto  = new protocolDto();
            ProtocolList objProtocol     = new ProtocolList();

            objProtocol = _objProtocoltBL.GetProtocolById(ref objOperationResult, _ProtocolId);

            txtProtocolName.Text = objProtocol.v_Protocol;

            btnSave.Enabled = (txtProtocolName.TextLength > 0);
        }
        private List <ServiceList> GetData(int pintPageIndex, int pintPageSize, string pstrSortExpression, string pstrFilterExpression)
        {
            OperationResult objOperationResult = new OperationResult();
            var             _objData           = _ServiceBL.GetService(ref objOperationResult, pintPageIndex, pintPageSize, pstrSortExpression, pstrFilterExpression, dpFechaInicio.SelectedDate.Value, dpFechaFin.SelectedDate.Value.AddDays(1));

            if (ddlEmpresa.SelectedValue.ToString() == "-1")
            {
                var ObtenerEmpresasCliente = new ProtocolBL().GetOrganizationCustumerByProtocolSystemUser(ref objOperationResult, ((ClientSession)Session["objClientSession"]).i_SystemUserId);

                List <string> l = new List <string>();

                foreach (var item in ObtenerEmpresasCliente)
                {
                    l.Add(item.IdEmpresaCliente);
                }

                var x = _objData.FindAll(p => l.Contains(p.v_CustomerOrganizationId)).ToList();
                lblContador.Text = "Se encontraron " + x.Count().ToString() + " registros";
                if (objOperationResult.Success != 1)
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                }


                return(x);
            }
            else
            {
                lblContador.Text = "Se encontraron " + _objData.Count().ToString() + " registros";
                if (objOperationResult.Success != 1)
                {
                    Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage);
                }


                return(_objData);
            }
        }
        public ServiceOrderDetailList GetServiceOrderDetailList(string pstrProtocolId)
        {
            try
            {
                SigesoftEntitiesModel dbContext          = new SigesoftEntitiesModel();
                ProtocolBL            oProtocolBL        = new ProtocolBL();
                OperationResult       objOperationResult = new OperationResult();
                var Precio = oProtocolBL.GetProtocolComponents(ref objOperationResult, pstrProtocolId).Sum(s => s.r_Price);
                var query  = (from A in dbContext.protocol
                              where A.v_ProtocolId == pstrProtocolId
                              select new ServiceOrderDetailList
                {
                    v_ProtocolName = A.v_Name,
                    r_ProtocolPrice = Precio
                }).FirstOrDefault();

                return(query);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #25
0
        private void LoadTreeDangers()
        {
            OperationResult       objOperationResult = new OperationResult();
            ProtocolBL            objProtocolBL      = new ProtocolBL();
            List <SystemUserList> objSystemUserList  = new List <SystemUserList>();

            treeViewUserExternal.Nodes.Clear();
            TreeNode nodePrimary = null;

            objSystemUserList = objProtocolBL.GetAllSystemUserExternal();

            foreach (var item in objSystemUserList)
            {
                #region Add Main Nodes
                //case "-1": // 1. Add Main nodes:
                nodePrimary      = new TreeNode();
                nodePrimary.Text = item.v_UserName;
                nodePrimary.Name = item.i_SystemUserId.ToString();
                treeViewUserExternal.Nodes.Add(nodePrimary);
                //break;
                #endregion
            }
            treeViewUserExternal.ExpandAll();
        }
Beispiel #26
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var Path1 = Application.StartupPath;

            if (ultraValidator1.Validate(true, false).IsValid)
            {
                if (txtLabel.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (txtSubject.Text.Trim() == "")
                {
                    MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (rbCotizacion.Checked)
                {
                    ServiceBL                  oServiceBL  = new ServiceBL();
                    ProtocolBL                 oProtocolBL = new ProtocolBL();
                    ReportDocument             rp;
                    DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();

                    string ruta          = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString();
                    var    MedicalCenter = oServiceBL.GetInfoMedicalCenterSede();

                    DataSet   ds      = new DataSet();
                    var       Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString());
                    DataTable dt      = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores);
                    dt.TableName = "dtCartaCotizacion";
                    ds.Tables.Add(dt);

                    //Reporte 1
                    rp = new Reports.crReporteCotizacion01();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion1.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    //Reporte 2
                    rp = new Reports.crReporteCotizacion02();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion2.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    //Reporte 3
                    rp = new Reports.crReporteCotizacion03();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion3.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();


                    //Reporte 4
                    rp = new Reports.crReporteCotizacion04();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Cotizacion4.pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();


                    var l = oProtocolBL.CotizacionProtocoloPorEmpresaClienteId(ddlCustomerOrganization.SelectedValue.ToString());
                    HojaCotizacion.CrearHojaCotizacion(l, ddlCustomerOrganization.Text, MedicalCenter, ruta + ddlCustomerOrganization.Text + ".pdf");
                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path.Combine(ruta + ddlCustomerOrganization.Text)));

                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo2"));

                    var x = _filesNameToMerge.ToList();
                    _mergeExPDF.FilesName       = x;
                    _mergeExPDF.DestinationFile = ruta + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf";;
                    _mergeExPDF.Execute();
                }
                else if (rbCarta.Checked)
                {
                    string ruta = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString();

                    ReportDocument             rp;
                    DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions();
                    DataSet   ds      = new DataSet();
                    var       Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString());
                    DataTable dt      = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores);
                    dt.TableName = "dtCartaCotizacion";
                    ds.Tables.Add(dt);

                    rp = new Reports.crCartaPresentación();
                    rp.SetDataSource(ds);

                    rp.ExportOptions.ExportFormatType      = ExportFormatType.PortableDocFormat;
                    rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    objDiskOpt = new DiskFileDestinationOptions();
                    objDiskOpt.DiskFileName = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + ".pdf";
                    _filesNameToMerge.Add(objDiskOpt.DiskFileName);
                    rp.ExportOptions.DestinationOptions = objDiskOpt;
                    rp.Export();
                    rp.Close();

                    _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo1"));

                    var x = _filesNameToMerge.ToList();
                    _mergeExPDF.FilesName       = x;
                    _mergeExPDF.DestinationFile = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf";
                    _mergeExPDF.Execute();
                }
                //else if (rbDocumentos.Checked)
                //{
                //    List<string> ArchivoAdjunto = new List<string>();
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Acreditacion.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Recomendaciones.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Informacion.pdf");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\Mapa.pdf");

                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\PLANTILLA.xlsx");
                //    ArchivoAdjunto.Add(Path1 + @"\Archivos\FICHA CLIENTE.xlsx");
                //}
                EmailBL  oEmailBL  = new EmailBL();
                emailDto oemailDto = new emailDto();
                oemailDto.v_Email = txtLabel.Text;
                OperationResult objOperationResult = new OperationResult();
                oEmailBL.AddEmail(ref objOperationResult, oemailDto);
                this.Enabled = false;
                _frmWaiting.Show(this);
                RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage();
                packageForSave.NombreEmpresaCliente = ddlCustomerOrganization.Text;
                backgroundWorker1.RunWorkerAsync(packageForSave);
            }
        }
Beispiel #27
0
        private void Llamar()
        {
            OperationResult             objOperationResult   = new OperationResult();
            List <ServiceComponentList> ListServiceComponent = new List <ServiceComponentList>();
            CalendarBL          objCalendarBL   = new CalendarBL();
            CalendarList        objCalendar     = new CalendarList();
            List <CalendarList> objCalendarList = new List <CalendarList>();
            ProtocolBL          oProtocolBL     = new ProtocolBL();

            ServiceBL           objServiceBL           = new ServiceBL();
            servicecomponentDto objservicecomponentDto = new servicecomponentDto();

            _ServiceComponentId = new List <string>();

            // Verificar si un componente está en la categoría
            MedicalExamBL oMedicalExamBL = new MedicalExamBL();

            Boolean Resultado = oMedicalExamBL.VerificarComponentePorCategoria(_categoriaId, Constants.ELECTROCARDIOGRAMA_ID);

            if (Resultado)
            {
                List <ServiceComponentFieldValuesList> Valores = objServiceBL.ValoresComponente(_serviceId, Constants.ANTROPOMETRIA_ID);
                decimal ValorIMCServicio  = decimal.Parse(Valores.Find(p => p.v_ComponentFieldId == Constants.ANTROPOMETRIA_IMC_ID).v_Value1.ToString());
                decimal ValorIMCProtocolo = decimal.Parse(oProtocolBL.GetProtocolComponentByProtocol(ref objOperationResult, _ProtocolId, Constants.ELECTROCARDIOGRAMA_ID).r_Imc.ToString());

                if (ValorIMCServicio < ValorIMCProtocolo)
                {
                    MessageBox.Show("El I.M.C. del paciente tiene valores normales, no aplica para este examen", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }


            //Validación de Piso
            if (_Piso != "-1")
            {
                var ResultPiso = objServiceBL.PermitirLlamar(_serviceId, int.Parse(_Piso.ToString()));
                if (!ResultPiso)
                {
                    MessageBox.Show("El Paciente tiene consultorios por culminar, antes de ser llamado por este. Verifíquelo en unos minutos", "INFORMACIÓN!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (int.Parse(_serviceStatusId) == (int)ServiceStatus.EsperandoAptitud)
            {
                MessageBox.Show("Este paciente ya tiene el servicio en espera de Aptitud, no puede ser llamado.", "INFORMACIÓN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                return;
            }

            if (_IsCall == "OcupadoLlamado")
            {
                DialogResult Result = MessageBox.Show("¿Está seguro de LLAMAR a este paciente que está ocupado?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (Result == DialogResult.No)
                {
                    return;
                }
            }

            objCalendar.v_Pacient            = grdListaLlamando.Selected.Rows[0].Cells["v_Pacient"].Value.ToString();
            objCalendar.v_OrganizationName   = grdListaLlamando.Selected.Rows[0].Cells["v_WorkingOrganizationName"].Value.ToString();
            objCalendar.v_ServiceComponentId = grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString();

            if (_categoryId == -1)
            {
                _ServiceComponentId.Add(grdListaLlamando.Selected.Rows[0].Cells["v_ServiceComponentId"].Value.ToString());
            }
            else
            {
                foreach (var item in objServiceBL.GetServiceComponentByCategoryId(ref objOperationResult, _categoryId, _serviceId))
                {
                    _ServiceComponentId.Add(item.v_ServiceComponentId);
                }
            }

            // Cargar grilla de llamando al paciente  ************
            objCalendarList.Add(objCalendar);
            grdLlamandoPaciente.DataSource = objCalendarList;

            if (grdLlamandoPaciente.Rows.Count > 0)
            {
                grdLlamandoPaciente.Rows[0].Selected = true;
            }

            //*******************************************************

            for (int i = 0; i < _ServiceComponentId.Count; i++)
            {
                objservicecomponentDto = new servicecomponentDto();
                objservicecomponentDto.v_ServiceComponentId = _ServiceComponentId[i];
                objservicecomponentDto.i_QueueStatusId      = (int)Common.QueueStatusId.LLAMANDO;
                objservicecomponentDto.v_NameOfice          = cbOficina.Text.ToString();
                objServiceBL.UpdateServiceComponentOfficeLlamando(objservicecomponentDto);
            }

            //Actualizar grdDataServiceComponent
            ListServiceComponent = objServiceBL.GetServiceComponents(ref objOperationResult, _serviceId);
            grdDataServiceComponent.DataSource = ListServiceComponent;

            grdListaLlamando.Enabled    = false;
            grdLlamandoPaciente.Enabled = true;
            btnRefresh.Enabled          = false;

            chkHability.Enabled = true;

            btnLlamar.Enabled = false;
        }
Beispiel #28
0
        private void frmServiceOrderEdit_Load(object sender, EventArgs e)
        {
            OperationResult objOperationResult = new OperationResult();
            List <ProtocolComponentList> oProtocolComponentList = new List <BE.ProtocolComponentList>();
            ProtocolBL   oProtocolBL = new ProtocolBL();
            ProtocolList objProtocol = new ProtocolList();
            float        CostoTotal  = 0;


            Utils.LoadDropDownList(ddlStatusOrderServiceId, "Value1", "Id", BLL.Utils.GetSystemParameterForCombo(ref objOperationResult, 194, null), DropDownListAction.Select);
            Utils.LoadDropDownList(cbLineaCredito, "Value1", "Id", BLL.Utils.GetDataHierarchyForCombo(ref objOperationResult, 122, null), DropDownListAction.Select);

            if (_Mode == "New")
            {
                txtNroTrabajadores.Select();
                int Year      = DateTime.Now.Year;
                int Month     = DateTime.Now.Month;
                int intNodeId = int.Parse(Globals.ClientSession.GetAsList()[0]);
                txtNroDocument.Text = GenerarCorrelativo(Year, Month, Sigesoft.Node.WinClient.BLL.Utils.GetNextSecuentialNoSave(intNodeId, 101)) + "-" + intNodeId;
                txtDateTime.Text    = DateTime.Now.Date.ToString();

                ddlStatusOrderServiceId.SelectedValue = ((int)Common.ServiceOrderStatus.Iniciado).ToString();
                if (_ProtocolId != "")
                {
                    oProtocolComponentList = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId);


                    var x = oProtocolComponentList.FindAll(P => P.r_Price != 0); // eliminamos los componentes con precio 0
                    foreach (var item in x)
                    {
                        CostoTotal += (float)item.r_Price;
                    }

                    //grdData.DataSource = x;
                    txtTotal.Text = CostoTotal.ToString();
                    //txtTotalTrabajadores.Text =

                    objProtocol = oProtocolBL.GetProtocolById(ref objOperationResult, _ProtocolId);

                    txtProtocolName.Text = objProtocol.v_Protocol;
                    txtOrganitation.Text = objProtocol.v_Organization;
                    txtContact.Text      = objProtocol.v_ContacName;
                    txtAdress.Text       = objProtocol.v_Address;
                    txttypeProtocol.Text = objProtocol.v_EsoType;
                }

                this.Height             = 517;
                groupBox1.Height        = 47;
                this.groupBox2.Location = new System.Drawing.Point(13, 98);
            }
            else
            {
                _oserviceorderDto = _oServiceOrderBL.GetServiceOrder(ref objOperationResult, _ServiceOrderId);

                //txtNroTrabajadores.Text = _oserviceorderDto.i_NumberOfWorker.ToString();
                txtNroDocument.Text = _oserviceorderDto.v_CustomServiceOrderId;
                txtComentary.Text   = _oserviceorderDto.v_Comentary;
                //txtCostoTotal.Text = _oserviceorderDto.r_TotalCost.ToString();
                txtDateTime.Text          = _oserviceorderDto.d_InsertDate.Value.Date.ToString();
                txtTotal.Text             = _oserviceorderDto.r_TotalCost.ToString();
                txtTotalTrabajadores.Text = _oserviceorderDto.i_NumberOfWorker.ToString();
                if (_oserviceorderDto.d_DeliveryDate == null)
                {
                    dtpDelirevy.Checked = false;
                }
                else
                {
                    dtpDelirevy.Checked = true;
                    dtpDelirevy.Value   = (DateTime)_oserviceorderDto.d_DeliveryDate;
                }

                if (_oserviceorderDto.i_MostrarPrecio == 1 || _oserviceorderDto.i_MostrarPrecio == null)
                {
                    rbSi.Checked = true;
                    rbNo.Checked = false;
                }
                else
                {
                    rbNo.Checked = true;
                    rbSi.Checked = false;
                }

                if (_oserviceorderDto.i_EsProtocoloEspecial == 1)
                {
                    chkProtocoloEspecial.Checked = true;
                }
                else
                {
                    chkProtocoloEspecial.Checked = false;
                }

                ddlStatusOrderServiceId.SelectedValue = _oserviceorderDto.i_ServiceOrderStatusId.ToString();
                cbLineaCredito.SelectedValue          = _oserviceorderDto.i_LineaCreditoId.ToString();

                // oProtocolComponentList = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId);

                //var x = oProtocolComponentList.FindAll(P => P.r_Price != 0); // eliminamos los componentes con precio 0
                //foreach (var item in x)
                // {
                //     CostoTotal += (float)item.r_Price;
                // }

                //grdData.DataSource = x;


                //objProtocol = oProtocolBL.GetProtocolById(ref objOperationResult, _ProtocolId);

                //txtProtocolName.Text = objProtocol.v_Protocol;
                //txtOrganitation.Text = objProtocol.v_Organization;
                //txtContact.Text = objProtocol.v_ContacName;
                //txtAdress.Text = objProtocol.v_Address;
                //txttypeProtocol.Text = objProtocol.v_EsoType;
                //txtTotal.Text =


                _TempServiceOrderDetail = _oServiceOrderBL.GetServiceOrderPagedAndFiltered(ref objOperationResult, 0, null, "", "v_ServiceOrderId==" + "\"" + _oserviceorderDto.v_ServiceOrderId + "\"");


                grdData1.DataSource = _TempServiceOrderDetail;

                _ProtocolId = _TempServiceOrderDetail[0].v_ProtocolId;
            }
        }
Beispiel #29
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            OperationResult objOperationResult   = new OperationResult();
            ServiceOrderBL  oServiceOrderlBL     = new ServiceOrderBL();
            ProtocolBL      oProtocolBL          = new ProtocolBL();
            ProtocolList    oProtocolList        = new ProtocolList();
            int             CantidadTrabajadores = 0;

            #region
            if (txtProtocolName.Text.Trim() == String.Empty)
            {
                MessageBox.Show("Por favor seleccione un Protocolo.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (txtNroTrabajadores.Text.Trim() == "" || txtNroTrabajadores.Text.Trim() == "0")
            {
                MessageBox.Show("El N° de Trabajadores no puede ser 0 o vacío", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (CantidadTrabajadores.ToString() != "")
            {
                CantidadTrabajadores = int.Parse(txtNroTrabajadores.Text.ToString());
            }


            float CostoTotal        = 0;
            int   TotalTrabajadores = 0;


            #endregion
            if (_TempServiceOrderDetail == null)
            {
                _TempServiceOrderDetail = new List <ServiceOrderDetailList>();
            }

            grdData1.DataSource        = new ServiceOrderDetailList();
            _objServiceOrderDetailList = new ServiceOrderDetailList();

            oProtocolList = oProtocolBL.GetProtocolById(ref objOperationResult, _ProtocolId);
            //Buscar si un producto ya esta en la Grilla
            var findResult = _TempServiceOrderDetail.Find(p => p.v_ProtocolId == _ProtocolId);

            if (findResult == null)
            {
                _objServiceOrderDetailList.v_ProtocolId             = _ProtocolId;
                _objServiceOrderDetailList.v_ProtocolName           = oProtocolList.v_Name;
                _objServiceOrderDetailList.i_NumberOfWorkerProtocol = CantidadTrabajadores;
                _objServiceOrderDetailList.r_ProtocolPrice          = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId).Sum(s => s.r_Price);
                _objServiceOrderDetailList.r_Total = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId).Sum(s => s.r_Price) * CantidadTrabajadores;
                _TempServiceOrderDetail.Add(_objServiceOrderDetailList);
                grdData1.DataSource = _TempServiceOrderDetail;
            }
            else
            {
                var findIndex = _TempServiceOrderDetail.FindIndex(p => p.v_ProtocolId == _ProtocolId);

                _objServiceOrderDetailList.v_ProtocolId             = _ProtocolId;
                _objServiceOrderDetailList.v_ProtocolName           = oProtocolList.v_Name;
                _objServiceOrderDetailList.i_NumberOfWorkerProtocol = CantidadTrabajadores;
                _objServiceOrderDetailList.r_ProtocolPrice          = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId).Sum(s => s.r_Price);
                _objServiceOrderDetailList.r_Total = oProtocolBL.GetProtocolComponents(ref objOperationResult, _ProtocolId).Sum(s => s.r_Price) * CantidadTrabajadores;
                _TempServiceOrderDetail.Add(_objServiceOrderDetailList);
                _TempServiceOrderDetail.RemoveAt(findIndex);
                grdData1.DataSource = _TempServiceOrderDetail;
            }

            grdData1.Refresh();

            //Limpiar controles

            txtProtocolName.Text    = string.Empty;
            txtOrganitation.Text    = string.Empty;
            txtContact.Text         = string.Empty;
            txtAdress.Text          = string.Empty;
            txttypeProtocol.Text    = string.Empty;
            txtNroTrabajadores.Text = string.Empty;



            //_TempServiceOrderDetail = oServiceOrderlBL.GetServiceOrderDetailList(_ProtocolId);

            foreach (var item in _TempServiceOrderDetail)
            {
                CostoTotal        += (float)item.r_Total;
                TotalTrabajadores += (int)item.i_NumberOfWorkerProtocol;
            }

            //grdData.DataSource = _TempServiceOrderDetail;
            txtTotal.Text             = CostoTotal.ToString();
            txtTotalTrabajadores.Text = TotalTrabajadores.ToString();
            //Calcular();
        }
Beispiel #30
0
        private void btnReportePDF_Click(object sender, EventArgs e)
        {
            ProtocolBL             oProtocolBL = new ProtocolBL();
            List <ServiceOrderPdf> Lista       = new List <ServiceOrderPdf>();
            ServiceOrderPdf        oServiceOrderPdf;

            DialogResult    Result             = MessageBox.Show("¿Desea publicar a la WEB?", "ADVERTENCIA!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            OperationResult objOperationResult = new OperationResult();

            List <ProtocolComponentList> ListaComponentes = new List <ProtocolComponentList>();
            SecurityBL oSecurityBL = new SecurityBL();

            ServiceOrderDetailPdf        oServiceOrderDetailPdf;
            List <ServiceOrderDetailPdf> ListaServiceOrderDetailPdf = new List <ServiceOrderDetailPdf>();

            SystemUserList oSystemUserList = new SystemUserList();

            //saveFileDialog1.FileName = "Orden de Servicio";
            //saveFileDialog1.Filter = "Files (*.pdf;)|*.pdf;";

            //if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            //{

            using (new LoadingClass.PleaseWait(this.Location, "Generando..."))
            {
                this.Enabled = false;
                var MedicalCenter   = _serviceBL.GetInfoMedicalCenterSede();
                var pEmpresaCliente = new ProtocolBL().GetEmpresaByProtocoloId(_ProtocolId)[0].v_Name;
                var _DataService    = oProtocolBL.GetProtocolById(ref objOperationResult, _ProtocolId);

                foreach (var Protocolo in _TempServiceOrderDetail)
                {
                    oServiceOrderPdf = new ServiceOrderPdf();
                    //Llenar cabecera
                    var oProtocolo = oProtocolBL.GetProtocolById(ref objOperationResult, Protocolo.v_ProtocolId);
                    oServiceOrderPdf.v_ServiceOrderId = _ServiceOrderId;
                    oServiceOrderPdf.EmpresaCliente   = oProtocolo.v_OrganizationInvoice + " / " + oProtocolo.v_GroupOccupation + " / " + oProtocolo.v_EsoType;

                    //Llenar Detalle
                    ListaComponentes           = oProtocolBL.GetProtocolComponents(ref objOperationResult, Protocolo.v_ProtocolId);
                    ListaServiceOrderDetailPdf = new List <ServiceOrderDetailPdf>();
                    foreach (var Componente in ListaComponentes)
                    {
                        oServiceOrderDetailPdf = new ServiceOrderDetailPdf();
                        oServiceOrderDetailPdf.v_ServiceOrderDetailId = _TempServiceOrderDetail.Find(p => p.v_ProtocolId == Protocolo.v_ProtocolId).v_ServiceOrderDetailId;
                        oServiceOrderDetailPdf.v_ServiceOrderId       = _ServiceOrderId;
                        oServiceOrderDetailPdf.v_ComponentId          = Componente.v_ComponentId;
                        oServiceOrderDetailPdf.Componente             = Componente.v_ComponentName;
                        oServiceOrderDetailPdf.v_Precio = Componente.r_Price;
                        ListaServiceOrderDetailPdf.Add(oServiceOrderDetailPdf);
                    }
                    oServiceOrderPdf.DetalleServiceOrder = ListaServiceOrderDetailPdf;
                    oServiceOrderPdf.TotalProtocolo      = ListaServiceOrderDetailPdf.Sum(s => s.v_Precio);
                    Lista.Add(oServiceOrderPdf);
                }

                //obtener profesion del usuario
                var SystemUserId = Globals.ClientSession.i_SystemUserId;

                oSystemUserList = oSecurityBL.GetSystemUserAndProfesional(ref objOperationResult, SystemUserId);

                string ruta = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString();



                if (chkProtocoloEspecial.Checked)
                {
                    OrdenServicioPromocion.CrearOrdenServicio(rbSi.Checked ? true : false, Lista, MedicalCenter, pEmpresaCliente, DateTime.Parse(txtDateTime.Text).ToString("dd 'd'e MMMM 'd'e yyyy"), oSystemUserList.Profesion + ". " + oSystemUserList.v_PersonName, ruta + _ServiceOrderId + ".pdf");
                }
                else
                {
                    OrdenServicio.CrearOrdenServicio(rbSi.Checked ? true : false, Lista, MedicalCenter, pEmpresaCliente, _ServiceOrderId, DateTime.Parse(txtDateTime.Text).ToString("dd 'd'e MMMM 'd'e yyyy"), oSystemUserList.Profesion + ". " + oSystemUserList.v_PersonName, ruta + _ServiceOrderId + ".pdf");
                }

                this.Enabled = true;
                //}
            }
        }