public SessionInfoDto()
        {
            AdditionalUsers = new SessionUserInfo[] { };

            PlayableMediaTypes = new string[] { };
            SupportedCommands  = new string[] { };
        }
Exemple #2
0
        /// <summary>
        ///     Renders the template for the email body to a string (~/Views/CoaBooking/Email.cshtml)
        /// </summary>
        private async Task <string> GetEmailBody()
        {
            //user information
            SessionUserInfo user = _session.GetUserInformation();

            // booking information
            CoaSessionBookingInfo booking = _session.CoaBookingInfo;

            //set ViewModel for the email
            var viewModel = new EmailViewModel
            {
                EmailAddress       = user.Email,
                Phone              = user.Phone,
                CourtFileNumber    = booking.CaseNumber,
                RelatedCaseList    = booking.RelatedCaseList,
                CaseType           = booking.CaseType,
                TypeOfConference   = booking.HearingTypeName,
                HearingLength      = booking.IsFullDay ?? false ? "Full Day" : "Half Day",
                Date               = booking.SelectedDate?.ToString("dddd, MMMM dd, yyyy") ?? "",
                RelatedCasesString = ""
            };

            if (booking.RelatedCaseList != null && booking.RelatedCaseList.Any())
            {
                viewModel.RelatedCasesString = "\nRELATED FILE NUMBER(S):\n" + string.Join(", ", booking.RelatedCaseList) + "\n";
            }


            var template = $"CoaBooking/EmailText";

            //Render the email template
            return(await _viewRenderService.RenderToStringAsync(template, viewModel));
        }
        public SessionInfo(ISessionManager sessionManager, ILogger logger)
        {
            _sessionManager = sessionManager;
            _logger         = logger;

            AdditionalUsers = new SessionUserInfo[] { };
            PlayState       = new PlayerStateInfo();
        }
        public List <EstadoInfo> ListarProvincia(SessionUserInfo ObjSessionUserInfo)
        {
            List <EstadoInfo> lista  = new List <EstadoInfo>();
            Estado            module = new Estado("conexion");

            lista = module.ListByPais("593"); //593 Ecuador

            return(lista);
        }
Exemple #5
0
        public IActionResult CaseConfirm()
        {
            CoaSessionBookingInfo bookingInfo = _session.CoaBookingInfo;

            if (string.IsNullOrEmpty(bookingInfo.CaseNumber))
            {
                return(Redirect("/scjob/booking/coa/CaseSearch"));
            }

            //user information
            SessionUserInfo cui = _session.GetUserInformation();

            //Swapping Case Number to the main case file if it was selected from the search result of a sub case file number
            if (bookingInfo.CaseList.Length > 1)
            {
                var mainCase        = bookingInfo.CaseList.Where(x => x.Main).First();
                var finalCaseNumber = bookingInfo.SelectedCases.Where(x => x == mainCase.Case_Num).FirstOrDefault() ?? bookingInfo.CaseNumber;
                //Store final main case number back to the session
                bookingInfo.CaseNumber = finalCaseNumber;

                //Filtering out related cases
                var relatedCaseList = new List <string>();
                foreach (var x in bookingInfo.SelectedCases)
                {
                    if (x != finalCaseNumber)
                    {
                        relatedCaseList.Add(x);
                    }
                }
                //Store final main case number back to the session
                bookingInfo.RelatedCaseList = relatedCaseList;
            }

            //Time-slot is still available
            var model = new CoaCaseConfirmViewModel
            {
                CaseNumber             = bookingInfo.CaseNumber,
                CaseType               = bookingInfo.CaseType,
                CertificateOfReadiness = bookingInfo.CertificateOfReadiness,
                DateIsAgreed           = bookingInfo.DateIsAgreed,
                //LowerCourtOrder = bookingInfo.LowerCourtOrder,
                IsFullDay       = bookingInfo.IsFullDay,
                HearingTypeId   = bookingInfo.HearingTypeId,
                HearingTypeName = bookingInfo.HearingTypeName,
                SelectedDate    = bookingInfo.SelectedDate,
                EmailAddress    = cui.Email,
                Phone           = cui.Phone,
                CaseList        = bookingInfo.CaseList,
                SelectedCases   = bookingInfo.SelectedCases,
                RelatedCaseList = bookingInfo.RelatedCaseList
            };

            // save the booking info back to the session
            _session.CoaBookingInfo = bookingInfo;

            return(View(model));
        }
        public List <TipoDocumentoInfo> ListarTipoDocumento(SessionUserInfo ObjSessionUserInfo)
        {
            List <TipoDocumentoInfo> lista = new List <TipoDocumentoInfo>();

            Application.Enterprise.Business.TipoDocumento module = new Application.Enterprise.Business.TipoDocumento("conexion");

            lista = module.List();

            return(lista);
        }
Exemple #7
0
        /// <summary>
        /// 离线
        /// </summary>
        public override System.Threading.Tasks.Task OnDisconnected(bool stopCalled)
        {
            UserInfo = GetSignalrUserInfo();
            var item = OnLineUsers.FirstOrDefault(x => x.Id == UserInfo.Id);

            if (item != null)
            {
                //Clients.All.onUserDisconnected(item.Id, item.UserName); //调用客户端用户离线通知
                OnLineUsers.Remove(item);
            }
            return(base.OnDisconnected(stopCalled));
        }
        /// <summary>
        ///     Renders the template for the email body to a string (~/Views/ScBooking/Email.cshtml)
        /// </summary>
        private async Task <string> GetEmailBody()
        {
            //user information
            SessionUserInfo user = _session.GetUserInformation();

            //booking information
            var booking = _session.ScBookingInfo;

            //set ViewModel for the email
            var viewModel = new EmailViewModel
            {
                EmailAddress        = user.Email,
                Phone               = user.Phone,
                CourtFileNumber     = _session.ScBookingInfo.CaseNumber,
                CaseLocationName    = booking.CaseLocationName,
                BookingLocationName = booking.BookingLocationName,
                TypeOfConference    = booking.HearingTypeName,
                Date = booking.DateFriendlyName,
                Time = booking.TimeSlotFriendlyName
            };

            //Render the email template
            string template;

            switch (booking.HearingTypeId)
            {
            case ScHearingType.AWS:
                template = "ScBooking/Email-CV-AWS";
                break;

            case ScHearingType.JMC:
                template = "ScBooking/Email-JMC";
                break;

            case ScHearingType.PTC:
                template = "ScBooking/Email-CV-PTC";
                break;

            case ScHearingType.TCH:
                template = "ScBooking/Email-CV-TCH";
                break;

            case ScHearingType.TMC:
                template = "ScBooking/Email-TMC";
                break;

            default:
                throw new ArgumentException("Invalid HearingTypeId");
            }

            return(await _viewRenderService.RenderToStringAsync(template, viewModel));
        }
    protected void Button_Login_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            // 本サンプルではSession["LoginId"]に値が存在することをLogin済みとします。
            // 実際は用意された認証の仕組みを使用しますが、通常の現場では導入済みであることが多いので
            // 今回はセッションを利用する感覚を覚えるという事で割り切ってください
            Session[SessionUserInfo.SESSION_KEY] = SessionUserInfo.GetSessionUserInfo(GetLoginId().Value);

            // Role取得
            Response.Redirect("~/kentaro/SampleProject/Default.aspx");
        }
    }
