示例#1
0
 public CreateNewsWork(PortalRepository portalRepository, CreateNewsSyndicationItemContract data, int userId, IMapper mapper) : base(portalRepository)
 {
     m_portalRepository = portalRepository;
     m_data             = data;
     m_userId           = userId;
     m_mapper           = mapper;
 }
示例#2
0
 public NewsManager(PortalRepository portalRepository, AuthenticationManager authenticationManager, UserDetailManager userDetailManager, IMapper mapper)
 {
     m_portalRepository      = portalRepository;
     m_authenticationManager = authenticationManager;
     m_userDetailManager     = userDetailManager;
     m_mapper = mapper;
 }
示例#3
0
        public ActionResult Login(BL.User _User, string returnUrl)
        {
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
                1,                                    // Ticket Version
                _User.UserName,                       // username associated with ticket
                DateTime.Now,                         // Date/Time issued
                DateTime.Now.AddMinutes(30),          // Date/Time to expire
                false,                                // Cookie is persistant or not
                _User.Documenttyp,                    // we can also store user role
                FormsAuthentication.FormsCookiePath); // Path cookie valid for


            if (_User.UserName != null)
            {
                if (_User.Password != null)
                {
                    Service = BL.OrganizationUtility.GetCRMService();
                    BL.User _verifiedUser = PortalRepository.AuthenticateUser(_User.UserName, _User.Password, _User.Documenttyp, Service);
                    if (_verifiedUser != null)
                    {
                        if (_verifiedUser.UserId != Guid.Empty)
                        {
                            string     hashTicket = FormsAuthentication.Encrypt(ticket);
                            HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashTicket);
                            Response.Cookies.Add(authCookie);

                            BL.CurrentUser _cuser = new BL.CurrentUser(_verifiedUser);
                            BL.CurrentUser.Instance.VerifiedUser = _verifiedUser;
                            string name = BL.CurrentUser.Instance.VerifiedUser.UserName;
                            if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }

                            return(RedirectToAction("DocumentNotes", "Document"));
                        }
                    }

                    else
                    {
                        _User.lstDocumentType = GetDocumentType();
                    }
                    ModelState.AddModelError("", "Invalid Username or Password");
                }
                else
                {
                    _User.lstDocumentType = GetDocumentType();
                    ModelState.AddModelError("", "Please Enter Password");
                }
            }
            else
            {
                _User.lstDocumentType = GetDocumentType();
                ModelState.AddModelError("", "Please Enter Username");
            }

            return(View(_User));
        }
示例#4
0
        public ActionResult SaveChangePassword(BL.ChangePassword CP)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (Service == null)
                    {
                        Service = BL.OrganizationUtility.GetCRMService();
                    }

                    if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty)
                    {
                        ModelState.Clear();
                        string Result = PortalRepository.ChangePWDAuthenticateUser(BL.CurrentUser.Instance.VerifiedUser.UserId.ToString(), CP.OldPassword, Service);
                        if (Result != null)
                        {
                            Entity entity = new Entity("new_portaluser");
                            //entity.Id = "";
                            entity.LogicalName = "new_portaluser";
                            Guid            contactid = new Guid(BL.CurrentUser.Instance.VerifiedUser.UserId.ToString());
                            EntityReference ContactId = new EntityReference("new_portaluser", contactid);
                            entity.Attributes["new_portaluserid"] = ContactId.Id;
                            entity.Attributes["new_password"]     = CP.NewPassword;
                            Service.Update(entity);

                            ModelState.AddModelError("", "Successfully Updated");
                        }
                        else
                        {
                            ModelState.AddModelError("", "Incorrect Old Password");
                        }
                        ViewBag.LiDashboard = "class=";
                        ViewBag.LiGetAllCasesForIncident = "class=";
                        ViewBag.LiCreateCases            = "class=";
                        ViewBag.LiPassword = "******";
                        return(View("ChangePassword"));
                    }
                    else
                    {
                        return(RedirectToAction("Login"));
                    }
                }
                else
                {
                    ViewBag.LiDashboard = "class=";
                    ViewBag.LiGetAllCasesForIncident = "class=";
                    ViewBag.LiCreateCases            = "class=";
                    ViewBag.LiPassword = "******";
                    return(View("ChangePassword"));
                }
            }
            catch (Exception)
            {
                return(Redirect("~/theme/ErrorPage.html"));
            }
        }
        public void WhenGetAllFromEmptyDatabase_ThenReturnsEmptyCollection()
        {
            var repository = new PortalRepository(new DatabaseFactory());
            IEnumerable<Portal> actual = repository.GetAll();

            Assert.NotNull(actual);
            var actualList = new List<Portal>(actual);
            Assert.Equal(0, actualList.Count);
        }
