Exemplo n.º 1
0
        //public  Boolean checkLaunchFlag()
        //   {

        //       Boolean launchFlag = false;
        //       B_upload = new BuisnessUploads();

        //           SqlParameter[] commandParameters1 = new SqlParameter[2];
        //       commandParameters1[0] = new SqlParameter();
        //       commandParameters1[0].ParameterName = "@ProfileName";
        //       commandParameters1[0].Value = ProfileName;

        //       commandParameters1[1] = new SqlParameter();
        //       commandParameters1[1].ParameterName = "@OwnerLocId";
        //       commandParameters1[1].Value = Ownerlocid;

        //       ds = B_upload.GetTokenvalue(strConnString, "usp_GetUploadConfigvalue", commandParameters1);
        //       if (ds != null && ds.Tables[0].Rows.Count > 0)
        //       {


        //           //  DocumentId,ReviewStatus,ProfileName,StateId,CreatedBy,OwnerLocId,OwnerOrgId,DateCreated,DateModified,ModifiedBy)
        //           launchFlag = Convert.ToBoolean(ds.Tables[0].Rows[0]["ReviewFunctionality"]);


        //       }
        //       return launchFlag;


        //   }


        public void  checkLaunchFlag()
        {
            B_upload = new BuisnessUploads();
            SqlParameter[] commandParameters1 = new SqlParameter[3];
            commandParameters1[0] = new SqlParameter();
            commandParameters1[0].ParameterName = "@ProfileName";
            commandParameters1[0].Value         = ProfileName;

            commandParameters1[1] = new SqlParameter();
            commandParameters1[1].ParameterName = "@OwnerLocId";
            commandParameters1[1].Value         = Ownerlocid;

            commandParameters1[2] = new SqlParameter();
            commandParameters1[2].ParameterName = "@hidrefprofile";
            commandParameters1[2].Value         = hidRefProfile;

            ds = B_upload.GetTokenvalue(strConnString, "usp_GetUploadConfigvalue", commandParameters1);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                bEnableReviewStatus          = Convert.ToBoolean(ds.Tables[0].Rows[0]["ReviewFunctionality"]);
                bEnableApproveStatus         = Convert.ToBoolean(ds.Tables[0].Rows[0]["ApproveFunctionality"]);
                bEnableRejectStatus          = Convert.ToBoolean(ds.Tables[0].Rows[0]["RejectFunctionality"]);
                bEnableItemAssociationStatus = Convert.ToBoolean(ds.Tables[0].Rows[0]["ItemAssocitaionFlag"]);
                bEnableDeletedRecordsStatus  = Convert.ToBoolean(ds.Tables[0].Rows[0]["ViewDeletedFunctionality"]);
            }
            // return launchFlag;
        }
Exemplo n.º 2
0
        public void setConfigValues()
        {
            ds       = new DataSet();
            B_upload = new BuisnessUploads();
            SqlParameter[] commandParameters1 = new SqlParameter[2];
            commandParameters1[0] = new SqlParameter();
            commandParameters1[0].ParameterName = "@ProfileName";
            commandParameters1[0].Value         = Session["profileName"].ToString();
            commandParameters1[1] = new SqlParameter();
            commandParameters1[1].ParameterName = "@hidrefprofile";
            commandParameters1[1].Value         = Session["hidrefprofile"].ToString();

            try
            {
                ds = B_upload.GetTokenvalue(strConnString, "usp_GetUploadConfigvalue", commandParameters1);
                if (ds != null && ds.Tables["FileAndTokenInfo"].Rows.Count > 0)
                {
                    sRefProfName    = ds.Tables[0].Rows[0]["RefProfileName"].ToString();
                    sSLUN           = ds.Tables[0].Rows[0]["ShareLocationUserName"].ToString();
                    sSLD            = ds.Tables[0].Rows[0]["ShareLocationDomain"].ToString();
                    sSLP            = ds.Tables[0].Rows[0]["ShareLocationPassword"].ToString();
                    sSFP            = ds.Tables[0].Rows[0]["SRDocumentsShareFolderPath"].ToString();
                    sPwd            = ds.Tables[0].Rows[0]["SRDocumentsShareFolderPath"].ToString();
                    ShareFolderPath = sSFP;
                    sPwd            = CgServices.DecryptData(sSLP);
                }
            }
            catch (Exception ex)
            {
                Elog = new ErrorLogger();
                Elog.WriteToLogFile(ex, "public setConfigValues In renderFile Profile name '" + Session["profileName"].ToString() + "'and hidprofile'" + Session["hidrefprofile"].ToString() + "'", "tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'  ");
                Elog = null;
            }
            B_upload = null;
        }
Exemplo n.º 3
0
        private string LoadData()
        {
            B_upload = new BuisnessUploads();

            DataSet   dtjson1    = new DataSet();
            DataTable dtjsondata = null;

            try
            {
                // string sx = DeleteFlag.Text;
                //String constr =
                SqlParameter[] commandParameters = new SqlParameter[11];
                commandParameters[0] = new SqlParameter();
                commandParameters[0].ParameterName = "@ReferenceId";
                commandParameters[0].Value         = DeclarationId;
                commandParameters[1] = new SqlParameter();
                commandParameters[1].ParameterName = "@pageId";
                commandParameters[1].Value         = TablePrimaryKey;
                commandParameters[2] = new SqlParameter();
                commandParameters[2].ParameterName = "@ProfileName";
                commandParameters[2].Value         = ProfileName;

                commandParameters[3] = new SqlParameter();
                commandParameters[3].ParameterName = "@langId";
                commandParameters[3].Value         = lang;

                GetDirection.Text = lang;

                commandParameters[4] = new SqlParameter();
                commandParameters[4].ParameterName = "@DocumentId";
                commandParameters[4].Value         = "";
                // ref profile addition for crf

                commandParameters[5] = new SqlParameter();
                commandParameters[5].ParameterName = "@RefProfile";
                commandParameters[5].Value         = hidRefProfile;
                // for additional documents request
                commandParameters[6] = new SqlParameter();
                commandParameters[6].ParameterName = "@tokenvalue";
                commandParameters[6].Value         = mytokenvalue;

                commandParameters[7] = new SqlParameter();
                commandParameters[7].ParameterName = "@AdditionalDocRequestId";
                commandParameters[7].Value         = AdditionalDocumentId;

                commandParameters[8] = new SqlParameter();
                commandParameters[8].ParameterName = "@DeletedRecordsFlag";
                commandParameters[8].Value         = flagForRecords;

                commandParameters[9] = new SqlParameter();
                commandParameters[9].ParameterName = "@TypeOfFilter";
                commandParameters[9].Value         = TypeOfFilter.Value;


                commandParameters[10] = new SqlParameter();
                commandParameters[10].ParameterName = "@labelText";
                commandParameters[10].Value         = labelText.Value;

                var s = declarationDocumenttype;


                ds         = B_upload.GetTokenvalue(strConnString, "Sp_GetPathValues", commandParameters);
                dtjsondata = ds.Tables[0];
                if (ds.Tables[0].Rows.Count != 0)
                {
                    string strFileNameIds = "";
                    string sGuid          = "";
                    if (dtjsondata.Rows.Count > 0)
                    {
                        sGuid = System.Guid.NewGuid().ToString("N");
                        for (int k = 0; k < dtjsondata.Rows.Count; k++)
                        {
                            if (strFileNameIds == "")
                            {
                                strFileNameIds = Encrypt(dtjsondata.Rows[k]["FileNameId"].ToString());
                            }
                            else
                            {
                                strFileNameIds = strFileNameIds + "," + Encrypt(dtjsondata.Rows[k]["FileNameId"].ToString());
                            }
                        }

                        SqlParameter[] commandParameters1 = new SqlParameter[2];
                        commandParameters1[0]       = new SqlParameter("@sGuid", SqlDbType.VarChar);
                        commandParameters1[0].Value = sGuid;
                        commandParameters1[1]       = new SqlParameter("@strFileNameIds", SqlDbType.VarChar);
                        commandParameters1[1].Value = strFileNameIds;

                        int InsertResult = B_upload.ExecuteNonQuery(strConnString, "sp_ViewerFileSecurityToken", commandParameters1);
                    }
                }

                else
                {
                    //  Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('No Documents found ')",true);
                }
            }
            catch (Exception ex)
            {
                Elog = new ErrorLogger();
                Elog.WriteToLogFile(ex, "", " from doc gallery LoadData  Param Information => (referredUrl = '" + Session["referredUrl"].ToString() + "')    and tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'and tokensalt = '" + Tokensalt + "'");
                Elog = null;
            }
            B_upload = null;
            return(DataTableToJSONWithStringBuilder(dtjsondata));
        }
Exemplo n.º 4
0
        protected override void InitializeCulture()
        {
            Elog = new ErrorLogger();
            //  to be enabled for security testing

            /*  Uri myReferrer = Request.UrlReferrer;
             * if (myReferrer == null)
             * {
             *
             *    Response.Redirect("DocumentError.aspx");
             *
             * }
             */
            B_upload    = new BuisnessUploads();
            referredUrl = Request.RawUrl.ToString();

            Elog.WriteToLogFile("The First Request From Documents Gallery  For Url Verification ", "the requested Raw Url'" + referredUrl + "' ");

            Session["referredUrl"] = referredUrl.TrimStart('/').ToString();

            tokenvalue   = Request.QueryString["tokenvalue"];
            EncodedToken = tokenvalue;
            if (tokenvalue != null)
            {
                {
                    try
                    {
                        DcryptString            = B_upload.DecryptToken(tokenvalue);
                        queryParamArray         = DcryptString.Split('+');
                        Session["mysessionId"]  = queryParamArray[1];
                        Session["mytokenvalue"] = queryParamArray[2];
                        mytokenvalue            = Session["mytokenvalue"].ToString().Split('|')[0];
                        Tokensalt   = Session["mytokenvalue"].ToString().Split('|')[1];
                        mysessionId = Session["mysessionId"].ToString();

                        SqlParameter[] commandParameters1 = new SqlParameter[3];
                        commandParameters1[0] = new SqlParameter();
                        commandParameters1[0].ParameterName = "@tokenval";
                        commandParameters1[0].Value         = mytokenvalue.ToString().Split('|')[0];
                        // commandParameters1[0].Value = "512a15ed44064189b440a9293096b4c6";
                        commandParameters1[1] = new SqlParameter();
                        commandParameters1[1].ParameterName = "@sessionId";
                        commandParameters1[1].Value         = Session["mysessionId"].ToString();
                        //   commandParameters1[1].Value = "bajbgc15c3aa4rxxahnkmm25";
                        commandParameters1[2] = new SqlParameter();
                        commandParameters1[2].ParameterName = "@Tokensalt";
                        commandParameters1[2].Value         = Tokensalt;
                        ds = B_upload.GetTokenvalue(strConnString, "usp_GetTokenInfo_DocUpload", commandParameters1);
                        if (ds.Tables.Count != 0)
                        {
                            if (ds != null && ds.Tables[0].Rows.Count > 0)
                            {
                                try
                                {
                                    languageid              = ds.Tables[0].Rows[0]["LanguageId"].ToString();
                                    UploadedFrom            = ds.Tables[0].Rows[0]["ReferenceProfile"].ToString();
                                    declarationDocumenttype = ds.Tables[0].Rows[0]["DocumentId"].ToString();
                                    hidRefProfile           = ds.Tables[0].Rows[0]["ReferenceProfile"].ToString();
                                    ProfileName             = ds.Tables[0].Rows[0]["profileName"].ToString();
                                    DeclarationId           = ds.Tables[0].Rows[0]["ReferenceId"].ToString();
                                    pageId                   = ds.Tables[0].Rows[0]["pageId"].ToString();
                                    TablePrimaryKey          = B_upload.GetPrimaryKey(ProfileName, strConnString);
                                    Ownerlocid               = Convert.ToInt32(ds.Tables[0].Rows[0]["ownerlocid"]);
                                    Ownerorgid               = Convert.ToInt32(ds.Tables[0].Rows[0]["OwnerOrgId"]);
                                    ModifiedBy               = ds.Tables[0].Rows[0]["ModifiedBy"].ToString();
                                    CreatedBy                = ds.Tables[0].Rows[0]["CreatedBy"].ToString();
                                    Session["profileName"]   = ProfileName.ToString();
                                    Session["DeclarationId"] = DeclarationId.ToString();
                                    Session["hidRefProfile"] = hidRefProfile.ToString();
                                    lang1 = ds.Tables[0].Rows[0]["LanguageId"].ToString();
                                    AdditionalDocumentFlag   = ds.Tables[0].Rows[0]["AdditionalDocumentFlag"].ToString();
                                    AdditionalDocumentId     = ds.Tables[0].Rows[0]["AdditionalDocumentId"].ToString();
                                    additionaldocidforreview = ds.Tables[0].Rows[0]["AdditionalDocumentId"].ToString();
                                    DecIdforreview           = DeclarationId.ToString();
                                    ThemeId = ds.Tables[0].Rows[0]["ThemeId"].ToString();
                                }
                                catch (Exception ex)
                                {
                                    Elog = new ErrorLogger();
                                    //     WriteToLogFile(ex, "protected override void InitializeCulture()");
                                    Elog.WriteToLogFile(ex, "", " from documents gallery  protected override void InitializeCulture() in value of usp_GetTokenInfo_DocUpload  Param Information => (referredUrl = '" + Session["referredUrl"].ToString() + "')    and tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'and tokensalt = '" + Tokensalt + "'");
                                    Elog = null;
                                }
                            }
                        }
                        else
                        {
                            Elog = new ErrorLogger();
                            //   WriteToLogFile("No Value Found For in Sp :usp_GetTokenInfo_DocUpload '" + mytokenvalue + "'");
                            Elog.WriteToLogFile("", " from documents gallery protected override void InitializeCulture() in value of usp_GetTokenInfo_DocUpload  Param Information => (referredUrl = '" + Session["referredUrl"].ToString() + "')    and tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'and tokensalt = '" + Tokensalt + "'");
                            Elog = null;
                            Response.Redirect("DocumentError.aspx");
                        }
                    }


                    catch (Exception ex)
                    {
                        Elog = new ErrorLogger();
                        Elog.WriteToLogFile(ex, "", " from documents gallery protected override void InitializeCulture()   Param Information => (referredUrl = '" + Session["referredUrl"].ToString() + "')    and tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'and tokensalt = '" + Tokensalt + "'");
                        Elog = null;
                        //  WriteToLogFile(ex);
                    }
                }
                B_upload = null;
            }

            else
            {
                Elog = new ErrorLogger();
                Elog.WriteToLogFile("", " from documents gallery Null Token Recived   Param Information => (referredUrl = '" + Session["referredUrl"].ToString() + "')    and tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'and tokensalt = '" + Tokensalt + "'");
                Elog = null;
                // WriteToLogFile("Null Token Recived  '" + tokenvalue + "'");
                Response.Redirect("DocumentError.aspx");
            }
            // bEnableReviewStatus = checkLaunchFlag();

            checkLaunchFlag();
            //bEnableReviewStatus = Convert.ToBoolean(launchFlagFrReview);
            //bEnableRejectStatus = Convert.ToBoolean(launchFlagFrReject);
            //bEnableApproveStatus = Convert.ToBoolean(launchFlagFrApprove);
            //bEnableItemAssociationStatus = Convert.ToBoolean(launchFlagFrItemAssociation);


            //   bEnableReviewStatus = true;
            if (!bEnableReviewStatus)
            {
                //  Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('Not allowed Save Functionality')",true);
            }
            if (!string.IsNullOrEmpty(lang1))
            {
                lang = lang1.ToString().ToLower().Substring(0, 2);
            }
            this.UICulture = lang;
            LocRM          = captions.ResourceManager;
            base.InitializeCulture();
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string totalpath = "";

            B_upload = new BuisnessUploads();
            if (Request.QueryString["UploadedFrom"] != null && Request.QueryString["UploadedFrom"].ToString() == "OrganizationRequests")
            {
                ShareFolderPath = ConfigurationManager.AppSettings["ORDocumentsShareFolderPath"].ToString();
            }
            if (Request.QueryString["Documentid"] != null)
            {
                try
                {
                    // Read the file and convert it to Byte Array
                    string filePath    = ShareFolderPath;
                    string profilename = Session["profileName"].ToString();
                    string filename    = "";
                    //   string red = System.Web.HttpUtility.UrlDecode(Request.QueryString["Documentid"].ToString());
                    //   string filenameid = Request.QueryString["Documentid"].ToString().Replace("'", string.Empty).Replace(" ","+");
                    string         Documentid        = Decrypt(Request.QueryString["Documentid"].ToString());
                    SqlParameter[] commandParameters = new SqlParameter[4];
                    commandParameters[0] = new SqlParameter();
                    commandParameters[0].ParameterName = "@Id";
                    commandParameters[0].Value         = Documentid;
                    commandParameters[0].SqlDbType     = SqlDbType.Int;
                    commandParameters[1] = new SqlParameter();
                    commandParameters[1].ParameterName = "@TablePrimaryKey";
                    commandParameters[1].Value         = B_upload.GetPrimaryKey(profilename, strConnString);
                    commandParameters[2] = new SqlParameter();
                    commandParameters[2].ParameterName = "@ProfileName";
                    commandParameters[2].Value         = profilename;
                    commandParameters[3] = new SqlParameter();
                    commandParameters[3].ParameterName = "@declarationid";
                    commandParameters[3].Value         = Convert.ToInt32(Session["DeclarationId"]);
                    commandParameters[3].SqlDbType     = SqlDbType.Int;

                    ds = B_upload.GetTokenvalue(strConnString, "Sp_DwonloadFile", commandParameters);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        filename = ds.Tables[0].Rows[0]["NewFileName"].ToString();
                    }
                    filename = filename.Replace("//", "\\");
                    string contenttype = "";
                    if (filename.ToLower().EndsWith("pdf"))
                    {
                        contenttype = "application/pdf";
                    }
                    else
                    // in prod
                    // contenttype = "image/" + Path.GetExtension(filename.Replace(".", ""));
                    if (filename.ToLower().EndsWith("jpeg") || filename.ToLower().EndsWith("jpg"))
                    {
                        contenttype = "image/jpeg" + Path.GetExtension(filename.Replace(".", ""));// Request.QueryString["FileName"].ToString().Split('.')[Request.QueryString["FileName"].ToString().Split('.').Length - 1];//+ Path.GetExtension(Request.QueryString["FileName"].Replace(".", ""));
                    }
                    else
                    {
                        contenttype = "image/png" + Path.GetExtension(filename.Replace(".", ""));// Request.QueryString["FileName"].ToString().Split('.')[Request.QueryString["FileName"].ToString().Split('.').Length - 1];//+ Path.GetExtension(Request.QueryString["FileName"].Replace(".", ""));
                    }
                    // image/png
                    setConfigValues();
                    iU.Impersonate(sSLD, sSLUN, sPwd);
                    filePath = ShareFolderPath;
                    // filePath = @"\\10.10.65.3\kgac_upload_dd_test";
                    totalpath = Path.Combine(filePath, filename);

                    FileStream fs = new FileStream(Path.Combine(filePath, filename),
                                                   FileMode.Open, FileAccess.Read);
                    BinaryReader br    = new BinaryReader(fs);
                    Byte[]       bytes = br.ReadBytes((Int32)fs.Length);
                    br.Close();
                    fs.Close();
                    iU.Undo();
                    //Write the file to response Stream
                    Response.Buffer = false;
                    Response.Clear();
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.ContentType = contenttype;
                    Response.AddHeader("content-disposition", "inline;filename=" + filename);
                    Response.BinaryWrite(bytes);
                    Response.Flush();
                    //  Response.End();
                    B_upload = null;
                }
                catch (Exception ex)
                {
                    // WriteToLogFile(ex ,"From RenderFile'"+ totalpath+"'");
                    //   Response.Redirect("DocumentError.aspx");
                    Elog = new ErrorLogger();
                    Elog.WriteToLogFile(ex, "public Page_Load In renderFile Profile name '" + Session["profileName"].ToString() + "'and hidprofile'" + Session["hidrefprofile"].ToString() + "'", "tokenValue = '" + Session["mytokenvalue"].ToString() + "' and sessionID = '" + Session["mysessionId"].ToString() + "'  ");
                    Elog = null;
                    Response.Redirect("DocumentRenderError.aspx");
                }
            }
        }