Exemple #10
0
 protected override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     model = (SessionUserInfo)Session["UserInfo"];
     if (model == null)
     {
         filterContext.Result = new ContentResult()
         {
             Content         = "{\"IsLogin\":0,\"Msg\":\"未登录,请先登陆\"}",
             ContentEncoding = Encoding.UTF8,
             ContentType     = "application/json"
         };
     }
     base.OnActionExecuting(filterContext);
 }
        public List <VendedorInfo> LoadZonasxRegion(SessionUserInfo ObjSessionUserInfo)
        {
            List <VendedorInfo> lista       = new List <VendedorInfo>();
            Vendedor            objVendedor = new Vendedor("conexion");

            if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesZona) || ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.Lider))
            {
                lista.Add(objVendedor.ListxCodVendedor(ObjSessionUserInfo.IdVendedor.ToString()));
            }
            else if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesRegionales))
            {
                Regionales     objRegionales     = new Regionales("conexion");
                RegionalesInfo objRegionalesInfo = new RegionalesInfo();

                objRegionalesInfo = objRegionales.ListxId(Convert.ToInt32(ObjSessionUserInfo.IdRegional));

                if (objRegionalesInfo != null)
                {
                    lista = objVendedor.ListxGerentesZonales(objRegionalesInfo.IdRegional);
                }
            }

            //-----------------------------------------------------------------------------------------------------------
            //Establece la zona del usuario logueado.

            if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesZona))
            {
                foreach (var item in lista)
                {
                    if (item.IdVendedor.Trim() == ObjSessionUserInfo.IdVendedor)
                    {
                        lista = new List <VendedorInfo>();
                        lista.Add(item);
                        break;
                    }
                }
            }
            else if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesRegionales))
            {
                lista = new List <VendedorInfo>();
            }
            if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.Lider))
            {
                lista = new List <VendedorInfo>();
            }
            //-----------------------------------------------------------------------------------------------------------

            return(lista);
        }
        public List <LiderInfo> ListarLider(SessionUserInfo ObjSessionUserInfo)
        {
            List <LiderInfo> lista  = new List <LiderInfo>();
            Lider            module = new Lider("conexion");

            lista = module.ListxZona(ObjSessionUserInfo.IdZona);


            if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesRegionales))
            {
                lista = new List <LiderInfo>();
            }

            return(lista);
        }
Exemple #13
0
        public ActionResult Register(SessionUserInfo model)
        {
            if (model.UserId <= 0)
            {
                db.UserProfile.Add(new UserProfile
                {
                    Name     = model.FirsName,
                    LastName = model.LastName,
                    Password = model.Password,
                    UserName = model.UserName,
                    Email    = model.Email,
                });
            }
            db.SaveChanges();

            return(View("Index"));
        }
Exemple #14
0
        public HttpResponseMessage Prueba()
        {
            SessionUserInfo ObjSessionUserInfo = new SessionUserInfo();

            ObjSessionUserInfo.Campana    = "Campana 2019";
            ObjSessionUserInfo.Cedula     = "1234567890";
            ObjSessionUserInfo.Usuario    = "Usuario";
            ObjSessionUserInfo.IdVendedor = DateTime.Now.ToString();

            var response = Request.CreateResponse <SessionUserInfo>(HttpStatusCode.OK, ObjSessionUserInfo);

            response.Headers.Add("Token", "");
            response.Headers.Add("TokenExpiry", ConfigurationManager.AppSettings["AuthTokenExpiry"]);
            response.Headers.Add("Access-Control-Expose-Headers", "Token,TokenExpiry");


            return(response);
        }
Exemple #15
0
        /// <summary>
        /// 发送群消息
        /// </summary>
        /// <param name="ToId">接收人ID</param>
        /// <param name="message">信息</param>
        public void sendGroupMessage(string strmodel)
        {
            UserInfo = GetSignalrUserInfo();
            Friends_GroupChat model = JsonConvert.DeserializeObject <Friends_GroupChat>(strmodel);

            model.Id       = Guid.NewGuid();
            model.SenderId = UserInfo.Id;
            ReturnModel remodel = JsonConvert.DeserializeObject <ReturnModel>(oGroupsBLL.Friend_AddGroupsChat(model).ToString());

            if (remodel.Code == 1)
            {
                var obj = new { Code = 1, Msg = "发送成功", GroupId = model.GroupId, SenderId = model.SenderId, SendType = model.SendType, SendContent = model.SendContent, SenderHeadPic = UserInfo.HeadPicture, SenderName = UserInfo.UserName, UpdateTime = DateTime.Now.ToLongTimeString() };
                Clients.Group(model.GroupId.ToString()).sendGroupMessage(obj);
            }
            else
            {
                var obj = new { Code = 0, Msg = "发送失败" };
                Clients.Caller.sendMsgTips(obj);
            }
        }
Exemple #16
0
        public List <CatalogoInfo> ListarCatalogo(SessionUserInfo ObjSessionUserInfo)
        {
            List <CatalogoInfo> lista  = new List <CatalogoInfo>();
            Catalogo            module = new Catalogo("conexion");

            if (ObjSessionUserInfo.Catalogo != null && ObjSessionUserInfo.Catalogo != "" && ObjSessionUserInfo.ZonaReservaEnLinea == "true")
            {
                lista = module.ListxId(ObjSessionUserInfo.Catalogo);
            }
            else
            {
                lista = module.ListCatalogoFechaActual();
            }

            //Si no hay catalogos se bloquea la aplicacion para la digitacion de pedidos.
            if (lista.Count == 0)
            {
                CatalogoInfo objCatalogoInfo = new CatalogoInfo();

                objCatalogoInfo.Codigo        = "N/A";
                objCatalogoInfo.Ano           = "";
                objCatalogoInfo.Estado        = false;
                objCatalogoInfo.GrupoCatalogo = "";
                objCatalogoInfo.Nombre        = "";
                objCatalogoInfo.Unineg        = "";
                objCatalogoInfo.Usuario       = "";
                objCatalogoInfo.FechaInicial  = DateTime.Now;
                objCatalogoInfo.FechaFin      = DateTime.Now;

                objCatalogoInfo.Error             = new Error();
                objCatalogoInfo.Error.Id          = -1;
                objCatalogoInfo.Error.Descripcion = "Error: No se pueden crear pedidos en este periodo. El catalogo no ha sido habilitado.";

                lista.Add(objCatalogoInfo);
            }

            return(lista);
        }
