Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    if (!this.Page.User.Identity.IsAuthenticated)
                    {
                        FormsAuthentication.RedirectToLoginPage();
                    }
                    else
                    {
                        HttpRequest req    = HttpContext.Current.Request;
                        string      EncrID = HttpUtility.UrlDecode(Request.QueryString["FileID"].ToString()).Replace(" ", "+");

                        if (!string.IsNullOrEmpty(EncrID))
                        {
                            int fileId = Convert.ToInt32(EncryptDecrypt.Decrypt(EncrID));

                            var result = DbAccess.GetFileOrderData(fileId);
                            if (result != null && result.Rows.Count > 0)
                            {
                                OrderNo      = Convert.ToString(result.Rows[0]["OrderNo"]);
                                PartNo       = Convert.ToString(result.Rows[0]["PartNo"]);
                                FileDiskName = Convert.ToString(result.Rows[0]["FileDiskName"]);
                                FileName     = Convert.ToString(result.Rows[0]["FileName"]);
                            }
                            JavaScriptSerializer ser = new JavaScriptSerializer();
                            Guid gs;
                            gs      = Guid.NewGuid();
                            GuidVal = gs.ToString();
                            string configPath = Path.Combine(req.PhysicalApplicationPath, languageFileName);
                            if (File.Exists(configPath))
                            {
                                using (Stream jsonDataStream = new FileStream(configPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                                {
                                    using (TextReader tr = new StreamReader(jsonDataStream))
                                    {
                                        languageJson = tr.ReadToEnd();
                                        languageJson = languageJson.Replace('\r', ' ');
                                        languageJson = languageJson.Replace('\n', ' ');
                                        languageJson = languageJson.Replace('\t', ' ');
                                    }
                                    jsonDataStream.Close();
                                }
                            }

                            configPath = Path.Combine(req.PhysicalApplicationPath, searchtext);
                            if (File.Exists(configPath))
                            {
                                using (Stream jsonDataStream = new FileStream(configPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                                {
                                    using (TextReader tr = new StreamReader(jsonDataStream))
                                    {
                                        searchJson = tr.ReadToEnd();
                                        searchJson = searchJson.Replace('\r', ' ');
                                        searchJson = searchJson.Replace('\n', ' ');
                                        searchJson = searchJson.Replace('\t', ' ');
                                    }
                                    jsonDataStream.Close();
                                }
                            }
                            getTemplates(Path.Combine(req.PhysicalApplicationPath, templatePath));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }