예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="i_sConnectionString"></param>
        /// <param name="i_nUserInfoId"></param>
        /// <param name="o_nReturnValue"></param>
        /// <param name="o_nErroCode"></param>
        /// <param name="o_sErrorMessage"></param>
        /// <returns></returns>
        public UsersPolicyDocumentDTO GetDocumentDetails(string i_sConnectionString, int PolicyDocumentID, int DocumentID)
        {
            UsersPolicyDocumentDTO res = null;

            try
            {
                //InsiderInitialDisclosureDAL objInsiderInitialDisclosureDAL = new InsiderInitialDisclosureDAL();
                using (var objInsiderInitialDisclosureDAL = new InsiderInitialDisclosureDAL())
                {
                    res = objInsiderInitialDisclosureDAL.GetDocumentDetails(i_sConnectionString, PolicyDocumentID, DocumentID);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }

            return(res);
        }
예제 #2
0
        public ActionResult DisplayHardCopy(int acid, int DocumentID, string DocumentPath, int TransactionMasterId, int DisclosureTypeId, string CalledFrom)
        {
            UsersPolicyDocumentModel   objUsersPolicyDocumentModel   = new UsersPolicyDocumentModel();
            UsersPolicyDocumentDTO     objUsersPolicyDocumentDTO     = new UsersPolicyDocumentDTO();
            InsiderInitialDisclosureSL objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL();

            try
            {
                objUsersPolicyDocumentModel.PolicyDocumentPath = DocumentPath;
                objUsersPolicyDocumentModel.DocumentId         = DocumentID;
                ViewBag.TransactionMasterId = TransactionMasterId;
                ViewBag.DisclosureTypeId    = DisclosureTypeId;
                Common.Common.CopyObjectPropertyByName(objUsersPolicyDocumentDTO, objUsersPolicyDocumentModel);
                if (objUsersPolicyDocumentModel.DocumentViewAgreeFlag == true)
                {
                    ViewBag.ViewAgreeFlag = true;
                    ViewBag.ViewFlag      = false;
                }
                else if (objUsersPolicyDocumentModel.DocumentViewFlag == true)
                {
                    ViewBag.ViewAgreeFlag = false;
                    ViewBag.ViewFlag      = true;
                }
                ViewBag.CalledFrom = CalledFrom;
                return(View("ViewDocument", objUsersPolicyDocumentModel));
            }
            catch
            {
                return(View("ViewDocument"));
            }
            finally
            {
                objUsersPolicyDocumentModel   = null;
                objInsiderInitialDisclosureSL = null;
            }
        }
예제 #3
0
        public UsersPolicyDocumentDTO GetDocumentDetails(string sConnectionString, int PolicyDocumentID, int DocumentID)
        {
            #region Paramters

            int    out_nReturnValue;
            int    out_nSQLErrCode;
            string out_sSQLErrMessage;
            UsersPolicyDocumentDTO res = null;
            #endregion Paramters
            try
            {
                #region Out Paramter
                var nReturnValue = new SqlParameter("@out_nReturnValue", System.Data.SqlDbType.Int);
                nReturnValue.Direction = System.Data.ParameterDirection.Output;
                nReturnValue.Value     = 0;
                var nSQLErrCode = new SqlParameter("@out_nSQLErrCode", System.Data.SqlDbType.Int);
                nSQLErrCode.Direction = System.Data.ParameterDirection.Output;
                nSQLErrCode.Value     = 0;
                var sSQLErrMessage = new SqlParameter("@out_sSQLErrMessage", System.Data.SqlDbType.VarChar);
                sSQLErrMessage.Direction = System.Data.ParameterDirection.Output;
                sSQLErrMessage.Value     = "";
                sSQLErrMessage.Size      = 500;
                #endregion Out Paramter

                using (var db = new PetaPoco.Database(sConnectionString, "System.Data.SqlClient")
                {
                    EnableAutoSelect = false
                })
                {
                    using (var scope = db.GetTransaction())
                    {
                        res = db.Query <UsersPolicyDocumentDTO>("exec st_rul_UsersPolicyDocumentDetails @inp_iPolicyDocumentId,@inp_iDocumentId,@out_nReturnValue OUTPUT,@out_nSQLErrCode OUTPUT,@out_sSQLErrMessage OUTPUT",
                                                                new
                        {
                            @inp_iPolicyDocumentId = PolicyDocumentID,
                            @inp_iDocumentId       = DocumentID,
                            out_nReturnValue       = nReturnValue,
                            out_nSQLErrCode        = nSQLErrCode,
                            out_sSQLErrMessage     = sSQLErrMessage
                        }).Single <UsersPolicyDocumentDTO>();

                        #region Error Values
                        if (Convert.ToInt32(nReturnValue.Value) != 0)
                        {
                            Exception e = new Exception();
                            out_nReturnValue = Convert.ToInt32(nReturnValue.Value);
                            string sReturnValue = sLookUpPrefix + out_nReturnValue;
                            e.Data[0] = sReturnValue;
                            if (nSQLErrCode.Value != System.DBNull.Value)
                            {
                                out_nSQLErrCode = Convert.ToInt32(nSQLErrCode.Value);
                                e.Data[1]       = out_nSQLErrCode;
                            }
                            if (sSQLErrMessage.Value != System.DBNull.Value)
                            {
                                out_sSQLErrMessage = Convert.ToString(sSQLErrMessage.Value);
                                e.Data[2]          = out_sSQLErrMessage;
                            }

                            Exception ex = new Exception(db.LastSQL.ToString(), e);
                            throw ex;
                        }
                        else
                        {
                            scope.Complete();
                        }
                        #endregion Error Values
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally
            {
            }
            return(res);
        }
예제 #4
0
        public ActionResult DisplayPolicy(int acid, int PolicyDocumentID, int DocumentID, string CalledFrom, bool CalledFromHardCopy = false, int year = 0, int Period = 0, string frm = "", bool IsFromDashboard = false, int nUserInfoId = 0, string DiscType = "", int RequiredModuleID = 0)
        {
            DocumentDetailsSL         objDocumentDetailsSL      = null;
            List <DocumentDetailsDTO> objDocumentDetailsDTOList = null;
            string FAQMenuURL = string.Empty;

            string[] MenuURLParts = null;
            string   PID          = string.Empty;
            string   ID           = string.Empty;

            List <InsiderTradingDAL.MenuMasterDTO> menuList = new List <MenuMasterDTO>();

            ViewBag.RequiredModuleID = InsiderTrading.Common.ConstEnum.Code.RequiredModuleOwnSecurity;
            menuList = (List <InsiderTradingDAL.MenuMasterDTO>)TempData["MenuList"];


            if (CalledFrom == "ViewAgree_OS")
            {
                ViewBag.RequiredModuleID = InsiderTrading.Common.ConstEnum.Code.RequiredModuleOtherSecurity;
            }
            else
            {
                ViewBag.RequiredModuleID = InsiderTrading.Common.ConstEnum.Code.RequiredModuleOwnSecurity;
            }
            //Get the MenuURL of FAQ
            if (CalledFrom.ToUpper().Contains("FAQ") && IsFromDashboard)
            {
                foreach (InsiderTradingDAL.MenuMasterDTO item in menuList)
                {
                    if (!String.IsNullOrEmpty(item.MenuURL) && item.MenuURL.Contains("FAQ"))
                    {
                        FAQMenuURL = item.MenuURL;
                    }
                }
                if (!String.IsNullOrEmpty(FAQMenuURL))
                {
                    MenuURLParts = FAQMenuURL.Split('&');
                }
                if (MenuURLParts.Length > 0)
                {
                    for (int i = 0; i <= MenuURLParts.Length - 1; i++)
                    {
                        if (MenuURLParts[i].ToUpper().Contains("DOCUMENTID"))
                        {
                            if (MenuURLParts[i].ToUpper().Contains('='))
                            {
                                if (MenuURLParts[i].ToUpper().Contains("POLICY"))
                                {
                                    PID = MenuURLParts[i].Split('=')[1];
                                }
                                else
                                {
                                    ID = MenuURLParts[i].Split('=')[1];
                                }
                            }
                        }
                    }
                    PolicyDocumentID = Convert.ToInt32(PID);
                    DocumentID       = Convert.ToInt32(ID);
                }
            }

            Boolean isShowDownloadDocumentMsg = true; //flag used to show message to download file

            bool IsCalledFromReport      = false;     // flag used to show this page is show from Report page link
            bool HardCopyFileNotUploaded = false;
            UsersPolicyDocumentModel   objUsersPolicyDocumentModel   = new UsersPolicyDocumentModel();
            UsersPolicyDocumentDTO     objUsersPolicyDocumentDTO     = new UsersPolicyDocumentDTO();
            InsiderInitialDisclosureSL objInsiderInitialDisclosureSL = new InsiderInitialDisclosureSL();
            LoginUserDetails           objLoginUserDetails           = (LoginUserDetails)InsiderTrading.Common.Common.GetSessionValue((string)ConstEnum.SessionValue.UserDetails);

            int PurposeCodeId = 0;

            if (Convert.ToString(objLoginUserDetails.DateOfBecomingInsider).Equals("") && objLoginUserDetails.UserTypeCodeId.Equals(InsiderTrading.Common.ConstEnum.Code.EmployeeType) && (PolicyDocumentID == InsiderTrading.Common.ConstEnum.Code.FAQInsiderPolicyDocumentID || PolicyDocumentID == InsiderTrading.Common.ConstEnum.Code.FAQEmployeePolicyDocumentID))
            {
                PolicyDocumentID = InsiderTrading.Common.ConstEnum.Code.FAQInsiderPolicyDocumentID;
                DocumentID       = InsiderTrading.Common.ConstEnum.Code.FAQDocumentID;
            }

            DocumentDetailsDTO objDocumentDetailsDTO = new DocumentDetailsDTO();

            UserPolicyDocumentEventLogDTO objUserPolicyDocumentEventLogDTO = null;

            try
            {
                if (DiscType == "OS")
                {
                    RequiredModuleID = InsiderTrading.Common.ConstEnum.Code.RequiredModuleOtherSecurity;
                }
                else
                {
                    RequiredModuleID = InsiderTrading.Common.ConstEnum.Code.RequiredModuleOwnSecurity;
                }
                objDocumentDetailsSL = new DocumentDetailsSL();
                objUsersPolicyDocumentModel.PolicyDocumentId = PolicyDocumentID; //in case of hard copy display this value is MapToId
                objUsersPolicyDocumentModel.DocumentId       = DocumentID;
                objUsersPolicyDocumentModel.CalledFrom       = CalledFrom;
                objUsersPolicyDocumentModel.RequiredModuleID = RequiredModuleID;



                if (!CalledFromHardCopy && !Common.Common.CheckUserTypeAccess(objLoginUserDetails.CompanyDBConnectionString, ConstEnum.Code.PolicyDocument, Convert.ToInt64(PolicyDocumentID), objLoginUserDetails.LoggedInUserID))
                {
                    return(RedirectToAction("Unauthorised", "Home"));
                }
                //check if to show policy document details or hard copy file and get details accourdingly
                if (CalledFromHardCopy)
                {
                    //get hard copy document details

                    //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);
                    }
                    else
                    {
                        HardCopyFileNotUploaded = true;
                    }

                    //copy document details DTO into User policy document model
                    objUsersPolicyDocumentModel.DocumentId             = objDocumentDetailsDTO.DocumentId;
                    objUsersPolicyDocumentModel.PolicyDocumentName     = objDocumentDetailsDTO.DocumentName;
                    objUsersPolicyDocumentModel.PolicyDocumentFileType = objDocumentDetailsDTO.FileType;
                    objUsersPolicyDocumentModel.CalledFrom             = CalledFrom;
                    objUsersPolicyDocumentModel.DocumentViewFlag       = false;
                    objUsersPolicyDocumentModel.DocumentViewAgreeFlag  = false;
                }
                else
                {
                    objUsersPolicyDocumentDTO            = objInsiderInitialDisclosureSL.GetDocumentDetails(objLoginUserDetails.CompanyDBConnectionString, PolicyDocumentID, DocumentID);
                    objUsersPolicyDocumentDTO.DocumentId = DocumentID;
                    Common.Common.CopyObjectPropertyByName(objUsersPolicyDocumentDTO, objUsersPolicyDocumentModel);
                }

                if (objUsersPolicyDocumentModel.DocumentViewAgreeFlag == true)
                {
                    ViewBag.ViewAgreeFlag = true;
                    ViewBag.ViewFlag      = false;
                }
                else if (objUsersPolicyDocumentModel.DocumentViewFlag == true)
                {
                    ViewBag.ViewAgreeFlag = false;
                    ViewBag.ViewFlag      = true;
                }

                ViewBag.CalledFrom  = CalledFrom;
                ViewBag.Company     = objLoginUserDetails.CompanyName;
                ViewBag.PDID        = PolicyDocumentID;
                ViewBag.Year        = year;
                ViewBag.Period      = Period;
                ViewBag.nUserInfoId = nUserInfoId;
                int DocMapToTypeCodeId = 0;

                //get document details - document id - to set and show document to user
                if (DiscType == "OS")
                {
                    DocMapToTypeCodeId = (CalledFromHardCopy) ? ConstEnum.Code.DisclosureTransactionforOS : ConstEnum.Code.PolicyDocument;
                }
                else
                {
                    DocMapToTypeCodeId = (CalledFromHardCopy) ? ConstEnum.Code.DisclosureTransaction : ConstEnum.Code.PolicyDocument;
                }

                //get details if document is uploaded by checking document id
                if (DocumentID > 0)
                {
                    PurposeCodeId = (CalledFrom == "DisclosureDocuments") ? ConstEnum.Code.TransactionDetailsUpload : 0;

                    objDocumentDetailsDTOList = objDocumentDetailsSL.GetDocumentList(objLoginUserDetails.CompanyDBConnectionString, DocMapToTypeCodeId, PolicyDocumentID, PurposeCodeId);

                    ViewBag.DocumentId   = objDocumentDetailsDTOList[0].DocumentId;
                    ViewBag.GUID         = objDocumentDetailsDTOList[0].GUID;
                    ViewBag.DocumentName = objDocumentDetailsDTOList[0].DocumentName;
                    ViewBag.FileType     = objDocumentDetailsDTOList[0].FileType;

                    //check for following file type and set flag to false so message to download file will not be appear
                    if (objDocumentDetailsDTOList[0].FileType == ".pdf")
                    {
                        isShowDownloadDocumentMsg = false;
                    }
                }

                //set flag to show download document message
                ViewBag.ShowDownloadDocumentMsg = isShowDownloadDocumentMsg;

                //check if in session "BackURL" is set or not -- this URL is set from report contoller
                //if url is set then set flag true in viewbag for URL from Report page and reset backurl to empty
                if (objLoginUserDetails.BackURL != null && objLoginUserDetails.BackURL != "")
                {
                    IsCalledFromReport = true;
                    ViewBag.ReturnUrl  = objLoginUserDetails.BackURL;

                    objLoginUserDetails.BackURL = "";
                    Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails);
                }

                ViewBag.IsCalledFromReport = IsCalledFromReport;

                ViewBag.CalledFromHardCopy = CalledFromHardCopy;

                ViewBag.HardCopyFileNotUploaded = HardCopyFileNotUploaded;

                ViewBag.frm = frm;

                ViewBag.UserAction = acid;

                // check from where document is displayed -- if policy document is displayed to user which are view only and whoes status is view only
                // then add event to viewed for user
                if (CalledFrom != null && (CalledFrom.ToLower() == "view" || CalledFrom.ToLower() == "viewagreelist"))
                {
                    //check is document show is view only document
                    if (objUsersPolicyDocumentModel.DocumentViewAgreeFlag != true && objUsersPolicyDocumentModel.DocumentViewFlag == true)
                    {
                        objUserPolicyDocumentEventLogDTO = new UserPolicyDocumentEventLogDTO();

                        objUserPolicyDocumentEventLogDTO.EventCodeId     = ConstEnum.Code.PolicyDocumentViewd;
                        objUserPolicyDocumentEventLogDTO.MapToTypeCodeId = ConstEnum.Code.PolicyDocument;
                        objUserPolicyDocumentEventLogDTO.MapToId         = objUsersPolicyDocumentModel.PolicyDocumentId;

                        // save policy document viewed event
                        objInsiderInitialDisclosureSL.SaveEvent(objLoginUserDetails.CompanyDBConnectionString, objUserPolicyDocumentEventLogDTO, objLoginUserDetails.LoggedInUserID);
                    }
                }

                return(View("~/Views/InsiderInitialDisclosure/ViewDocument.cshtml", objUsersPolicyDocumentModel));
            }
            catch (Exception ex)
            {
                string sErrMessage = Common.Common.getResource(ex.InnerException.Data[0].ToString());
                ModelState.AddModelError("Error", sErrMessage);
                return(View("~/Views/InsiderInitialDisclosure/ViewDocument.cshtml"));
            }
            finally
            {
                objDocumentDetailsSL             = null;
                objDocumentDetailsDTOList        = null;
                objUsersPolicyDocumentModel      = null;
                objUsersPolicyDocumentDTO        = null;
                objInsiderInitialDisclosureSL    = null;
                objLoginUserDetails              = null;
                objDocumentDetailsDTO            = null;
                objUserPolicyDocumentEventLogDTO = null;
            }
        }