Exemple #17
0
        /// <summary>
        /// 登录连线
        /// </summary>
        public void connect()
        {
            UserInfo = GetSignalrUserInfo();
            ////获取所有的群
            //var GroupsObj = oGroupsBLL.Group_GetAllGroupsList();
            //ReturnModel<List<Friends_ChatGroup>> Groups = JsonConvert.DeserializeObject<ReturnModel<List<Friends_ChatGroup>>>(GroupsObj.ToString());
            ////遍历群判断是否存在在线群里
            //foreach (Friends_ChatGroup Group in Groups.Data)
            //{
            //    if(GroupOnLineUsers.Count(x => x.GroupId == Group.GroupId) == 0)
            //    {
            //        GroupOnLineUsers.Add(Group);
            //    }
            //}

            //var MyGroupObj = oGroupsBLL.Group_GetGroupsList(UserInfo.Id);
            //ReturnModel<List<Friends_GroupList>> MyGroups = JsonConvert.DeserializeObject<ReturnModel<List<Friends_GroupList>>>(MyGroupObj.ToString());

            ////把我加入到存在我的在线群成员里
            //foreach (Friends_GroupList MyGroup in MyGroups.Data)
            //{
            //    if (GroupOnLineUsers.First(p => p.GroupId == MyGroup.Id).GroupOnLineUserInfos != null)
            //    {
            //        if (GroupOnLineUsers.First(p => p.GroupId == MyGroup.Id).GroupOnLineUserInfos.Count(x => x.UserId == UserInfo.Id) == 0)
            //        {
            //            GroupOnLineUsers.First(p => p.GroupId == MyGroup.Id).GroupOnLineUserInfos.Add(new GroupOnLineUserInfo() { UserId = UserInfo.Id });
            //        }
            //    }
            //    else
            //    {
            //        List<GroupOnLineUserInfo> GroupOnLineUserInfos = new List<GroupOnLineUserInfo>();
            //        GroupOnLineUserInfos.Add(new GroupOnLineUserInfo { UserId = UserInfo.Id });
            //        GroupOnLineUsers.First(p => p.GroupId == MyGroup.Id).GroupOnLineUserInfos = GroupOnLineUserInfos;
            //    }
            //}

            //如果不存在
            if (OnLineUsers.Count(x => x.Id == UserInfo.Id) == 0)
            {
                //添加在线人员
                OnLineUsers.Add(UserInfo);
                //把在线人员添加到缓存
                Common.CacheHelper <List <SessionUserInfo> > .Insert("OnLineUsers", OnLineUsers);

                //获取好友列表
                var obj = oFriendsBLL.Friend_GetFriendsNewsList(UserInfo.Id);
                ReturnModel <List <ChatUserInfo> > models = JsonConvert.DeserializeObject <ReturnModel <List <ChatUserInfo> > >(obj.ToString());
                var result = new { UserId = UserInfo.Id, Msg = "您的好友 " + UserInfo.UserName + " 上线了" };
                foreach (ChatUserInfo model in models.Data)
                {
                    //标记上线的好友并加入我的在线好友集合
                    if (OnLineUsers.Count(x => x.Id == model.FriendId) > 0)
                    {
                        model.IsOnline = 1;
                        Clients.User(model.FriendId.ToString()).onLineTips(result);
                    }
                }
                //发送好友列表数据信息给自己
                Clients.Caller.getFriendsNewsList(models);
            }
        }
