private void grd_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            if (grd.Selected.Rows.Count != 0)
            {
                string protocolName = grd.Selected.Rows[0].Cells["v_Protocol"].Value.ToString();
                float  Total        = 0;
                _protocolId = grd.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();

                gbProtocolComponents.Text = string.Format("Comp. del Prot. < {0} >", protocolName);

                // Cargar componentes de un protocolo seleccionado
                OperationResult objOperationResult = new OperationResult();
                var             dataListPc         = _protocolBL.GetProtocolComponents(ref objOperationResult, _protocolId);

                grdProtocolComponent.DataSource = dataListPc;

                lblRecordCountProtocolComponents.Text = string.Format("Se encontraron {0} registros.", dataListPc.Count());

                foreach (var item in dataListPc)
                {
                    Total = Total + item.r_Price.Value;
                }
                lblCostoTotal.Text = Total.ToString();
                if (objOperationResult.Success != 1)
                {
                    MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        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.
                }
            }
        }
Exemple #3
0
        private void grdProtocols_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
        {
            if (grdProtocols.Selected.Rows.Count == 0)
            {
                return;
            }

            var protocolId = grdProtocols.Selected.Rows[0].Cells["v_ProtocolId"].Value.ToString();

            var dataListPc = _protocolBl.GetProtocolComponents(ref _operationResult, protocolId).ToList();

            grdComponents.DataSource = dataListPc;

            lblRecordCountProtocolComponents.Text = string.Format("Se encontraron {0} registros.", dataListPc.Count);
        }
        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());
        }
        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;
            }
        }
Exemple #6
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;
                //}
            }
        }
Exemple #7
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();
        }
Exemple #8
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;
            }
        }
        private void LoadData()
        {
            OperationResult objOperationResult = new OperationResult();

            #region Mayusculas - Normal
            var _EsMayuscula = int.Parse(Common.Utils.GetApplicationConfigValue("EsMayuscula"));
            if (_EsMayuscula == 1)
            {
                SearchControlAndSetEvents(this);
            }


            #endregion

            LoadComboBox();
            BindGridSystemUserExternal();

            if (_mode == "New")
            {
                // Additional logic here.
                txtProtocolName.Select();
            }
            else if (_mode == "Edit")
            {
                _protocolDTO = _protocolBL.GetProtocol(ref objOperationResult, _protocolId);
                string idOrgInter = "-1";

                // cabecera del protocolo
                txtProtocolName.Text         = _protocolDTO.v_Name;
                cbEsoType.SelectedValue      = _protocolDTO.i_EsoTypeId.ToString();
                cbOrganization.SelectedValue = string.Format("{0}|{1}", _protocolDTO.v_EmployerOrganizationId, _protocolDTO.v_EmployerLocationId);
                // Almacenar temporalmente
                _protocolName = txtProtocolName.Text;

                if (_protocolDTO.v_WorkingOrganizationId != "-1" && _protocolDTO.v_WorkingLocationId != "-1")
                {
                    idOrgInter = string.Format("{0}|{1}", _protocolDTO.v_WorkingOrganizationId, _protocolDTO.v_WorkingLocationId);
                }

                cbIntermediaryOrganization.SelectedValue = idOrgInter;
                cbOrganizationInvoice.SelectedValue      = string.Format("{0}|{1}", _protocolDTO.v_CustomerOrganizationId, _protocolDTO.v_CustomerLocationId);
                cbGeso.SelectedValue        = _protocolDTO.v_GroupOccupationId;
                cbServiceType.SelectedValue = _protocolDTO.i_MasterServiceTypeId.ToString();
                cbService.SelectedValue     = _protocolDTO.i_MasterServiceId.ToString();
                txtCostCenter.Text          = _protocolDTO.v_CostCenter;
                chkIsHasVigency.Checked     = Convert.ToBoolean(_protocolDTO.i_HasVigency);
                txtValidDays.Enabled        = chkIsHasVigency.Checked;
                txtValidDays.Text           = _protocolDTO.i_ValidInDays.ToString();
                chkIsActive.Checked         = Convert.ToBoolean(_protocolDTO.i_IsActive);
                cboVendedor.Text            = _protocolDTO.v_NombreVendedor;
                // Componentes del protocolo
                var dataListPc = _protocolBL.GetProtocolComponents(ref objOperationResult, _protocolId);

                grdProtocolComponent.DataSource = dataListPc;

                _tmpProtocolcomponentList = dataListPc;
                lblRecordCount2.Text      = string.Format("Se encontraron {0} registros.", dataListPc.Count());

                if (objOperationResult.Success != 1)
                {
                    MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (_mode == "Clon")
            {
                txtProtocolName.Select();

                // Componentes del protocolo
                var dataListPc = _protocolBL.GetProtocolComponents(ref objOperationResult, _protocolId);

                grdProtocolComponent.DataSource = dataListPc;

                _tmpProtocolcomponentList = dataListPc;
                lblRecordCount2.Text      = string.Format("Se encontraron {0} registros.", dataListPc.Count());

                if (objOperationResult.Success != 1)
                {
                    MessageBox.Show("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (uvPacient.Validate(true, false).IsValid)
            {
                OperationResult operationResult = new OperationResult();
                FileInfoDto     fileInfo        = null;

                //Verificar si algun registro no tiene ruta asignada

                foreach (var item in _rutas)
                {
                    if (item.RutaLarga == "")
                    {
                        if (MessageBox.Show("El trabajador " + item.Paciente + " no tiene un archivo asignado, ¿Desea Continuar?", "Advertencia", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return;
                        }
                        ;
                    }
                }

                foreach (var item in _rutas)
                {
                    //Obtener CategoriaId
                    var oKeyValues  = (KeyValueDTO)ddlComponentId.SelectedItem;
                    var CategoriaId = oKeyValues.Value4;

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

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



                    //var eee = (KeyValueDTO)ddlComponentId.SelectedItem;

                    //Obtener el ServicecomponentId

                    var oserviceComponent = oServiceBL.GetServiceComponentByServiceIdAndComponentId(item.ServicioId, OrdenDescListaComponentesCategoria[0].v_ComponentId);

                    if (oserviceComponent != null)
                    {
                        string serviceComponentId = oserviceComponent.v_ServiceComponentId;


                        if (item.RutaLarga != "")
                        {
                            var fileSize = Convert.ToInt32(Convert.ToSingle(Common.Utils.GetFileSizeInMegabytes(item.RutaLarga)));
                            if (fileSize > 7)
                            {
                                MessageBox.Show("La imagen que está tratando de subir es damasiado grande.\nEl tamaño maximo es de 7 MB.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return;
                            }


                            // Seteaar propiedades del control PictutreBox
                            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

                            _multimediaFileBL.AddMultimediaFileComponent(ref operationResult, fileInfo, Globals.ClientSession.GetAsList());
                        }
                    }
                }


                MessageBox.Show("Se adjuntaron los archivos correctamente", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Por favor corrija la información ingresada. Vea los indicadores de error.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void LoadData()
        {
            OperationResult objOperationResult = new OperationResult();
            string          Mode = Request.QueryString["Mode"].ToString();

            if (Mode == "New")
            {
                Session["ListaCompletaComponentes"] = null;
                BindGridNew();
            }
            else if (Mode == "Edit")
            {
                string ProtocolId = null;
                string idOrgInter = "-1";

                if (Request.QueryString["v_ProtocolId"] != null)
                {
                    ProtocolId = Request.QueryString["v_ProtocolId"].ToString();
                }
                Session["ProtocolId"] = ProtocolId;
                _protocolDTO          = _protocolBL.GetProtocol(ref objOperationResult, ProtocolId);

                // cabecera del protocolo
                txtProtocolName.Text         = _protocolDTO.v_Name;
                cbEsoType.SelectedValue      = _protocolDTO.i_EsoTypeId.ToString();
                cbOrganization.SelectedValue = string.Format("{0}|{1}", _protocolDTO.v_EmployerOrganizationId, _protocolDTO.v_EmployerLocationId);


                if (_protocolDTO.v_WorkingOrganizationId != "-1" && _protocolDTO.v_WorkingLocationId != "-1")
                {
                    idOrgInter = string.Format("{0}|{1}", _protocolDTO.v_WorkingOrganizationId, _protocolDTO.v_WorkingLocationId);
                }

                cbIntermediaryOrganization.SelectedValue = idOrgInter;
                cbOrganizationInvoice.SelectedValue      = string.Format("{0}|{1}", _protocolDTO.v_CustomerOrganizationId, _protocolDTO.v_CustomerLocationId);

                LoadcbGESO();
                cbGeso.SelectedValue        = _protocolDTO.v_GroupOccupationId;
                cbServiceType.SelectedValue = _protocolDTO.i_MasterServiceTypeId.ToString();
                LoadcbServiceType();
                cbService.SelectedValue = _protocolDTO.i_MasterServiceId.ToString();
                txtCostCenter.Text      = _protocolDTO.v_CostCenter;

                // Componentes del protocolo
                var dataListPc = _protocolBL.GetProtocolComponents(ref objOperationResult, ProtocolId);
                dataListPc.Sort((y, x) => x.v_CategoryName.CompareTo(y.v_CategoryName));
                //Obtener Lista Completa de Componentes

                var ListaCompletaComponentes = GetData(grdData.PageIndex, grdData.PageSize, "v_CategoryName,v_Name,AtSchool", "");
                ListaCompletaComponentes.Sort((y, x) => x.v_CategoryName.CompareTo(y.v_CategoryName));

                foreach (var Componentes in ListaCompletaComponentes)
                {
                    foreach (var ProtocoloComponente in dataListPc)
                    {
                        if (ProtocoloComponente.v_ComponentId == Componentes.v_ComponentId)
                        {
                            Componentes.AtSchool     = true;
                            Componentes.r_Price      = ProtocoloComponente.r_Price;
                            Componentes.Adicional    = ProtocoloComponente.i_isAdditional == 0 ? false : true;
                            Componentes.Condicional  = ProtocoloComponente.i_IsConditionalId == 0 ? false : true;
                            Componentes.i_OperatorId = int.Parse(ProtocoloComponente.i_OperatorId.ToString());
                            Componentes.i_Age        = ProtocoloComponente.i_Age;
                            Componentes.i_GenderId   = int.Parse(ProtocoloComponente.i_GenderId.ToString());
                            //System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)row.FindControl("ddlGender");
                            //Componentes.
                        }
                    }
                }
                // obligatorio para que los controles se dibujen en orden adecuado

                ListaCompletaComponentes.Sort((y, x) => x.AtSchool.CompareTo(y.AtSchool));

                Session["ListaCompletaComponentes"] = ListaCompletaComponentes;
                grdData.DataSource = ListaCompletaComponentes;
                grdData.DataBind();
            }
        }