示例#6
0
 public CreateFeedbackWork(IMapper mapper, PortalRepository portalRepository, CreateFeedbackContract data, FeedbackType feedbackType, int?userId = null, long?resourceVersionId = null) : base(portalRepository)
 {
     m_mapper            = mapper;
     m_portalRepository  = portalRepository;
     m_data              = data;
     m_feedbackType      = feedbackType;
     m_userId            = userId;
     m_resourceVersionId = resourceVersionId;
 }
示例#7
0
        public ActionResult Dashboard()
        {
            if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty)
            {
                if (Service == null)
                {
                    Service = BL.OrganizationUtility.GetCRMService();
                }

                Session["Uname"] = BL.CurrentUser.Instance.VerifiedUser.FirstName + " " + BL.CurrentUser.Instance.VerifiedUser.LastName;
                ViewBag.Uname    = BL.CurrentUser.Instance.VerifiedUser.UserName;

                BL.NotesData Model = new BL.NotesData()
                {
                    lstPortalUser = null, lstAssignedPortalUser = null, lstDataRow = null, lstHeaderColumn = null
                };
                Guid             DocumentId = new Guid();
                EntityCollection Col        = PortalRepository.GetNameWiseDocumentId("new_documentmanagementsystem", Service, BL.CurrentUser.Instance.VerifiedUser.UserId, BL.CurrentUser.Instance.VerifiedUser.Documenttyp);
                if (Col != null && Col.Entities.Count > 0)
                {
                    foreach (Entity enty in Col.Entities)
                    {
                        DocumentId = new Guid(enty.Attributes["new_documentmanagementsystemid"].ToString());
                    }
                }

                Model.IncidentId = DocumentId;


                //BL.DashboardData CounterData = PortalRepository.GetCounterDocumentNotesData("annotation", Service, Model.IncidentId, BL.CurrentUser.Instance.VerifiedUser.LastName);

                BL.DashboardData DashData = new BL.DashboardData();

                //DashData.Approved = CounterData.Approved;
                // DashData.Reject = CounterData.Reject;
                // DashData.Pending = CounterData.Pending;

                ViewBag.LiDashboard = "class=active";
                ViewBag.LiGetAllCasesForIncident = "class=";
                ViewBag.LiCreateCases            = "class=";
                ViewBag.LiPassword = "******";
                return(View(DashData));
                //    Service = BL.CRMUtility.GetCRMService();

                //List<BL.Activity> lstActivity = PortalUserRepository.GetAllActivity(Service, BL.CurrentUser.Instance.VerifiedUser.UserId, Guid.Empty);
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }
        public ActionResult ViewTicketsNotes()
        {
            try
            {
                if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty && !string.IsNullOrWhiteSpace(Request.QueryString["Id"]))
                {
                    BL.NotesData Model = new BL.NotesData();

                    Model.IncidentId = new Guid(Request.QueryString["Id"].ToString());

                    //if (lstTroubleTicketNotes == null || lstTroubleTicketNotes.Count <= 0)
                    lstTroubleTicketNotes = PortalRepository.GetNotesData("annotation", Service, Model.IncidentId);

                    if (lstTroubleTicketNotes.Count > 0 && lstTroubleTicketNotes != null)
                    {
                        Model.lstNotesData = lstTroubleTicketNotes;
                        //FileStream stream = new FileStream(Model.lstNotesData.filename, FileMode.OpenOrCreate);
                        //byte[] byteData = new byte[stream.Length];
                        //stream.Write(byteData, 0, byteData.Length);
                        //stream.Close();
                        //System.Convert.FromBase64CharArray(byteData);
                    }
                    //TimeZoneInfo cstZone = TimeZoneInfo.(190);
                    //DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);

                    ViewBag.GetTimeZone = new Func <DateTime, string>(LocalTime);
                    ViewBag.LiDashboard = "class=";
                    ViewBag.LiGetAllCasesForIncident = "class=active";
                    ViewBag.LiCreateCases            = "class=";
                    ViewBag.LiPassword = "******";
                    return(View("ViewTicketsNotes", Model));
                }
                else
                {
                    return(RedirectToAction("../Activity/Login"));
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("../Activity/Login"));
            }
        }
示例#9
0
 public DeleteFeedbackWork(PortalRepository portalRepository, long feedbackId) : base(portalRepository)
 {
     m_portalRepository = portalRepository;
     m_feedbackId       = feedbackId;
 }
        public ActionResult TicketsEscalationNotes()
        {
            try
            {
                if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty && !string.IsNullOrWhiteSpace(Request.QueryString["Id"]))
                {
                    BL.NotesData Model = new BL.NotesData()
                    {
                        lstDataRow = null, lstHeaderColumn = null
                    };

                    Model.IncidentId = new Guid(Request.QueryString["Id"].ToString());


                    #region Incident Data
                    // BL.NotesData AllCases = new BL.NotesData() { lstDataRow = null, lstHeaderColumn = null };
                    if (Service == null)
                    {
                        Service = BL.OrganizationUtility.GetCRMService();
                    }

                    //savestatecode = Model.statecode;

                    if (lstTroubleTicket == null || lstTroubleTicket.Count <= 0)
                    {
                        lstTroubleTicket = PortalRepository.GetFieldAttribute("incident", Service);
                    }
                    lstTroubleTicket = lstTroubleTicket.OrderBy(x => x.Index).ToList();
                    if (lstTroubleTicket != null && lstTroubleTicket.Count > 0)
                    {
                        List <BL.DataRow> lstDataRowValue = new List <BL.DataRow>();
                        EntityCollection  Col             = PortalRepository.GetIdWiseEntityRecords("incident", lstTroubleTicket, Service, BL.CurrentUser.Instance.VerifiedUser.UserId, new Guid(BL.CurrentUser.Instance.VerifiedUser.CompanyName), Model.IncidentId);
                        if (Col != null && Col.Entities.Count > 0)
                        {
                            foreach (Entity enty in Col.Entities)
                            {
                                List <string> OneDataRowValue = new List <string>();
                                for (int i = 0; i < lstTroubleTicket.Count; i++)
                                {
                                    if (enty.Contains(lstTroubleTicket[i].FieldName) && enty.Attributes[lstTroubleTicket[i].FieldName] != null)
                                    {
                                        OneDataRowValue.Add(GetFieldValue(enty, lstTroubleTicket[i].FieldName, lstTroubleTicket[i].FieldType));
                                    }
                                    else
                                    {
                                        OneDataRowValue.Add("");
                                    }
                                }
                                lstDataRowValue.Add(new BL.DataRow()
                                {
                                    DataRoValue = OneDataRowValue.ToArray()
                                });
                            }
                        }
                        if (lstDataRowValue.Count > 0 && lstTroubleTicket.Count > 0)
                        {
                            Model = new BL.NotesData()
                            {
                                lstDataRow = lstDataRowValue, lstHeaderColumn = lstTroubleTicket, IncidentId = new Guid(Request.QueryString["Id"].ToString())
                            }
                        }
                        ;
                        else
                        {
                            Model = new BL.NotesData()
                            {
                                lstDataRow = null, lstHeaderColumn = null
                            }
                        };
                    }
                    #endregion

                    lstTroubleTicketNotes = PortalRepository.GetNotesData("annotation", Service, Model.IncidentId);

                    if (lstTroubleTicketNotes.Count > 0 && lstTroubleTicketNotes != null)
                    {
                        Model.lstNotesData = lstTroubleTicketNotes;
                    }
                    ViewBag.GetTimeZone = new Func <DateTime, string>(LocalTime);
                    ViewBag.LiDashboard = "class=";
                    ViewBag.LiGetAllCasesForIncident = "class=active";
                    ViewBag.LiCreateCases            = "class=";
                    ViewBag.LiPassword = "******";
                    return(View("TicketsEscalationNotes", Model));
                }
                else
                {
                    return(RedirectToAction("../Activity/Login"));
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("../Activity/Login"));
            }
        }
        public ActionResult GetAllCasesForIncident(BL.RecordList Model)
        {
            if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty)
            {
                BL.RecordList AllCases = new BL.RecordList()
                {
                    lstDataRow = null, lstHeaderColumn = null, statecode = 0, Usercode = 0
                };
                if (Service == null)
                {
                    Service = BL.OrganizationUtility.GetCRMService();
                }

                //savestatecode = Model.statecode;

                if (lstTroubleTicket == null || lstTroubleTicket.Count <= 0)
                {
                    lstTroubleTicket = PortalRepository.GetFieldAttribute("incident", Service);
                }
                lstTroubleTicket = lstTroubleTicket.OrderBy(x => x.Index).ToList();
                if (lstTroubleTicket != null && lstTroubleTicket.Count > 0)
                {
                    List <BL.DataRow> lstDataRowValue = new List <BL.DataRow>();
                    EntityCollection  Col             = PortalRepository.GetEntityRecords("incident", lstTroubleTicket, Service, BL.CurrentUser.Instance.VerifiedUser.UserId, new Guid(BL.CurrentUser.Instance.VerifiedUser.CompanyName), Model);
                    if (Col != null && Col.Entities.Count > 0)
                    {
                        foreach (Entity enty in Col.Entities)
                        {
                            List <string> OneDataRowValue = new List <string>();
                            for (int i = 0; i < lstTroubleTicket.Count; i++)
                            {
                                if (enty.Contains(lstTroubleTicket[i].FieldName) && enty.Attributes[lstTroubleTicket[i].FieldName] != null)
                                {
                                    OneDataRowValue.Add(GetFieldValue(enty, lstTroubleTicket[i].FieldName, lstTroubleTicket[i].FieldType));
                                }
                                else
                                {
                                    OneDataRowValue.Add("");
                                }
                            }
                            lstDataRowValue.Add(new BL.DataRow()
                            {
                                DataRoValue = OneDataRowValue.ToArray()
                            });
                        }
                    }
                    if (lstDataRowValue.Count > 0 && lstTroubleTicket.Count > 0)
                    {
                        AllCases = new BL.RecordList()
                        {
                            lstDataRow = lstDataRowValue, lstHeaderColumn = lstTroubleTicket, statecode = Model.statecode
                        }
                    }
                    ;
                    else
                    {
                        AllCases = new BL.RecordList()
                        {
                            lstDataRow = null, lstHeaderColumn = null
                        }
                    };
                }
                ViewBag.LiDashboard = "class=";
                ViewBag.LiGetAllCasesForIncident = "class=active";
                ViewBag.LiCreateCases            = "class=";
                ViewBag.LiPassword = "******";
                return(View("TroubleTicket", AllCases));
            }
            else
            {
                return(RedirectToAction("../Activity/Login"));
            }
        }
        public ActionResult EditCases(Guid id)
        {
            if (BL.CurrentUser.Instance != null && BL.CurrentUser.Instance.VerifiedUser.UserId != Guid.Empty)
            {
                BL.RecordList AllCases = new BL.RecordList()
                {
                    lstData = null
                };
                lstSite = GetSiteOnCustomer(BL.CurrentUser.Instance.VerifiedUser.CompanyName);
                BL.TicketData Model;
                if (lstSite.Count > 0)
                {
                    Model = new BL.TicketData()
                    {
                        lstSubject = GetSubject(), lstSite = GetSiteOnCustomer(BL.CurrentUser.Instance.VerifiedUser.CompanyName)
                    };
                }
                else
                {
                    Model = new BL.TicketData()
                    {
                        lstSubject = GetSubject()
                    };
                }

                lstTroubleTicket1 = PortalRepository.GetIdWiseIncidentData("incident", Service, id);
                if (lstTroubleTicket1.Count > 0)
                {
                    AllCases = new BL.RecordList()
                    {
                        lstData = lstTroubleTicket1
                    }
                }
                ;
                else
                {
                    AllCases = new BL.RecordList()
                    {
                        lstData = null
                    }
                };


                Model.incidentid  = id;
                Model.description = AllCases.lstData[0].description;


                EntityReference CustomerId = new EntityReference("account", AllCases.lstData[0].customerid);
                Model.customerid = CustomerId.Id.ToString();


                EntityReference SiteName = new EntityReference("new_projectsite", AllCases.lstData[0].new_sitename);
                Model.new_name = SiteName.Id.ToString();

                EntityReference ContactId = new EntityReference("contact", AllCases.lstData[0].primarycontactid);
                Model.primarycontactid = ContactId.Id.ToString();

                EntityReference SubjectId = new EntityReference("subject", AllCases.lstData[0].subjectid);
                Model.subjectid = SubjectId.Id.ToString();
                Model.title     = AllCases.lstData[0].title;

                Model.PageMessage = "";

                return(View("CreateCases", Model));
            }
            else
            {
                return(RedirectToAction("../Activity/Login"));
            }
        }