Exemple #18
0
        public HttpResponseMessage LoginUserPasword(Usuario objUser)
        {
            string IpAddress = GetIpClient();

            Application.Enterprise.CommonObjects.UsuariosInfo ObjUsuarioInfo = new Application.Enterprise.CommonObjects.UsuariosInfo();
            Application.Enterprise.Business.Usuarios          ObjUsuario     = new Application.Enterprise.Business.Usuarios("conexion");

            bool validate = ObjUsuario.ValidateUserSVDN_SAVED(objUser.UserName.Trim(), objUser.Passwordd.Trim());

            SessionUserInfo ObjSessionUserInfo = new SessionUserInfo();

            if (validate)
            {
                ObjUsuarioInfo = ObjUsuario.ListxUsuarioSVDN(objUser.Passwordd.Trim());
                //ObjUsuarioInfo = ObjUsuario.ListxUsuario(txtPwd.Value.Trim());

                if (ObjUsuarioInfo != null)
                {
                    ObjSessionUserInfo.ReiniciarClave = ObjUsuarioInfo.Reiniciar.ToString();

                    #region "GERENTES DE ZONA"

                    if ((ObjUsuarioInfo.IdGrupo == Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.GerentesZona)))
                    {
                        Application.Enterprise.CommonObjects.UsuarioVendedorInfo ObjUsuarioVendedorInfo = new Application.Enterprise.CommonObjects.UsuarioVendedorInfo();
                        Application.Enterprise.Business.UsuarioVendedor          ObjUsuarioVendedor     = new Application.Enterprise.Business.UsuarioVendedor("conexion");

                        ObjUsuarioVendedorInfo = ObjUsuarioVendedor.ListxClave(Application.Enterprise.CommonObjects.Tools.Encrypt(objUser.Passwordd.Trim(), true));

                        if (ObjUsuarioVendedorInfo != null)
                        {
                            Application.Enterprise.CommonObjects.VendedorInfo ObjVendedorInfo = new Application.Enterprise.CommonObjects.VendedorInfo();
                            Application.Enterprise.Business.Vendedor          ObjVendedor     = new Application.Enterprise.Business.Vendedor("conexion");

                            ObjVendedorInfo = ObjVendedor.ListxCodVendedor(ObjUsuarioVendedorInfo.IdVendedor);

                            if (ObjVendedorInfo != null)
                            {
                                ObjSessionUserInfo.Cedula = ObjVendedorInfo.Cedula.ToString().Trim();
                                //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.Usuario          = ObjUsuarioInfo.Clave.ToString().Trim();
                                ObjSessionUserInfo.IdVendedor       = ObjVendedorInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.IdZona           = ObjVendedorInfo.Zona.ToString().Trim();
                                ObjSessionUserInfo.IdZonaMatriz     = ObjVendedorInfo.Zona.ToString();
                                ObjSessionUserInfo.NombreUsuario    = ObjVendedorInfo.Nombre.ToString().Trim();
                                ObjSessionUserInfo.IdGrupo          = Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.GerentesZona);
                                ObjSessionUserInfo.Grupo            = ObjUsuarioInfo.NombreGrupo;
                                ObjSessionUserInfo.Email            = ObjVendedorInfo.EmailNivi.ToString().Trim();
                                ObjSessionUserInfo.MostrarTermyCond = ObjVendedorInfo.MostrarTerminosyCondiciones.ToString();

                                ObjSessionUserInfo.ClaveUsuario = objUser.Passwordd.Trim();

                                //--------------------------------------------------------------------------------------
                                //Consulta la region
                                Application.Enterprise.Business.RegionxZona moduleRegionxZona = new Application.Enterprise.Business.RegionxZona("conexion");
                                RegionxZonaInfo objRegionxZonaInfo = new RegionxZonaInfo();

                                objRegionxZonaInfo = moduleRegionxZona.ListRegionalxZona(ObjSessionUserInfo.IdZona.ToString());

                                if (objRegionxZonaInfo != null)
                                {
                                    ObjSessionUserInfo.IdRegional = objRegionxZonaInfo.CodigoRegion.ToString();//Se guarda el Id de la region.
                                }

                                //--------------------------------------------------------------------------------------
                                //Se consulta si la zona es de reserva en linea o no.
                                Application.Enterprise.CommonObjects.ZonasReservaEnLineaInfo ObjZonasReservaEnLineaInfo = new Application.Enterprise.CommonObjects.ZonasReservaEnLineaInfo();
                                Application.Enterprise.Business.ZonasReservaEnLinea          ObjZonasReservaEnLinea     = new Application.Enterprise.Business.ZonasReservaEnLinea("conexion");

                                ObjZonasReservaEnLineaInfo = ObjZonasReservaEnLinea.ListxZona(ObjSessionUserInfo.IdZona);

                                if (ObjZonasReservaEnLineaInfo != null)
                                {
                                    ObjSessionUserInfo.ZonaReservaEnLinea = "true";
                                }
                                //--------------------------------------------------------------------------------------
                            }
                            else
                            {
                                ObjSessionUserInfo.Error             = new Error();
                                ObjSessionUserInfo.Error.Id          = 1;
                                ObjSessionUserInfo.Error.Descripcion = "No se pudo iniciar sesion.";
                            }
                        }
                        else
                        {
                            /*string radalertscript = "<script language='javascript'>function f(){callAlert('Credenciales Invalidas. <br />No se pudo iniciar sesión en el sistema.'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                             * Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
                             *
                             * IngresarOK = false; */
                        }
                    }
                    #endregion
                    #region "GERENTES REGIONALES"

                    /*else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.GerentesRegionales))
                     * {
                     *  NIVI.Application.Enterprise.CommonObjects.UsuarioVendedorInfo ObjUsuarioVendedorInfo = new NIVI.Application.Enterprise.CommonObjects.UsuarioVendedorInfo();
                     *  Application.Enterprise.Business.UsuarioVendedor ObjUsuarioVendedor = new Application.Enterprise.Business.UsuarioVendedor("conexion");
                     *
                     *  ObjUsuarioVendedorInfo = ObjUsuarioVendedor.ListxClave(NIVI.SVDN.Common.Objects.Tools.Encrypt(txtPwd.Value.Trim(), true));
                     *
                     *  if (ObjUsuarioVendedorInfo != null)
                     *  {
                     *      NIVI.Application.Enterprise.CommonObjects.VendedorInfo ObjVendedorInfo = new NIVI.Application.Enterprise.CommonObjects.VendedorInfo();
                     *      Application.Enterprise.Business.Vendedor ObjVendedor = new Application.Enterprise.Business.Vendedor("conexion");
                     *
                     *      ObjVendedorInfo = ObjVendedor.ListxCedula(txtUserName.Value.Trim());
                     *
                     *      if (ObjVendedorInfo != null)
                     *      {
                     *          Session["Cedula"] = ObjVendedorInfo.Cedula.ToString().Trim();
                     *          //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                     *          Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                     *          Session["IdVendedor"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                     *          Session["IdZona"] = ObjVendedorInfo.Zona.ToString().Trim();
                     *          Session["NombreUsuario"] = ObjVendedorInfo.Nombre.ToString().Trim();
                     *          Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.GerentesRegionales);
                     *          Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                     *          Session["Email"] = ObjVendedorInfo.EmailNivi.ToString().Trim();
                     *          Session["CedulaRegional"] = ObjVendedorInfo.Cedula.ToString().Trim();
                     *          Session["CedulaRegionalMatriz"] = ObjVendedorInfo.Cedula.ToString();
                     *          Session["MostrarTermyCond"] = ObjVendedorInfo.MostrarTerminosyCondiciones.ToString();
                     *          Session["ClaveUsuario"] = txtPwd.Value.Trim();
                     *      }
                     *      else
                     *      {
                     *          // lbl_msg.Text = "Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.";
                     *
                     *          //string radalertscript = "<script language='javascript'>function f(){callAlertGenerico('Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                     *          //Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
                     *
                     *          RadAjaxManager1.ResponseScripts.Add("callAlertGenerico('Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.');");
                     *
                     *          IngresarOK = false;
                     *      }
                     *  }
                     *  else
                     *  {
                     *      string radalertscript = "<script language='javascript'>function f(){callAlert('Credenciales Invalidas. <br />No se pudo iniciar sesión en el sistema.'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                     *      Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
                     *
                     *      IngresarOK = false;
                     *  }
                     * }
                     */
                    #endregion
                    #region "ADMINISTRADOR"

                    /*else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.Administrador))
                     * {
                     *  NIVI.Application.Enterprise.CommonObjects.UsuarioVendedorInfo ObjUsuarioVendedorInfo = new NIVI.Application.Enterprise.CommonObjects.UsuarioVendedorInfo();
                     *  Application.Enterprise.Business.UsuarioVendedor ObjUsuarioVendedor = new Application.Enterprise.Business.UsuarioVendedor("conexion");
                     *
                     *  ObjUsuarioVendedorInfo = ObjUsuarioVendedor.ListxClave(NIVI.SVDN.Common.Objects.Tools.Encrypt(txtPwd.Value.Trim(), true));
                     *
                     *  if (ObjUsuarioVendedorInfo != null)
                     *  {
                     *      NIVI.Application.Enterprise.CommonObjects.VendedorInfo ObjVendedorInfo = new NIVI.Application.Enterprise.CommonObjects.VendedorInfo();
                     *      Application.Enterprise.Business.Vendedor ObjVendedor = new Application.Enterprise.Business.Vendedor("conexion");
                     *
                     *      ObjVendedorInfo = ObjVendedor.ListxCodVendedor(ObjUsuarioVendedorInfo.IdVendedor);
                     *
                     *      if (ObjVendedorInfo != null)
                     *      {
                     *          Session["Cedula"] = ObjVendedorInfo.Cedula.ToString().Trim();
                     *          //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                     *          Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                     *          Session["IdVendedor"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                     *          Session["IdZona"] = ObjVendedorInfo.Zona.ToString().Trim();
                     *          Session["NombreUsuario"] = ObjVendedorInfo.Nombre.ToString().Trim();
                     *          Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.Administrador);
                     *          Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                     *          Session["Email"] = ObjVendedorInfo.EmailNivi.ToString().Trim();
                     *          Session["ClaveUsuario"] = txtPwd.Value.Trim();
                     *
                     *          Session["MostrarTermyCond"] = "false";
                     *      }
                     *  }
                     *  else
                     *  {
                     *      string radalertscript = "<script language='javascript'>function f(){callAlert('Credenciales Invalidas. <br />No se pudo iniciar sesión en el sistema.'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                     *      Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
                     *
                     *      IngresarOK = false;
                     *  }
                     * }
                     */
                    #endregion
                    #region "SERVICIO AL CLIENTE (SAC)"
                    else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.ServicioCliente))
                    {
                        /*
                         * Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                         * Session["NombreUsuario"] = ObjUsuario.DesencriptarCadena(ObjUsuarioInfo.Descripcion.ToString().Trim());
                         * Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.ServicioCliente);
                         * Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                         * Session["Email"] = ObjUsuarioInfo.Email.ToString().Trim();
                         * Session["ClaveUsuario"] = txtPwd.Value.Trim();
                         */
                        ObjSessionUserInfo.Cedula = ObjUsuarioInfo.Usuario.ToString().Trim();
                        //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                        ObjSessionUserInfo.Usuario          = ObjUsuarioInfo.Clave.ToString().Trim();
                        ObjSessionUserInfo.NombreUsuario    = ObjUsuarioInfo.NombreUsuario.ToString().Trim();
                        ObjSessionUserInfo.IdGrupo          = Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.ServicioCliente);
                        ObjSessionUserInfo.Grupo            = ObjUsuarioInfo.NombreGrupo;
                        ObjSessionUserInfo.Email            = ObjUsuarioInfo.Email.ToString().Trim();
                        ObjSessionUserInfo.ClaveUsuario     = objUser.Passwordd.Trim();
                        ObjSessionUserInfo.MostrarTermyCond = "false";
                    }

                    #endregion
                    #region "SERVICIO AL CLIENTE ESPECIAL (SAC)"
                    else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.ServicioClienteEspecial))
                    {
                        /*
                         *                      Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                         *                      Session["NombreUsuario"] = ObjUsuario.DesencriptarCadena(ObjUsuarioInfo.Descripcion.ToString().Trim());
                         *                      Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.ServicioClienteEspecial);
                         *                      Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                         *                      Session["Email"] = ObjUsuarioInfo.Email.ToString().Trim();
                         *                      Session["ClaveUsuario"] = txtPwd.Value.Trim();
                         *                      Session["MostrarTermyCond"] = "false";
                         */
                        ObjSessionUserInfo.Cedula = ObjUsuarioInfo.Usuario.ToString().Trim();
                        //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                        ObjSessionUserInfo.Usuario          = ObjUsuarioInfo.Clave.ToString().Trim();
                        ObjSessionUserInfo.NombreUsuario    = ObjUsuarioInfo.NombreUsuario.ToString().Trim();
                        ObjSessionUserInfo.IdGrupo          = Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.ServicioClienteEspecial);
                        ObjSessionUserInfo.Grupo            = ObjUsuarioInfo.NombreGrupo;
                        ObjSessionUserInfo.Email            = ObjUsuarioInfo.Email.ToString().Trim();
                        ObjSessionUserInfo.ClaveUsuario     = objUser.Passwordd.Trim();
                        ObjSessionUserInfo.MostrarTermyCond = "false";
                    }
                    #endregion
                    #region "SALA DE VENTAS (VPN)"

                    /*else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.SalaVentas))
                     * {
                     *
                     *  Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                     *  Session["NombreUsuario"] = ObjUsuario.DesencriptarCadena(ObjUsuarioInfo.Descripcion.ToString().Trim());
                     *  Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.SalaVentas);
                     *  Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                     *  Session["Email"] = ObjUsuarioInfo.Email.ToString().Trim();
                     *  Session["ClaveUsuario"] = txtPwd.Value.Trim();
                     *
                     *  Session["MostrarTermyCond"] = "false";
                     * }
                     */
                    #endregion
                    #region "EMPRESARIAS"
                    else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.EmpresariasWeb))
                    {
                        //Application.Enterprise.CommonObjects.UsuarioVendedorInfo ObjUsuarioVendedorInfo = new Application.Enterprise.CommonObjects.UsuarioVendedorInfo();
                        //Application.Enterprise.Business.UsuarioVendedor ObjUsuarioVendedor = new Application.Enterprise.Business.UsuarioVendedor("conexion");

                        Application.Enterprise.CommonObjects.VendedorInfo ObjVendedorInfo = new Application.Enterprise.CommonObjects.VendedorInfo();
                        Application.Enterprise.Business.Vendedor          ObjVendedor     = new Application.Enterprise.Business.Vendedor("conexion");


                        //ObjUsuarioVendedorInfo = ObjUsuarioVendedor.ListxClave(Application.Enterprise.CommonObjects.Tools.Encrypt(objUser.Passwordd.Trim(), true));
                        ObjVendedorInfo = ObjVendedor.ListVendedorxNitCliente(objUser.UserName.Trim());

                        if (ObjVendedorInfo != null)
                        {
                            Application.Enterprise.CommonObjects.LiderInfo ObjLiderInfo = new Application.Enterprise.CommonObjects.LiderInfo();
                            Application.Enterprise.Business.Lider          ObjLider     = new Application.Enterprise.Business.Lider("conexion");

                            ObjLiderInfo = ObjLider.ListxIdLider(ObjVendedorInfo.IdVendedor);

                            if (ObjLiderInfo != null)
                            {
                                ObjSessionUserInfo.Cedula = objUser.UserName.Trim();// ObjVendedorInfo.Cedula.ToString().Trim();
                                //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.Usuario          = ObjUsuarioInfo.Clave.ToString().Trim();
                                ObjSessionUserInfo.IdVendedor       = ObjVendedorInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.IdLider          = ObjLiderInfo.IdLider.ToString().Trim();
                                ObjSessionUserInfo.IdZona           = ObjVendedorInfo.Zona.ToString().Trim();
                                ObjSessionUserInfo.IdZonaMatriz     = ObjVendedorInfo.Zona.ToString();
                                ObjSessionUserInfo.NombreUsuario    = ObjVendedorInfo.Nombre.ToString().Trim();
                                ObjSessionUserInfo.IdGrupo          = Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.EmpresariasWeb);
                                ObjSessionUserInfo.Grupo            = ObjUsuarioInfo.NombreGrupo;
                                ObjSessionUserInfo.Email            = ObjVendedorInfo.EmailNivi.ToString().Trim();
                                ObjSessionUserInfo.MostrarTermyCond = ObjVendedorInfo.MostrarTerminosyCondiciones.ToString();

                                ObjSessionUserInfo.ClaveUsuario = objUser.Passwordd.Trim();
                            }
                        }
                    }

                    #endregion
                    #region "ASISTENTES "

                    /*else if (ObjUsuarioInfo.IdGrupo == Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.Asistentes))
                     * {
                     *
                     *  Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                     *  Session["Asistente"] = ObjUsuarioInfo.Usuario.ToString().Trim();
                     *  Session["NombreUsuario"] = ObjUsuario.DesencriptarCadena(ObjUsuarioInfo.Descripcion.ToString().Trim());
                     *  Session["IdGrupo"] = Convert.ToString((int)NIVI.Application.Enterprise.CommonObjects.GruposUsuariosEnum.Asistentes);
                     *  Session["Grupo"] = ObjUsuarioInfo.NombreGrupo;
                     *  Session["Email"] = ObjUsuarioInfo.Email.ToString().Trim();
                     *  Session["Cedula"] = ObjUsuarioInfo.Usuario.ToString().Trim();
                     *  Session["IdVendedor"] = ObjUsuarioInfo.Usuario.ToString().Trim(); ;
                     *
                     *  Session["MostrarTermyCond"] = "false";
                     * }
                     */
                    #endregion
                    #region "LIDERES"
                    else if ((ObjUsuarioInfo.IdGrupo == Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.Lider)))
                    {
                        //Session["Asistente"] = ""; //GAVL USUARIO PARA MODULO ASISTENTE
                        //Session["AsistentexZona"] = ""; //GAVL USUARIO PARA MODULO ASISTENTE

                        Application.Enterprise.CommonObjects.UsuarioVendedorInfo ObjUsuarioVendedorInfo = new Application.Enterprise.CommonObjects.UsuarioVendedorInfo();
                        Application.Enterprise.Business.UsuarioVendedor          ObjUsuarioVendedor     = new Application.Enterprise.Business.UsuarioVendedor("conexion");

                        ObjUsuarioVendedorInfo = ObjUsuarioVendedor.ListxClave(Application.Enterprise.CommonObjects.Tools.Encrypt(objUser.Passwordd.Trim(), true));

                        if (ObjUsuarioVendedorInfo != null)
                        {
                            Application.Enterprise.CommonObjects.LiderInfo ObjLiderInfo = new Application.Enterprise.CommonObjects.LiderInfo();
                            Application.Enterprise.Business.Lider          ObjLider     = new Application.Enterprise.Business.Lider("conexion");

                            ObjLiderInfo = ObjLider.ListxIdLider(ObjUsuarioVendedorInfo.IdVendedor);

                            if (ObjLiderInfo != null)
                            {
                                ObjSessionUserInfo.Cedula = ObjLiderInfo.Cedula.ToString().Trim();
                                //Session["Usuario"] = ObjVendedorInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.Usuario          = ObjUsuarioInfo.Clave.ToString().Trim();
                                ObjSessionUserInfo.IdVendedor       = ObjLiderInfo.IdVendedor.ToString().Trim();
                                ObjSessionUserInfo.IdLider          = ObjLiderInfo.IdLider.ToString().Trim();
                                ObjSessionUserInfo.IdZona           = ObjLiderInfo.Zona.ToString().Trim();
                                ObjSessionUserInfo.IdZonaMatriz     = ObjLiderInfo.Zona.ToString();
                                ObjSessionUserInfo.NombreUsuario    = ObjLiderInfo.Nombres.ToString().Trim().ToUpper();
                                ObjSessionUserInfo.IdGrupo          = Convert.ToString((int)Application.Enterprise.CommonObjects.Enumerations.GruposUsuariosEnum.Lider);
                                ObjSessionUserInfo.Grupo            = ObjUsuarioInfo.NombreGrupo;
                                ObjSessionUserInfo.Email            = ObjLiderInfo.Nombres.ToString().Trim();
                                ObjSessionUserInfo.MostrarTermyCond = "0"; //no mostrar terminos y condiciones.
                                ObjSessionUserInfo.ClaveUsuario     = objUser.Passwordd.Trim();



                                //--------------------------------------------------------------------------------------
                                //Se consulta si la zona es de reserva en linea o no.

                                /*NIVI.Application.Enterprise.CommonObjects.ZonasReservaEnLineaInfo ObjZonasReservaEnLineaInfo = new NIVI.Application.Enterprise.CommonObjects.ZonasReservaEnLineaInfo();
                                 * Application.Enterprise.Business.ZonasReservaEnLinea ObjZonasReservaEnLinea = new Application.Enterprise.Business.ZonasReservaEnLinea("conexion");
                                 *
                                 * ObjZonasReservaEnLineaInfo = ObjZonasReservaEnLinea.ListxZona(Session["IdZona"].ToString());
                                 *
                                 * if (ObjZonasReservaEnLineaInfo != null)
                                 * {
                                 *  Session["ZonaReservaEnLinea"] = "true";
                                 * }*/
                                //--------------------------------------------------------------------------------------
                            }
                            else
                            {
                                // lbl_msg.Text = "Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.";

                                //string radalertscript = "<script language='javascript'>function f(){callAlertGenerico('Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
                                //Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);



                                //RadAjaxManager1.ResponseScripts.Add("callAlertGenerico('Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.');");

                                ObjSessionUserInfo.Error             = new Error();
                                ObjSessionUserInfo.Error.Id          = 1;
                                ObjSessionUserInfo.Error.Descripcion = "Las credenciales no corresponden a una zona de Niviglobal. <br />Por favor comuniquese con el area de comercial para verificar sus datos.";
                            }
                        }
                        else
                        {
                            ObjSessionUserInfo.Error             = new Error();
                            ObjSessionUserInfo.Error.Id          = 1;
                            ObjSessionUserInfo.Error.Descripcion = "No se pudo iniciar sesion.";
                        }
                    }

                    #endregion

                    /*else
                     * {
                     *  //Session["Usuario"] = ObjUsuarioInfo.Descripcion.ToString().Trim();
                     *  Session["Usuario"] = ObjUsuarioInfo.Clave.ToString().Trim();
                     *  Session["NombreUsuario"] = ObjUsuario.DesencriptarCadena(ObjUsuarioInfo.Descripcion.ToString());
                     *  Session["IdGrupo"] = ObjUsuarioInfo.IdGrupo.ToString();
                     *  Session["Grupo"] = ObjUsuarioInfo.NombreGrupo.ToString();
                     *  Session["Email"] = ObjUsuarioInfo.Email.ToString();
                     *  Session["ClaveUsuario"] = txtPwd.Value.Trim();
                     *
                     *  Session["MostrarTermyCond"] = "false";
                     *
                     *  if (Session["Usuario"].ToString() == "MFCNWtnmVYRzAJ7q5+TLoA==")
                     *  {
                     *      Response.Redirect("DefaultAdministrador.aspx");
                     *  }
                     * }
                     */

                    //Consultar si tiene permiso para pedidos de outlet.
                    //ObjParametrosInfo = ObjParametros.ListxId((int)NIVI.Application.Enterprise.CommonObjects.ParametrosEnum.CatalogoOutlet);
                    //Session["PedidosOutlet"] = ObjParametrosInfo.Valor.ToString().Trim().ToLower();

                    /*if (IngresarOK)
                     * {
                     *  Response.Redirect("Default.aspx");
                     * }
                     */
                }
            }
            else
            {
                ObjSessionUserInfo.Error             = new Error();
                ObjSessionUserInfo.Error.Id          = 1;
                ObjSessionUserInfo.Error.Descripcion = "No se pudo iniciar sesion.";
            }

            //TODO MRG: Cambiar esto para que sea lo q viene de BD.

            //--------------------------------------------------------------------------------------------------------
            CampanaInfo objCampanaInfo = new CampanaInfo();
            Campana     objCampana     = new Campana("conexion");

            objCampanaInfo = objCampana.ListxGetDate();

            if (objCampanaInfo != null)
            {
                ObjSessionUserInfo.Campana  = objCampanaInfo.Campana;
                ObjSessionUserInfo.Catalogo = objCampanaInfo.Catalogo;
            }
            else
            {
                ObjSessionUserInfo.Campana  = "";
                ObjSessionUserInfo.Catalogo = "";
            }

            //--------------------------------------------------------------------------------------------------------

            var response = Request.CreateResponse <SessionUserInfo>(HttpStatusCode.OK, ObjSessionUserInfo);
            response.Headers.Add("Token", "");
            response.Headers.Add("TokenExpiry", ConfigurationManager.AppSettings["AuthTokenExpiry"]);
            response.Headers.Add("Access-Control-Expose-Headers", "Token,TokenExpiry");


            return(response);
        }
