Exemple #1
0
        public ActionResult Accept(EULAAcceptanceModel objEulaAcceptanceModel, int acid)
        {
            bool             bReturn             = false;
            UserInfoSL       objUserInfoSL       = new UserInfoSL();
            LoginUserDetails objLoginUserDetails = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

            try
            {
                objEulaAcceptanceModel.EULAAcceptanceFlag = true;
                bReturn = objUserInfoSL.SaveUserEulaAcceptance(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID, objEulaAcceptanceModel.DocumentID, objEulaAcceptanceModel.EULAAcceptanceFlag);

                if (bReturn)
                {
                    return(RedirectToAction("Index", "InsiderDashboard", new { acid = Common.ConstEnum.UserActions.DASHBOARD_INSIDERUSER }));
                }
                else
                {
                    return(RedirectToAction("ShowUserConsent", "UserDetails", new { acid = Common.ConstEnum.UserActions.USER_EULACONSENT, nDocumentId = objEulaAcceptanceModel.DocumentID }));
                }
            }
            catch
            {
                return(View());
            }
            finally
            {
                objUserInfoSL       = null;
                objLoginUserDetails = null;
            }
        }
Exemple #2
0
        public ActionResult ShowUserConsent(int acid, int DocumentID)
        {
            DocumentDetailsSL   objDocumentDetailsSL   = null;
            EULAAcceptanceModel objEULAAcceptanceModel = new EULAAcceptanceModel();
            LoginUserDetails    objLoginUserDetails    = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

            DocumentDetailsDTO objDocumentDetailsDTO = new DocumentDetailsDTO();

            try
            {
                objDocumentDetailsSL = new DocumentDetailsSL();

                //check if document has uploaded or not -- by checking document id - in case of not uploaded document id is "0"
                if (DocumentID > 0)
                {
                    objDocumentDetailsDTO = objDocumentDetailsSL.GetDocumentDetails(objLoginUserDetails.CompanyDBConnectionString, DocumentID);
                }

                //copy document details DTO into User policy document model
                objEULAAcceptanceModel.DocumentID         = objDocumentDetailsDTO.DocumentId;
                objEULAAcceptanceModel.DocumentName       = objDocumentDetailsDTO.DocumentName;
                objEULAAcceptanceModel.DocumentFileType   = objDocumentDetailsDTO.FileType;
                objEULAAcceptanceModel.DocumentPath       = objDocumentDetailsDTO.DocumentPath;
                objEULAAcceptanceModel.UserInfoID         = objLoginUserDetails.LoggedInUserID;
                objEULAAcceptanceModel.EULAAcceptanceFlag = false;

                ViewBag.UserAction = acid;

                return(View("~/Views/UserDetails/UserConsent.cshtml", objEULAAcceptanceModel));
            }
            catch (Exception ex)
            {
                string sErrMessage = Common.Common.getResource(ex.InnerException.Data[0].ToString());
                ModelState.AddModelError("Error", sErrMessage);
                return(View("~/Views/UserDetails/UserConsent.cshtml"));
            }
            finally
            {
                objDocumentDetailsSL   = null;
                objEULAAcceptanceModel = null;
                objLoginUserDetails    = null;
                objDocumentDetailsDTO  = null;
            }
        }
Exemple #3
0
 public ActionResult PartialViewDocument(EULAAcceptanceModel objEULAAcceptanceModel, int acid)
 {
     return(PartialView(objEULAAcceptanceModel));
 }
Exemple #4
0
        public void Generate(EULAAcceptanceModel objEULAAcceptanceModel, int acid, int nDocumentId = 0)
        {
            String             mimeType              = "application/unknown";
            DocumentDetailsSL  objDocumentDetailsSL  = new DocumentDetailsSL();
            DocumentDetailsDTO objDocumentDetailsDTO = new DocumentDetailsDTO();
            LoginUserDetails   objLoginUserDetails   = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

            System.IO.FileInfo fFile = null;

            try
            {
                Dictionary <String, String> mtypes = new Dictionary <string, string>()
                {
                    { ".pdf", "application/pdf" },
                    { ".png", "application/png" },
                    { ".jpeg", "application/jpeg" },
                    { ".jpg", "application/jpeg" },
                    { ".txt", "text/plain" },
                    { ".xls", "application/vnd.ms-excel" },
                    { ".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet " },
                    { ".doc", "application/msword" },
                    { ".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
                    { ".html", "text/html" },
                    { ".htm", "text/html" },
                };
                if (nDocumentId != 0)
                {
                    objDocumentDetailsDTO = objDocumentDetailsSL.GetDocumentDetails(objLoginUserDetails.CompanyDBConnectionString, nDocumentId);
                }

                fFile = new System.IO.FileInfo(objDocumentDetailsDTO.DocumentPath);
                Response.Clear();

                // ContentDisposition Value and Parameter are used.
                // Meaning of Value [inline]        : Displayed automatically
                // Meaning of Parameter [filename]	: Name to be used when creating file
                ContentDisposition contentDisposition = new ContentDisposition
                {
                    FileName = objDocumentDetailsDTO.DocumentName,
                    Inline   = true
                };
                Response.AppendHeader("Content-Disposition", contentDisposition.ToString());

                String filetype = fFile.Extension.ToLower();
                if (mtypes.Keys.Contains <String>(filetype))
                {
                    mimeType = mtypes[filetype];
                }

                Response.ContentType = mimeType;
                Response.WriteFile(fFile.FullName);
                Response.End();



                //NOTE - ADDED ABOVE CODE TO HANDLE DIFFERENT FILE TYPE
                ////Response.AddHeader("Content-Length", fFile.Length.ToString());
                //if (fFile.Extension.ToLower() == ".pdf")
                //{
                //    Response.ContentType = "application/pdf";
                //    Response.WriteFile(fFile.FullName);
                //    Response.End();

                //}
                //else if (fFile.Extension.ToLower() == ".xls" || fFile.Extension.ToLower() == ".xlsx")
                //{
                //    Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                //    Response.WriteFile(fFile.FullName);
                //    Response.End();

                //}
                //else if (fFile.Extension.ToLower() == ".png" || fFile.Extension.ToLower() == ".jpg")
                //{
                //    Response.ContentType = "image/png";
                //    Response.WriteFile(fFile.FullName);
                //    Response.End();

                //}
                //else if (fFile.Extension.ToLower() == ".docx" || fFile.Extension.ToLower() == ".doc")
                //{
                //    Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                //    Response.WriteFile(fFile.FullName);
                //    Response.End();

                //    //NOTE - Following code is commented because to make functionality similar to other file types
                //    //START COMMENT ===>
                //    //Microsoft.Office.Interop.Word.Application objWordApp = new Microsoft.Office.Interop.Word.Application();
                //    //object objWordFile = objUsersPolicyDocumentModel.PolicyDocumentPath;
                //    //object objNull = System.Reflection.Missing.Value;
                //    //Microsoft.Office.Interop.Word.Document WordDoc = objWordApp.Documents.Open(
                //    //ref objWordFile, ref objNull, ref objNull,
                //    //ref objNull, ref objNull, ref objNull,
                //    //ref objNull, ref objNull, ref objNull,
                //    //ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull, ref objNull);

                //    //WordDoc.ActiveWindow.Selection.WholeStory();
                //    //WordDoc.ActiveWindow.Selection.Copy();
                //    //string strWordText = WordDoc.Content.Text;
                //    //WordDoc.Close(ref objNull, ref objNull, ref objNull);
                //    //objWordApp.Quit(ref objNull, ref objNull, ref objNull);
                //    //Response.Write(strWordText);
                //    //END COMMENT <===
                //}
                //else if (fFile.Extension.ToLower() == ".txt")
                //{
                //    Response.ContentType = "application/text";
                //    Response.WriteFile(fFile.FullName);
                //    Response.End();
                //}


                //byte[] bytes = System.IO.File.ReadAllBytes(objUsersPolicyDocumentModel.PolicyDocumentPath);
                //return File(bytes, "application/pdf");
            }
            catch (Exception exp)
            {
                @ViewBag.ErrorMsg = exp.Message;

                //throw exp;
            }
            finally
            {
                objDocumentDetailsSL  = null;
                objDocumentDetailsDTO = null;
                objLoginUserDetails   = null;
                fFile = null;
            }
        }