Exemple #19
0
        /// <summary>
        ///     Book court case
        /// </summary>
        public async Task <CoaCaseConfirmViewModel> BookCourtCase(CoaCaseConfirmViewModel model,
                                                                  string userGuid, string userDisplayName)
        {
            //if the user could not be detected return
            if (string.IsNullOrWhiteSpace(userGuid))
            {
                return(model);
            }

            CoaSessionBookingInfo bookingInfo = _session.CoaBookingInfo;

            // check the schedule again to make sure the time slot wasn't taken by someone else
            CoAAvailableDates schedule = await _client.COAAvailableDatesAsync();

            //ensure time slot is still available
            if (IsTimeStillAvailable(schedule, bookingInfo.SelectedDate.Value))
            {
                //Fetch final main case file after ruling out selection of cases with main case and related cases
                var finalCase    = bookingInfo.CaseList.Where(x => x.Case_Num == bookingInfo.CaseNumber).First();
                var relatedCases = "";
                if (finalCase.Main && model.RelatedCaseList != null && model.RelatedCaseList.Count > 0)
                {
                    var relatedCaseIDList = bookingInfo.CaseList.Where(x => model.RelatedCaseList.Contains(x.Case_Num)).Select(x => x.CaseId).ToList();
                    relatedCases = string.Join("|", relatedCaseIDList);
                }

                //build object to send to the API
                var bookInfo = new CoABookingHearingInfo
                {
                    caseID        = finalCase.CaseId,
                    MainCase      = finalCase.Main,
                    RelatedCases  = relatedCases,
                    email         = $"{model.EmailAddress}",
                    hearingDate   = DateTime.Parse($"{model.SelectedDate.Value}"),
                    hearingLength = (bookingInfo.IsFullDay ?? false) ? "Full" : "Half",
                    phone         = $"{model.Phone}",
                    hearingTypeId = bookingInfo.HearingTypeId,
                    requestedBy   = $"{userDisplayName}"
                };

                //submit booking
                BookingHearingResult result = await _client.CoAQueueHearingAsync(bookInfo);

                //get the raw result
                bookingInfo.RawResult = result.bookingResult;

                //test to see if the booking was successful
                if (result.bookingResult.ToLower().StartsWith("success"))
                {
                    //create database entry
                    DbSet <BookingHistory> bookingHistory = _dbContext.Set <BookingHistory>();

                    bookingHistory.Add(new BookingHistory
                    {
                        ContainerId   = bookingInfo.ContainerId,
                        SmGovUserGuid = userGuid,
                        Timestamp     = DateTime.Now
                    });

                    //save to DB
                    _dbContext.SaveChanges();

                    //update model
                    model.IsBooked       = true;
                    bookingInfo.IsBooked = true;

                    //store user info in session for next booking
                    var userInfo = new SessionUserInfo
                    {
                        Phone       = model.Phone,
                        Email       = model.EmailAddress,
                        ContactName = $"{userDisplayName}"
                    };

                    _session.UserInfo = userInfo;

                    //send email
                    await _mailService.SendEmail(
                        model.EmailAddress,
                        EmailSubject,
                        await GetEmailBody());

                    //clear booking info session
                    _session.CoaBookingInfo = null;
                }
                else
                {
                    model.IsBooked       = false;
                    bookingInfo.IsBooked = false;
                }
            }
            else
            {
                //The booking is not available anymore
                //user needs to choose a new time slot
                model.IsTimeSlotAvailable = false;
                model.IsBooked            = false;
                bookingInfo.IsBooked      = false;
            }

            // save the booking info back to the session
            _session.CoaBookingInfo = bookingInfo;

            return(model);
        }
Exemple #20
0
        public List <RegionalesInfo> ListarRegional(SessionUserInfo ObjSessionUserInfo)
        {
            List <RegionalesInfo> lista = new List <RegionalesInfo>();

            Application.Enterprise.Business.Regionales module = new Application.Enterprise.Business.Regionales("conexion");

            lista = module.List();

            if (ObjSessionUserInfo.IdGrupo.ToString() == Convert.ToString((int)GruposUsuariosEnum.GerentesZona) || ObjSessionUserInfo.IdGrupo == Convert.ToString((int)GruposUsuariosEnum.Lider))
            {
                //-----------------------------------------------------------------------------------------------------------
                //Establece la region del usuario logueado.
                Application.Enterprise.Business.RegionxZona moduleRegionxZona = new Application.Enterprise.Business.RegionxZona("conexion");
                RegionxZonaInfo objRegionxZonaInfo = new RegionxZonaInfo();

                objRegionxZonaInfo = moduleRegionxZona.ListRegionalxZona(ObjSessionUserInfo.IdZona.ToString());

                if (objRegionxZonaInfo != null)
                {
                    foreach (var item in lista)
                    {
                        if (item.CodigoRegional == (int)objRegionxZonaInfo.CodigoRegion)
                        {
                            RegionalesInfo objRegionalesInfo = new RegionalesInfo();
                            objRegionalesInfo.Codgereg       = objRegionxZonaInfo.IdRegional;
                            objRegionalesInfo.CodigoRegional = objRegionxZonaInfo.CodigoRegion;
                            objRegionalesInfo.IdRegional     = objRegionxZonaInfo.CodigoRegion.ToString();
                            objRegionalesInfo.Nombre         = objRegionxZonaInfo.Descripcion;
                            objRegionalesInfo.NombreGerente  = objRegionxZonaInfo.Descripcion;
                            objRegionalesInfo.Usuario        = ObjSessionUserInfo.Cedula;

                            lista = new List <RegionalesInfo>();
                            lista.Add(objRegionalesInfo);
                            break;
                        }
                    }
                }
                else
                {
                    lista = new List <RegionalesInfo>();
                }
            }
            else if (ObjSessionUserInfo.IdGrupo == Convert.ToString((int)GruposUsuariosEnum.GerentesRegionales))
            {
                Application.Enterprise.Business.Regionales objRegionales = new Application.Enterprise.Business.Regionales("conexion");
                RegionalesInfo objRegionalesInfo = new RegionalesInfo();

                objRegionalesInfo = objRegionales.ListxCedulaRegional(ObjSessionUserInfo.CedulaRegional.Trim());

                if (objRegionalesInfo != null)
                {
                    foreach (var item in lista)
                    {
                        if (item.CodigoRegional == (int)objRegionalesInfo.CodigoRegional)
                        {
                            lista = new List <RegionalesInfo>();
                            lista.Add(item);
                            break;
                        }
                    }
                    //-----------------------------------------------------------------------------------------------------------
                }
            }

            return(lista);
        }
Exemple #21
0
        /// <summary>
        ///     Book court case
        /// </summary>
        public async Task <ScCaseConfirmViewModel> BookCourtCase(ScCaseConfirmViewModel model,
                                                                 string userGuid, string userDisplayName)
        {
            //if the user could not be detected return
            if (string.IsNullOrWhiteSpace(userGuid))
            {
                return(model);
            }

            ScSessionBookingInfo bookingInfo = _session.ScBookingInfo;

            // check the schedule again to make sure the time slot wasn't taken by someone else
            AvailableDatesByLocation schedule =
                await _client.AvailableDatesByLocationAsync(
                    bookingInfo.BookingRegistryId,
                    bookingInfo.HearingTypeId);

            //ensure time slot is still available
            if (IsTimeStillAvailable(schedule, bookingInfo.ContainerId))
            {
                //build object to send to the API
                var bookInfo = new BookHearingInfo
                {
                    CEIS_Physical_File_ID = bookingInfo.CaseId,
                    containerID           = bookingInfo.ContainerId,
                    dateTime      = model.FullDate,
                    hearingLength = bookingInfo.HearingLengthMinutes,
                    locationID    = bookingInfo.BookingRegistryId,
                    requestedBy   = $"{userDisplayName} {model.Phone} {model.EmailAddress}",
                    hearingTypeId = bookingInfo.HearingTypeId
                };

                //submit booking
                BookingHearingResult result = await _client.BookingHearingAsync(bookInfo);

                //get the raw result
                bookingInfo.RawResult = result.bookingResult;

                //test to see if the booking was successful
                if (result.bookingResult.ToLower().StartsWith("success"))
                {
                    //create database entry
                    DbSet <BookingHistory> bookingHistory = _dbContext.Set <BookingHistory>();

                    bookingHistory.Add(new BookingHistory
                    {
                        ContainerId   = bookingInfo.ContainerId,
                        SmGovUserGuid = userGuid,
                        Timestamp     = DateTime.Now
                    });

                    //save to DB
                    await _dbContext.SaveChangesAsync();

                    //update model
                    model.IsBooked       = true;
                    bookingInfo.IsBooked = true;

                    //store user info in session for next booking
                    var userInfo = new SessionUserInfo
                    {
                        Phone       = model.Phone,
                        Email       = model.EmailAddress,
                        ContactName = $"{userDisplayName}"
                    };

                    _session.UserInfo = userInfo;

                    var emailBody = await GetEmailBody();

                    //send email
                    await _mailService.SendEmail(
                        //"*****@*****.**",
                        model.EmailAddress,
                        EmailSubject,
                        emailBody);

                    //clear booking info session
                    _session.ScBookingInfo = null;
                }
                else
                {
                    model.IsBooked       = false;
                    bookingInfo.IsBooked = false;
                }
            }
            else
            {
                //The booking is not available anymore
                //user needs to choose a new time slot
                model.IsTimeSlotAvailable = false;
                model.IsBooked            = false;
                bookingInfo.IsBooked      = false;
            }

            // save the booking info back to the session
            _session.ScBookingInfo = bookingInfo;

            return(model);
        }
Exemple #22
0
    /// <summary>※nullを返す可能性があります</summary>
    public static SessionUserInfo GetSessionUserInfo(int user_id)
    {
        var user_info = new SessionUserInfo();

        string        ConnectionStr = ConfigurationManager.ConnectionStrings["MyConnectionStr"].ConnectionString;
        SqlConnection con           = new SqlConnection(ConnectionStr);

        con.Open();
        try
        {
            // dbデータ取得
            SqlCommand com = new SqlCommand("SELECT * FROM T_USER WHERE F_ID = @F_ID", con);
            try
            {
                com.Parameters.Add(new SqlParameter("@F_ID", user_id));
                SqlDataReader sdr = com.ExecuteReader();
                if (!sdr.Read())
                {
                    return(null);
                }
                user_info.UserId   = int.Parse(sdr["F_ID"].ToString());
                user_info.UserName = sdr["F_LAST_NAME"].ToString() + " " + sdr["F_FIRST_NAME"].ToString();
            }
            catch
            {
                throw;
            }
            finally
            {
                com.Dispose();
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
            con.Dispose();
        }

        // role
        con = new SqlConnection(ConnectionStr);
        con.Open();
        try
        {
            // dbデータ取得
            SqlCommand com = new SqlCommand("SELECT * FROM T_USER_ROLE WHERE F_USER_ID = @F_USER_ID", con);
            try
            {
                com.Parameters.Add(new SqlParameter("@F_USER_ID", user_id));
                SqlDataReader sdr = com.ExecuteReader();
                user_info.RoleId = new List <int>();
                if (sdr.Read())
                {
                    user_info.RoleId.Add(int.Parse(sdr["F_ROLE_ID"].ToString()));
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                com.Dispose();
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            con.Close();
            con.Dispose();
        }
        return(user_info);
    }