private void DashBoardView()
 {
     try
     {               
         string PageSEOName = string.Empty;
         if (Request.QueryString["pgnm"] != null)
         {
             PageSEOName = Request.QueryString["pgnm"].ToString();
         }
         else
         {
             PageBase pb = new PageBase();
             SageUserControl SageUser = new SageUserControl();
             PageSEOName = pb.GetPageSEOName(SageUser.PagePath);
         }
         DashboardController objController = new DashboardController();
         List<DashboardInfo> lstDashboard = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID);
         lstDashboard.ForEach(
             delegate(DashboardInfo obj)
             {
                 obj.IconFile = string.Format("{0}/PageImages/{1}", Request.ApplicationPath == "/" ? "" : Request.ApplicationPath, obj.IconFile);
                 obj.Url = obj.Url + Extension;
             }
             );
         rptDashBoard.DataSource = lstDashboard; 
         rptDashBoard.DataBind();            
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }            
 }
Exemplo n.º 2
0
        public override void Execute(PageBase page)
        {
            var absurl = Jhu.Graywulf.Web.Util.UrlFormatter.ToAbsoluteUrl(Url);

            page.Response.Output.WriteLine(
                "Testing URL {0} expecting HTTP status {1}",
                absurl,
                (int)ExpectedStatus);

            try
            {
                var req = HttpWebRequest.Create(absurl);
                var res = req.GetResponse();

                var status = ((HttpWebResponse)res).StatusCode;
                if (status != ExpectedStatus)
                {
                    throw new Exception(String.Format("Unexpected HTTP status code {0}", (int)status));
                }
            }
            catch (WebException ex)
            {
                var status = ((HttpWebResponse)ex.Response).StatusCode;
                if (status != ExpectedStatus)
                {
                    throw;
                }
            }

            page.Response.Output.WriteLine("Page retrieved successfully.");
        }
Exemplo n.º 3
0
 private void InitPage()
 {
     _PageBase = new PageBase();
     var query = _PageBase.Permissions.Where(p => p.MOD_LEVEL == 1).OrderBy(p => p.MOD_LEVEL);
     this.rptMenu0.DataSource = query;
     this.rptMenu0.DataBind();
 }
Exemplo n.º 4
0
 private void DashBoardView()
 {
     try
     {
         DashBoardDataContext db = new DashBoardDataContext(SystemSetting.SageFrameConnectionString);
         string PageSEOName = string.Empty;
         if (Request.QueryString["pgnm"] != null)
         {
             PageSEOName = Request.QueryString["pgnm"].ToString();
         }
         else
         {
             PageBase pb = new PageBase();
             SageUserControl SageUser = new SageUserControl();
             PageSEOName = pb.GetPageSEOName(SageUser.PagePath);
         }
         var LINQDashBoardView = db.sp_DashBoardView(PageSEOName, GetUsername, GetPortalID);
        rptDashBoard.DataSource = LINQDashBoardView;
         rptDashBoard.DataBind();
     
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
     
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        PageBase objPageBase = new PageBase();
        if (objPageBase.IsUserLoggedIn())
        {
            if (CheckAuthentication())
            {
                this.dirLabel.Text = @"Upload\images\";
                ImageFiles = new List<ImageFile>();
                string appPath = Request.ApplicationPath.Equals("/") ? "" : Request.ApplicationPath;
                path = appPath + @"/Upload/images";
                thumbpath = path + "/thumb";
                if (Directory.Exists(physicalpath))
                {
                    foreach (string fileName in Directory.GetFiles(physicalpath))
                    {
                        FileInfo fileInfo = new FileInfo(fileName);

                        ImageFiles.Add(new ImageFile { ThumbImageFileName = thumbpath + @"/" + fileInfo.Name, FileName = path + @"/" + fileInfo.Name, Size = (fileInfo.Length / 1024).ToString(), CreatedDate = fileInfo.LastAccessTime.ToString() });
                    }
                    ImageFiles = ImageFiles.OrderByDescending(x => DateTime.Parse(x.CreatedDate)).ToList();
                }
            }
        }
        else
        {
            //Response.WriteFile(":p");

            this.Page.Form.Visible = false;
            
        }
    }
Exemplo n.º 6
0
 private bool StartAppAndTryLogin(Driver driver, out PageBase resultPage)
 {
     driver.Instance.Navigate().GoToUrl(HomepageUrl);
     var startPage = new StartPage(driver.Instance);
     var resultLogin = startPage.TryLoginAs(userData.UserName, userData.Password, out resultPage);
     return resultLogin;
 }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        page = (PageBase)this.Page;

        page.PageModeChanged += new EventHandler<PageModeChangedEventArgs>(page_PageModeChanged);
        LblTitle.Text = page.Title;
    }
Exemplo n.º 8
0
        public IEnumerable<PageData> ExecuteCommand(PageBase currentPage)
        {
            var fa = new FilterAccess(EPiServer.Security.AccessLevel.Read);
            var pdc = currentPage.GetChildren(currentPage.CurrentPageLink);

            fa.Filter(pdc);

            return pdc;
        }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["CurrentProfile"] != null)
         Session.Remove("CurrentProfile");
     _page = (PageBase) Page;
     _stats = Statistics.GetStatistics();
     if (_stats == null)
         return;
     PopulateData();
 }
Exemplo n.º 10
0
        public Control GetControl(PageBase hostPage)
        {
            var oEmbedControl = new oEmbedControl();

            var options = new oEmbedOptions { Url = url.ToString(), MaxWidth = Convert.ToInt32(width.Value), MaxHeight = Convert.ToInt32(height.Value) };

            oEmbedControl.Options = options;

            return oEmbedControl;
        }
Exemplo n.º 11
0
        public override void Execute(PageBase page)
        {
            page.Response.Output.WriteLine(
                "Testing assembly: {0}",
                Path);

            var a = Assembly.ReflectionOnlyLoadFrom(Path);

            page.Response.Output.WriteLine("Assembly found: {0}", a.FullName);
        }
 public FacebookFriendsDataBackgroundWorkerClass(PageBase pageBase, HttpContext context,
                                            LoveHitchFacebookApp facebook, long id, string accessToken)
 {
     _pageBase = pageBase;
     _context = context;
     timestamps = new TimeMeasure();
     _facebook = facebook;
     _id = id;
     _accessToken = accessToken;
 }
Exemplo n.º 13
0
        public override void Execute(PageBase page)
        {
            page.Response.Output.WriteLine(
                "Testing registry entry: {0}",
                Name);

            var ef = new EntityFactory(page.RegistryContext);
            var e = ef.LoadEntity(Name);

            page.Response.Output.WriteLine("Entry retrieved: {0}", e.Guid);
        }
Exemplo n.º 14
0
        public void SetPage( PageBase page)
        {
            this.Page = page;

            btnFirst.Tag = 0;
            btnPre.Tag =page.PageIdx - 1;
            btnNext.Tag = Page.PageIdx + 1;
            btnLast.Tag = Page.TotalPages - 1;
            txtPage.Text = (Page.PageIdx + 1) >= Page.TotalPages ? Page.TotalPages.ToString() : (Page.PageIdx + 1).ToString();

            lblTotal.Text = "共" + Page.TotalPages + "页/" + Page.TotalRecords + "条";


            if (Page.PageIdx == 0)
            {
                btnFirst.Enabled = false;
            }
            else
            {
                btnFirst.Enabled = true;
            }

            if (Page.PageIdx > 0)
            {
                btnPre.Enabled = true;
            }
            else
            {
                btnPre.Enabled = false;
            }


            if (Page.TotalPages > 0 && Page.PageIdx + 1 < Page.TotalPages)
            {
                btnNext.Enabled = true;
            }
            else
            {
                btnNext.Enabled = false;
            }

            if (Page.PageIdx == Page.TotalPages - 1)
            {
                btnLast.Enabled = false;
            }
            else
            {
                btnLast.Enabled = true;
            }

        }
 private bool CheckAuthentication()
 {
     BaseAdministrationUserControl obj = new BaseAdministrationUserControl();
     int userModuleId = int.Parse(Request.QueryString["userModuleId"].ToString());
     SageFrame.Services.AuthenticateService objAuthentication = new SageFrame.Services.AuthenticateService();
     PageBase objPageBase = new PageBase();
     if (objAuthentication.IsPostAuthenticatedView(obj.GetPortalID, userModuleId, obj.GetUsername, objPageBase.SageFrameSecureToken))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemplo n.º 16
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string userCode = "fanruiquan";// txtUserName.Text.Trim();
            string password = "******";// txtPassword.Text.Trim();

            UserInfoBll userBll = new UserInfoBll();

            UserInfo userInfo = userBll.GetUserByCode(userCode);

            PageBase pageBase = new PageBase();

            if(pageBase.Login(userInfo,password ))
            {
                Response.Redirect("Main.aspx");
            }
        }
Exemplo n.º 17
0
        private void DashBoardView()
        {
            try
            {
                string PageSEOName = string.Empty;
                if (Request.QueryString["pgnm"] != null)
                {
                    PageSEOName = Request.QueryString["pgnm"].ToString();
                }
                else
                {
                    PageBase pb = new PageBase();
                    SageUserControl SageUser = new SageUserControl();
                    PageSEOName = pb.GetPageSEOName(SageUser.PagePath);
                }
                DashboardController objController = new DashboardController();
                List<DashboardInfo> lstDashboard = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID);
                lstDashboard.ForEach(
                    delegate(DashboardInfo obj)
                    {
                        if (obj.IconFile != null && obj.IconFile != string.Empty)
                        {
                            string iconFile = string.Empty;
                            iconFile = string.Format("{0}/PageImages/{1}", Request.ApplicationPath == "/" ? "" : Request.ApplicationPath, obj.IconFile);
                            iconFile = "<img align='middle' style='border-width:0px;' src='" + iconFile + "' class='sfImageheight' id='ctl17_rptDashBoard_ctl17_imgDisplayImage'>";
                            obj.IconFile = iconFile;
                        }
                        else
                        {
                            obj.IconFile = "<i class='icon-" + obj.PageName.Replace(" ", "-").ToLower() + "'></i>";

                        }
                        obj.Url = obj.Url + Extension;
                    }
                    );
                rptDashBoard.DataSource = lstDashboard;
                rptDashBoard.DataBind();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemplo n.º 18
0
        public bool TryLoginAs(string userName, string password, out PageBase resultPage)
        {
            this.ExecuteStep(() =>
            {
                Log.Info(string.Format("Log in as {0}, {1}", userName, password));
                LoginNameInput.ClearFill(userName);
                PasswordInput.ClearFill(password);

                LoginButton.Click();
            });
                if (this.Driver.FindElements(By.ClassName("validation")).Count==0) 
                {
                    resultPage = new WelcomePage(this.Driver);
                    return true;
                }
                else
                {
                    resultPage = this;
                    return false;
                }
            
        }
Exemplo n.º 19
0
 /// <summary>
 /// Return the dynamic content as a string.
 /// This method will only be called by EPiServer if the <see cref="RendersWithControl"/> property returns false
 /// </summary>
 /// <param name="hostPage">A reference to the EPiServer page hosting the dynamic content. This can be null as Render can be called when there is no page in context</param>
 /// <returns>Always <code>null</code> since we're rendering with a control</returns>
 public string Render(PageBase hostPage)
 {
     return(null);
 }
Exemplo n.º 20
0
    protected void output_cl_cql_lryl()
    {
        IDictionary <string, object> dictionary = new Dictionary <string, object>();

        if (!base.IsUserLoginByMobileForAjax())
        {
            dictionary.Add("status", "2");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
        else
        {
            string        str   = "_m_pcdd_lmcl";
            string        str2  = "_m_pcdd_cql";
            List <object> cache = new List <object>();
            if (CacheHelper.GetCache("balance_kc_FileCacheKey" + str) != null)
            {
                cache = CacheHelper.GetCache("balance_kc_FileCacheKey" + str) as List <object>;
            }
            else
            {
                DataTable table = CallBLL.cz_phase_pcdd_bll.GetChangLong().Tables[0];
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        cache.Add(row["c_name"].ToString() + "," + row["c_qs"].ToString());
                    }
                }
                CacheHelper.SetCache("balance_kc_FileCacheKey" + str, cache);
                CacheHelper.SetPublicFileCache("balance_kc_FileCacheKey" + str, cache, PageBase.GetPublicForderPath(base.get_KC_BalanceFileName()));
            }
            string str6 = string.Join("|", cache.ToArray());
            dictionary.Add("long", str6);
            if (!string.IsNullOrEmpty(LSRequest.qq("page_type").Trim()))
            {
                string str8 = "pcdd_lmp";
                Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                if (CacheHelper.GetCache("balance_kc_FileCacheKey" + str2 + str8) != null)
                {
                    dictionary2 = CacheHelper.GetCache("balance_kc_FileCacheKey" + str2 + str8) as Dictionary <string, object>;
                    dictionary.Add("ph_title", dictionary2["ph_title"]);
                    dictionary.Add("ph_content", dictionary2["ph_content"]);
                }
                else
                {
                    Dictionary <string, string> paiHang = CallBLL.cz_phase_pcdd_bll.GetPaiHang(10);
                    if ((paiHang != null) && (paiHang.Count > 0))
                    {
                        ArrayList list2 = new ArrayList();
                        ArrayList list3 = new ArrayList();
                        foreach (KeyValuePair <string, string> pair in paiHang)
                        {
                            list2.Add(pair.Key);
                            if (pair.Key.Equals("波色"))
                            {
                                list3.Add(pair.Value.Replace("波", ""));
                            }
                            else
                            {
                                list3.Add(pair.Value);
                            }
                        }
                        string str9 = string.Join("|", list2.ToArray());
                        dictionary.Add("ph_title", str9);
                        dictionary.Add("ph_content", list3);
                        dictionary2.Add("ph_title", str9);
                        dictionary2.Add("ph_content", list3);
                        CacheHelper.SetCache("balance_kc_FileCacheKey" + str2 + str8, dictionary2);
                        CacheHelper.SetPublicFileCache("balance_kc_FileCacheKey" + str2 + str8, dictionary2, PageBase.GetPublicForderPath(base.get_KC_BalanceFileName()));
                    }
                }
            }
            dictionary.Add("status", "1");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
    }
Exemplo n.º 21
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetPopUpSkin gets the Skin that is used in modal popup.
        /// </summary>
        /// <param name="page">The Page</param>
        /// <history>
        /// 	[vnguyen]   06/07/2011      Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static Skin GetPopUpSkin(PageBase page)
        {
            Skin skin = null;

            //attempt to find and load a popup skin from the assigned skinned source
            string skinSource = Globals.IsAdminSkin() ? SkinController.FormatSkinSrc(page.PortalSettings.DefaultAdminSkin, page.PortalSettings) : page.PortalSettings.ActiveTab.SkinSrc;
            if (!String.IsNullOrEmpty(skinSource))
            {
                skinSource = SkinController.FormatSkinSrc(SkinController.FormatSkinPath(skinSource) + "popUpSkin.ascx", page.PortalSettings);

                if (File.Exists(HttpContext.Current.Server.MapPath(SkinController.FormatSkinSrc(skinSource, page.PortalSettings))))
                {
                    skin = LoadSkin(page, skinSource);
                }
            }

            //error loading popup skin - load default popup skin
            if (skin == null)
            {
                skinSource = Globals.HostPath + "Skins/_default/popUpSkin.ascx";
                skin = LoadSkin(page, skinSource);
            }

            //set skin path
            page.PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(skinSource);

            //set skin id to an explicit short name to reduce page payload and make it standards compliant
            skin.ID = "dnn";

            return skin;
        }
Exemplo n.º 22
0
        /// <summary>
        /// Gets the root page for the main menu.
        /// </summary>
        private PageReference GetMainMenuContainer()
        {
            PageBase page = Page as PageBase;

            return(page == null ? null : page.CurrentPage["MainMenuContainer"] as PageReference);
        }
Exemplo n.º 23
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        page = (PageBase)Page;
    }
Exemplo n.º 24
0
 public T GetPageAs <T>() where T : PageBase
 {
     return(PageBase.InitializePage <T>(WebDriver));
 }
Exemplo n.º 25
0
 /// <summary>
 /// Handles load event
 /// </summary>
 /// <param name="e">Event arguments</param>
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     LinkButtonEdit.Visible = Membership.QueryDistinctMembershipLevel(CurrentPage, MembershipLevels.Administer);
     PageBase.DataBind();
 }
Exemplo n.º 26
0
        /// <summary>
        /// Gets the page models with the specified id's.
        /// </summary>
        /// <param name="ids">The unique id's</param>
        /// <returns>The page models</returns>
        public async Task <IEnumerable <T> > GetByIdsAsync <T>(params Guid[] ids) where T : PageBase
        {
            var ret       = new List <T>();
            var notCached = new List <Guid>();

            // Try to get the requested models from cache
            foreach (var id in ids)
            {
                PageBase model = null;

                if (typeof(T) == typeof(Models.PageInfo))
                {
                    model = _cache?.Get <PageInfo>($"PageInfo_{id.ToString()}");
                }
                else if (!typeof(DynamicPage).IsAssignableFrom(typeof(T)))
                {
                    model = _cache?.Get <PageBase>(id.ToString());

                    if (model != null)
                    {
                        await _factory.InitAsync(model, App.PageTypes.GetById(model.TypeId)).ConfigureAwait(false);
                    }
                }

                if (model == null)
                {
                    notCached.Add(id);
                }
                else if (model is T)
                {
                    ret.Add(await MapOriginalAsync((T)model).ConfigureAwait(false));
                }
            }

            // Get the models not available in cache from the
            // repository.
            if (notCached.Count > 0)
            {
                var models = await _repo.GetByIds <T>(notCached.ToArray()).ConfigureAwait(false);

                foreach (var model in models.Where(m => m is T))
                {
                    await OnLoadAsync(model).ConfigureAwait(false);

                    ret.Add(await MapOriginalAsync((T)model).ConfigureAwait(false));
                }
            }

            // Sort the output in the same order as the input array
            var sorted = new List <T>();

            foreach (var id in ids)
            {
                var model = ret.FirstOrDefault(m => m.Id == id);

                if (model != null)
                {
                    sorted.Add(model);
                }
            }
            return(sorted);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Processes the model on load.
        /// </summary>
        /// <param name="model">The model</param>
        /// <param name="isDraft">If this is a draft</param>
        private async Task OnLoadAsync(PageBase model, bool isDraft = false)
        {
            if (model != null)
            {
                // Initialize model
                if (model is IDynamicContent dynamicModel)
                {
                    await _factory.InitDynamicAsync(dynamicModel, App.PageTypes.GetById(model.TypeId)).ConfigureAwait(false);
                }
                else
                {
                    await _factory.InitAsync(model, App.PageTypes.GetById(model.TypeId)).ConfigureAwait(false);
                }

                // Initialize primary image
                if (model.PrimaryImage == null)
                {
                    model.PrimaryImage = new Extend.Fields.ImageField();
                }

                if (model.PrimaryImage.Id.HasValue)
                {
                    await _factory.InitFieldAsync(model.PrimaryImage).ConfigureAwait(false);
                }

                // Initialize og image
                if (model.OgImage == null)
                {
                    model.OgImage = new Extend.Fields.ImageField();
                }

                if (model.OgImage.Id.HasValue)
                {
                    await _factory.InitFieldAsync(model.OgImage).ConfigureAwait(false);
                }

                App.Hooks.OnLoad(model);

                // Never cache drafts, dynamic or simple instances
                if (!isDraft && _cache != null && !(model is DynamicPage))
                {
                    if (model is PageInfo)
                    {
                        _cache.Set($"PageInfo_{model.Id.ToString()}", model);
                    }
                    else
                    {
                        _cache.Set(model.Id.ToString(), model);
                    }
                    _cache.Set($"PageId_{model.SiteId}_{model.Slug}", model.Id);
                    if (!model.ParentId.HasValue && model.SortOrder == 0)
                    {
                        if (model is PageInfo)
                        {
                            _cache.Set($"PageInfo_{model.SiteId}", model);
                        }
                        else
                        {
                            _cache.Set($"Page_{model.SiteId}", model);
                        }
                    }
                }
            }
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            DataTable      dt       = new DataTable();
            TMisContractVo objItems = new TMisContractVo();

            if (!String.IsNullOrEmpty(task_id))
            {
                objItems.ID = task_id;
            }
            dt = new TMisContractLogic().GetExportInforData(objItems);
            FileStream   file         = new FileStream(HttpContext.Current.Server.MapPath("../TempFile/ContractInforSheet.xls"), FileMode.Open, FileAccess.Read);
            HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
            ISheet       sheet        = hssfworkbook.GetSheet("Sheet1");

            //插入委托书单号
            sheet.GetRow(2).GetCell(6).SetCellValue("No:" + dt.Rows[0]["CONTRACT_CODE"].ToString());

            sheet.GetRow(4).GetCell(2).SetCellValue(dt.Rows[0]["COMPANY_NAME"].ToString());
            sheet.GetRow(4).GetCell(5).SetCellValue(dt.Rows[0]["CONTACT_NAME"].ToString());
            sheet.GetRow(4).GetCell(8).SetCellValue(dt.Rows[0]["PHONE"].ToString());
            sheet.GetRow(5).GetCell(2).SetCellValue(dt.Rows[0]["CONTACT_ADDRESS"].ToString());
            sheet.GetRow(5).GetCell(5).SetCellValue(dt.Rows[0]["POST"].ToString());
            DataTable dtDict = PageBase.getDictList("RPT_WAY");
            DataTable dtSampleSource = PageBase.getDictList("SAMPLE_SOURCE");
            string    strWay = "", strSampleWay = "";;

            if (dtDict != null)
            {
                foreach (DataRow dr in dtDict.Rows)
                {
                    strWay += dr["DICT_TEXT"].ToString();
                    if (dr["DICT_CODE"].ToString() == dt.Rows[0]["RPT_WAY"].ToString())
                    {
                        strWay += "■ ";
                    }
                    else
                    {
                        strWay += "□ ";
                    }
                }
            }
            if (dtSampleSource != null)
            {
                foreach (DataRow dr in dtSampleSource.Rows)
                {
                    strSampleWay += dr["DICT_TEXT"].ToString();
                    if (dr["DICT_TEXT"].ToString() == dt.Rows[0]["SAMPLE_SOURCE"].ToString())
                    {
                        strSampleWay += "■ ";
                    }
                    else
                    {
                        strSampleWay += "□ ";
                    }
                }
            }
            sheet.GetRow(5).GetCell(8).SetCellValue(strWay);
            sheet.GetRow(7).GetCell(2).SetCellValue(strSampleWay);
            sheet.GetRow(8).GetCell(2).SetCellValue(dt.Rows[0]["TEST_PURPOSE"].ToString());
            sheet.GetRow(9).GetCell(2).SetCellValue(dt.Rows[0]["PROVIDE_DATA"].ToString());
            sheet.GetRow(11).GetCell(2).SetCellValue(dt.Rows[0]["OTHER_ASKING"].ToString());
            sheet.GetRow(16).GetCell(1).SetCellValue(dt.Rows[0]["MONITOR_ACCORDING"].ToString());
            sheet.GetRow(20).GetCell(1).SetCellValue(dt.Rows[0]["REMARK2"].ToString());
            using (MemoryStream stream = new MemoryStream())
            {
                hssfworkbook.Write(stream);
                HttpContext curContext = HttpContext.Current;
                // 设置编码和附件格式
                curContext.Response.ContentType     = "application/vnd.ms-excel";
                curContext.Response.ContentEncoding = Encoding.UTF8;
                curContext.Response.Charset         = "";
                curContext.Response.AppendHeader("Content-Disposition",
                                                 "attachment;filename=" + HttpUtility.UrlEncode("委托监测协议书-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8));
                curContext.Response.BinaryWrite(stream.GetBuffer());
                curContext.Response.End();
            }
        }
Exemplo n.º 29
0
 /// <summary>
 /// Checks if the given page is published
 /// </summary>
 /// <param name="model">The page model</param>
 /// <returns>If the page is published</returns>
 private bool IsPublished(PageBase model)
 {
     return(model != null && model.Published.HasValue && model.Published.Value <= DateTime.Now);
 }
        protected void btnExport_QY_Click(object sender, EventArgs e)
        {
            DataTable      dt             = new DataTable();
            TMisContractVo objItems       = new TMisContractVo();
            string         strWorkContent = "";

            if (!String.IsNullOrEmpty(task_id))
            {
                objItems.ID = task_id;
            }
            dt = new TMisContractLogic().GetExportInforData(objItems);
            FileStream   file         = new FileStream(HttpContext.Current.Server.MapPath("../TempFile/QY/ContractInforSheet.xls"), FileMode.Open, FileAccess.Read);
            HSSFWorkbook hssfworkbook = new HSSFWorkbook(file);
            ISheet       sheet        = hssfworkbook.GetSheet("Sheet1");

            //插入委托书单号
            sheet.GetRow(2).GetCell(6).SetCellValue("No:" + dt.Rows[0]["CONTRACT_CODE"].ToString());

            sheet.GetRow(4).GetCell(2).SetCellValue(dt.Rows[0]["COMPANY_NAME"].ToString());           //委托单位
            sheet.GetRow(4).GetCell(5).SetCellValue(dt.Rows[0]["CONTACT_NAME"].ToString());           //联系人
            sheet.GetRow(4).GetCell(8).SetCellValue(dt.Rows[0]["PHONE"].ToString());                  //联系电话
            sheet.GetRow(5).GetCell(2).SetCellValue(dt.Rows[0]["CONTACT_ADDRESS"].ToString());        //地址
            sheet.GetRow(5).GetCell(5).SetCellValue(dt.Rows[0]["POST"].ToString());                   //邮编

            sheet.GetRow(9).GetCell(2).SetCellValue(dt.Rows[0]["TESTED_COMPANY_NAME"].ToString());    //受检单位
            sheet.GetRow(9).GetCell(4).SetCellValue(dt.Rows[0]["TESTED_PHONE"].ToString());           //联系电话
            sheet.GetRow(9).GetCell(8).SetCellValue(dt.Rows[0]["TESTED_CONTACT_ADDRESS"].ToString()); //地址
            sheet.GetRow(9).GetCell(6).SetCellValue(dt.Rows[0]["TESTED_POST"].ToString());            //邮编

            DataTable dtDict = PageBase.getDictList("RPT_WAY");
            DataTable dtSampleSource = PageBase.getDictList("SAMPLE_SOURCE");
            string    strWay = "", strSampleWay = "";;

            if (dtDict != null)
            {
                foreach (DataRow dr in dtDict.Rows)
                {
                    strWay += dr["DICT_TEXT"].ToString();
                    if (dr["DICT_CODE"].ToString() == dt.Rows[0]["RPT_WAY"].ToString())
                    {
                        strWay += "■ ";
                    }
                    else
                    {
                        strWay += "□ ";
                    }
                }
            }
            if (dtSampleSource != null)
            {
                foreach (DataRow dr in dtSampleSource.Rows)
                {
                    strSampleWay += dr["DICT_TEXT"].ToString();
                    if (dr["DICT_TEXT"].ToString() == dt.Rows[0]["SAMPLE_SOURCE"].ToString())
                    {
                        strSampleWay += "■ ";
                    }
                    else
                    {
                        strSampleWay += "□ ";
                    }
                }
            }
            sheet.GetRow(5).GetCell(8).SetCellValue(strWay);                                      //领取方式
            sheet.GetRow(6).GetCell(2).SetCellValue(strSampleWay);                                //监测类型
            sheet.GetRow(7).GetCell(2).SetCellValue(dt.Rows[0]["TEST_PURPOSE"].ToString());       //监测目的
            sheet.GetRow(8).GetCell(2).SetCellValue(dt.Rows[0]["PROVIDE_DATA"].ToString());       //提供资料
            sheet.GetRow(10).GetCell(2).SetCellValue(dt.Rows[0]["OTHER_ASKING"].ToString());      //其他要求
            sheet.GetRow(15).GetCell(1).SetCellValue(dt.Rows[0]["MONITOR_ACCORDING"].ToString()); //监测依据
            sheet.GetRow(20).GetCell(1).SetCellValue(dt.Rows[0]["REMARK2"].ToString());           //备注

            string strExplain = @"1.是否有分包:□是[□电话确认;□其它:         ] □否 
  是否使用非标准方法:  □是  □否
2.监测收费参照广东省物价局粤价函[1996]64号文规定执行。委托单位到本站办公室(603室)领取《清远市非税收入缴款通知书》限期到通知书列明的银行所属任何一个网点缴监测费{0}元({1}),到颁行缴款后应将盖有银行收讫章的广东省非税收入(电子)票据执收单位联送回给本站综合室。
3.本站在确认已缴监测费用和委托方提供了必要的监测条件后60个工作日内完成监测。";
            string strBUDGET  = dt.Rows[0]["INCOME"].ToString() == "" ? "0" : dt.Rows[0]["INCOME"].ToString();

            strExplain = string.Format(strExplain, strBUDGET, DaXie(strBUDGET));
            sheet.GetRow(18).GetCell(1).SetCellValue(strExplain);

            //监测内容
            string[] strMonitroTypeArr = dt.Rows[0]["TEST_TYPES"].ToString().Split(';');
            if (dt.Rows[0]["SAMPLE_SOURCE"].ToString() == "送样")
            {
                //strWorkContent += "地表水、地下水(送样)\n";
                int intLen     = strMonitroTypeArr.Length;
                int INTSHOWLEN = 0;
                foreach (string strMonitor in strMonitroTypeArr)
                {
                    INTSHOWLEN++;
                    strWorkContent += GetMonitorName(strMonitor) + "、";
                    if (INTSHOWLEN == intLen - 1)
                    {
                        strWorkContent += "(送样)\n";
                    }
                }
            }
            //获取当前监测点信息
            TMisContractPointVo ContractPointVo = new TMisContractPointVo();

            ContractPointVo.CONTRACT_ID = task_id;
            ContractPointVo.IS_DEL      = "0";
            DataTable dtPoint = new TMisContractPointLogic().SelectByTable(ContractPointVo);
            string    strOutValuePoint = "", strOutValuePointItems = "";

            if (strMonitroTypeArr.Length > 0)
            {
                foreach (string strMonitor in strMonitroTypeArr)
                {
                    string    strMonitorName = "", strPointName = "";
                    DataRow[] drPoint = dtPoint.Select("MONITOR_ID='" + strMonitor + "'");
                    if (drPoint.Length > 0)
                    {
                        foreach (DataRow drrPoint in drPoint)
                        {
                            string strPointNameForItems = "", strPointItems = "";
                            strMonitorName = GetMonitorName(strMonitor) + ":";
                            strPointName  += drrPoint["POINT_NAME"].ToString() + "、";

                            //获取当前点位的监测项目
                            TMisContractPointitemVo ContractPointitemVo = new TMisContractPointitemVo();
                            ContractPointitemVo.CONTRACT_POINT_ID = drrPoint["ID"].ToString();
                            DataTable dtPointItems = new TMisContractPointitemLogic().GetItemsForPoint(ContractPointitemVo);
                            if (dtPointItems.Rows.Count > 0)
                            {
                                foreach (DataRow drItems in dtPointItems.Rows)
                                {
                                    strPointNameForItems = strMonitorName.Substring(0, strMonitorName.Length - 1) + drrPoint["POINT_NAME"] + "(" + (drrPoint["SAMPLE_DAY"].ToString() == "" ? "1" : drrPoint["SAMPLE_DAY"].ToString()) + "天" + (drrPoint["SAMPLE_FREQ"].ToString() == "" ? "1" : drrPoint["SAMPLE_FREQ"].ToString()) + "次):";
                                    strPointItems       += drItems["ITEM_NAME"].ToString() + "、";
                                }
                                strOutValuePointItems += strPointNameForItems + strPointItems.Substring(0, strPointItems.Length - 1) + ";\n";
                            }
                        }
                        //获取输出监测类型监测点位信息
                        strOutValuePoint += strMonitorName + strPointName.Substring(0, strPointName.Length - 1) + ";\n";
                    }
                }
            }
            strWorkContent += "监测点位:\n" + strOutValuePoint;
            strWorkContent += "监测因子与频次:\n" + strOutValuePointItems;
            sheet.GetRow(12).GetCell(1).SetCellValue(strWorkContent);

            using (MemoryStream stream = new MemoryStream())
            {
                hssfworkbook.Write(stream);
                HttpContext curContext = HttpContext.Current;
                // 设置编码和附件格式
                curContext.Response.ContentType     = "application/vnd.ms-excel";
                curContext.Response.ContentEncoding = Encoding.UTF8;
                curContext.Response.Charset         = "";
                curContext.Response.AppendHeader("Content-Disposition",
                                                 "attachment;filename=" + HttpUtility.UrlEncode("委托监测协议书-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls", Encoding.UTF8));
                curContext.Response.BinaryWrite(stream.GetBuffer());
                curContext.Response.End();
            }
        }
Exemplo n.º 31
0
 public static User GetLoginUser(this PageBase page)
 {
     return(GetLoginUser());
 }
Exemplo n.º 32
0
 public void SetDropDownListItem(DropDownList p_DropDownList1, string p_ItemValue)
 {
     PageBase.SetDropDownListItem(p_DropDownList1, p_ItemValue);
 }
Exemplo n.º 33
0
    public void SetUpPageContent(ref HtmlGenericControl PageContentControl, ref HtmlGenericControl PageHeadingControl, ref string metaDescription, ref string metaKeywords, ref HtmlGenericControl objSiteMapControl)
    {
        string pageName = "";

        pageName = GetPageAliasFromURL();


        tblPage objPage = new tblPage();

        DataTable dtPageDetail = objPage.GetPageDetailByAlias();

        DataRow[] arDataRow = dtPageDetail.Select("appAlias='" + pageName + "'");
        if (!(arDataRow.Length > 0))
        {
            arDataRow = dtPageDetail.Select("appAlias='" + pageName.Split('/')[0] + "/{*name}" + "'");
        }

        //objPage.Where.AppPageName.Value = pageName
        //'objPage.Where.AppAlias.Value = pageName
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageId)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageTitle)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageContent)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageHeading)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppSEOWord)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppSEODescription)
        //'objPage.Query.Load()


        if (arDataRow.Length > 0)
        {
            Page.Title = arDataRow[0][tblPage.ColumnNames.AppPageTitle].ToString();

            ViewState["CurrentPageTitle"] = arDataRow[0][tblPage.ColumnNames.AppPageTitle];


            if ((PageContentControl != null))
            {
                PageContentControl.InnerHtml = arDataRow[0][tblPage.ColumnNames.AppPageContent].ToString().Replace("<pre ", "<p ").Replace("</pre>", "</p>");
                PageContentControl.InnerHtml = PageContentControl.InnerHtml.Replace("~GetServerURL()~", PageBase.GetServerURL() + "/");
            }

            if ((PageHeadingControl != null))
            {
                PageHeadingControl.InnerText = arDataRow[0][tblPage.ColumnNames.AppPageHeading].ToString();
            }

            metaDescription = arDataRow[0][tblPage.ColumnNames.AppSEODescription].ToString();
            metaKeywords    = arDataRow[0][tblPage.ColumnNames.AppSEOWord].ToString();

            ViewState["CurrentPageMetaDesc"]     = arDataRow[0][tblPage.ColumnNames.AppSEODescription];
            ViewState["CurrentPageMetaKeyWords"] = arDataRow[0][tblPage.ColumnNames.AppSEOWord];

            if ((objSiteMapControl != null))
            {
                tblMenuItem objMenuItem = new tblMenuItem();
                DataTable   dtSiteMap   = objMenuItem.GetSiteMapDT((int)arDataRow[0][tblMenuItem.ColumnNames.AppMenuItemId]);
                objSiteMapControl.InnerHtml = "<div class=\"itemnode\"><a href='" + strServerURL + "'>Home</a></div>";
                for (int i = 0; i <= dtSiteMap.Rows.Count - 2; i++)
                {
                    objSiteMapControl.InnerHtml += "<div class=\"itemseparator\"> </div>";
                    if (!string.IsNullOrEmpty(dtSiteMap.Rows[i]["appAlias"].ToString()))
                    {
                        objSiteMapControl.InnerHtml += "<div class='itemnode'><a href='" + strServerURL + dtSiteMap.Rows[i]["appAlias"] + "'>" + dtSiteMap.Rows[i]["appMenuItem"] + "</a></div>";
                    }
                    else
                    {
                        objSiteMapControl.InnerHtml += "<div class='itemnode'>" + dtSiteMap.Rows[i]["appMenuItem"] + "</div>";
                    }
                }

                objSiteMapControl.InnerHtml += "<div class=\"itemseparator\"> </div>";
                objSiteMapControl.InnerHtml += "<div class='currentitem itemnode'>" + dtSiteMap.Rows[dtSiteMap.Rows.Count - 1]["appMenuItem"] + "</div>";
            }
        }
    }
Exemplo n.º 34
0
        private void user_login(HttpContext context, ref string strResult)
        {
            cz_login_log login_log;
            ReturnResult result = new ReturnResult();
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("type", "user_login");
            string userName = LSRequest.qq("loginName").Trim().ToLower();
            string str      = LSRequest.qq("loginPwd").Trim();
            string str2     = LSRequest.qq("ValidateCode").Trim();

            if (PageBase.is_ip_locked())
            {
                context.Session["lottery_session_img_code"] = null;
                result.set_success(400);
                result.set_tipinfo("由於輸入錯誤次數過多,您已被禁用,請稍後再試!");
                strResult = JsonHandle.ObjectToJson(result);
            }
            else if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(str))
            {
                context.Response.End();
            }
            else
            {
                DateTime time;
                if (int.Parse(FileCacheHelper.get_GetLockedPasswordCount()) == 0)
                {
                    context.Session["lottery_session_img_code_display"] = 1;
                }
                if (context.Session["lottery_session_img_code_display"] == null)
                {
                    if (CallBLL.cz_user_psw_err_log_bll.IsExistUser(userName))
                    {
                        if (PageBase.IsErrTimesAbove(ref time, userName))
                        {
                            if (!PageBase.IsErrTimeout(time))
                            {
                                context.Session["lottery_session_img_code"] = null;
                                result.set_success(400);
                                result.set_tipinfo("");
                                dictionary.Add("is_display_code", "1");
                                result.set_data(dictionary);
                                strResult = JsonHandle.ObjectToJson(result);
                                context.Session["lottery_session_img_code_display"] = 1;
                                return;
                            }
                            CallBLL.cz_user_psw_err_log_bll.ZeroErrTimes(userName);
                            context.Session["lottery_session_img_code"]         = null;
                            context.Session["lottery_session_img_code_display"] = 0;
                        }
                        else
                        {
                            context.Session["lottery_session_img_code"]         = null;
                            context.Session["lottery_session_img_code_display"] = 0;
                        }
                    }
                    else
                    {
                        context.Session["lottery_session_img_code"]         = null;
                        context.Session["lottery_session_img_code_display"] = 0;
                    }
                }
                if (context.Session["lottery_session_img_code_display"].ToString() == "0")
                {
                    if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(str))
                    {
                        context.Response.End();
                        return;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(str))
                    {
                        context.Response.End();
                        return;
                    }
                    if (string.IsNullOrEmpty(str2))
                    {
                        context.Session["lottery_session_img_code"] = null;
                        result.set_success(400);
                        result.set_tipinfo("");
                        dictionary.Add("is_display_code", "1");
                        result.set_data(dictionary);
                        strResult = JsonHandle.ObjectToJson(result);
                        context.Session["lottery_session_img_code_display"] = 1;
                        return;
                    }
                    if (context.Session["lottery_session_img_code"] == null)
                    {
                        context.Response.End();
                        return;
                    }
                    if (context.Session["lottery_session_img_code"].ToString().ToLower() != str2.ToLower())
                    {
                        context.Session["lottery_session_img_code"] = null;
                        result.set_success(400);
                        result.set_tipinfo(PageBase.GetMessageByCache("u100004", "MessageHint"));
                        dictionary.Add("fs_name", "ValidateCode");
                        strResult = JsonHandle.ObjectToJson(result);
                        return;
                    }
                }
                cz_users _users = CallBLL.cz_users_bll.UserLogin(userName.ToLower());
                if (_users == null)
                {
                    context.Session["lottery_session_img_code"] = null;
                    PageBase.login_error_ip();
                    result.set_success(400);
                    result.set_tipinfo(PageBase.GetMessageByCache("u100005", "MessageHint"));
                    dictionary.Add("fs_name", "loginName");
                    strResult = JsonHandle.ObjectToJson(result);
                }
                else
                {
                    string str4 = _users.get_retry_times().ToString();
                    if (!string.IsNullOrEmpty(str4) && (int.Parse(str4) > int.Parse(FileCacheHelper.get_GetLockedUserCount())))
                    {
                        if (!PageBase.IsLockedTimeout(userName, "master"))
                        {
                            context.Session["lottery_session_img_code"] = null;
                            result.set_success(560);
                            result.set_tipinfo("您的帳號因密碼多次輸入錯誤被鎖死,請與管理員聯系!");
                            strResult = JsonHandle.ObjectToJson(result);
                            return;
                        }
                        PageBase.zero_retry_times(userName);
                    }
                    string str5 = _users.get_a_state().ToString();
                    string str6 = PageBase.upper_user_status(_users.get_u_name().ToLower());
                    if (str5 == "2")
                    {
                        context.Session["lottery_session_img_code"] = null;
                        result.set_success(400);
                        result.set_tipinfo(PageBase.GetMessageByCache("u100008", "MessageHint"));
                        strResult = JsonHandle.ObjectToJson(result);
                        context.Session.Abandon();
                    }
                    else if (str6 == "2")
                    {
                        context.Session["lottery_session_img_code"] = null;
                        result.set_success(400);
                        result.set_tipinfo("您的上級帳號已被停用,请与管理员联系!");
                        strResult = JsonHandle.ObjectToJson(result);
                        context.Session.Abandon();
                    }
                    else
                    {
                        if (str5 == "1")
                        {
                            result.set_success(200);
                            result.set_tipinfo(PageBase.GetMessageByCache("u100007", "MessageHint"));
                            strResult = JsonHandle.ObjectToJson(result);
                            context.Session["user_state"] = str5;
                        }
                        else if (str6 == "1")
                        {
                            result.set_success(200);
                            result.set_tipinfo(PageBase.GetMessageByCache("u100010", "MessageHint"));
                            strResult = JsonHandle.ObjectToJson(result);
                            context.Session["user_state"] = str6;
                        }
                        else
                        {
                            context.Session["user_state"] = "0";
                            result.set_success(200);
                            strResult = JsonHandle.ObjectToJson(result);
                        }
                        string str7 = _users.get_salt().Trim();
                        string str8 = DESEncrypt.EncryptString(str, str7);
                        if (_users.get_u_psw() != str8)
                        {
                            context.Session["lottery_session_img_code"] = null;
                            PageBase.inc_retry_times(userName);
                            PageBase.login_error_ip();
                            result.set_success(400);
                            result.set_tipinfo(PageBase.GetMessageByCache("u100006", "MessageHint"));
                            strResult = JsonHandle.ObjectToJson(result);
                            if (context.Session["lottery_session_img_code_display"].ToString() == "0")
                            {
                                if (CallBLL.cz_user_psw_err_log_bll.IsExistUser(userName))
                                {
                                    CallBLL.cz_user_psw_err_log_bll.UpdateErrTimes(userName);
                                }
                                else
                                {
                                    CallBLL.cz_user_psw_err_log_bll.AddUser(userName);
                                }
                                if (PageBase.IsErrTimesAbove(ref time, userName))
                                {
                                    context.Session["lottery_session_img_code"] = null;
                                    result.set_success(400);
                                    result.set_tipinfo(PageBase.GetMessageByCache("u100006", "MessageHint"));
                                    dictionary.Add("is_display_code", "1");
                                    result.set_data(dictionary);
                                    strResult = JsonHandle.ObjectToJson(result);
                                    context.Session["lottery_session_img_code_display"] = 1;
                                }
                            }
                        }
                        else
                        {
                            cz_userinfo_session _session = new cz_userinfo_session();
                            _session.set_u_id(_users.get_u_id());
                            _session.set_u_name(_users.get_u_name());
                            _session.set_u_nicker(_users.get_u_nicker());
                            _session.set_u_skin(_users.get_u_skin());
                            _session.set_u_type(_users.get_u_type());
                            _session.set_su_type(_users.get_su_type());
                            _session.set_kc_kind(_users.get_kc_kind().Trim());
                            _session.set_six_kind(_users.get_six_kind().Trim());
                            _session.set_u_psw(_users.get_u_psw().Trim());
                            _session.set_kc_rate_owner(_users.get_kc_rate_owner());
                            _session.set_six_rate_owner(_users.get_six_rate_owner());
                            _session.set_a_state(new int?(int.Parse(context.Session["user_state"].ToString())));
                            DataTable zJInfo = CallBLL.cz_users_bll.GetZJInfo();
                            if (zJInfo != null)
                            {
                                _session.set_zjname(zJInfo.Rows[0]["u_name"].ToString().Trim());
                            }
                            DataRow item = CallBLL.cz_admin_sysconfig_bll.GetItem();
                            if (item == null)
                            {
                                _session.set_u_skin("Blue");
                            }
                            else
                            {
                                string str9 = item["hy_skin"].ToString();
                                if (string.IsNullOrEmpty(_session.get_u_skin()) || (str9.IndexOf(_session.get_u_skin()) < 0))
                                {
                                    _session.set_u_skin(str9.Split(new char[] { '|' })[0]);
                                }
                            }
                            DataTable table2 = CallBLL.cz_rate_six_bll.GetRateByAccount(userName.ToLower()).Tables[0];
                            _session.get_six_session().set_fgsname(table2.Rows[0]["fgs_name"].ToString().Trim());
                            _session.get_six_session().set_gdname(table2.Rows[0]["gd_name"].ToString().Trim());
                            _session.get_six_session().set_zdname(table2.Rows[0]["zd_name"].ToString().Trim());
                            _session.get_six_session().set_dlname(table2.Rows[0]["dl_name"].ToString().Trim());
                            DataTable table3 = CallBLL.cz_rate_kc_bll.GetRateByAccount(userName.ToLower()).Tables[0];
                            _session.get_kc_session().set_fgsname(table3.Rows[0]["fgs_name"].ToString().Trim());
                            _session.get_kc_session().set_gdname(table3.Rows[0]["gd_name"].ToString().Trim());
                            _session.get_kc_session().set_zdname(table3.Rows[0]["zd_name"].ToString().Trim());
                            _session.get_kc_session().set_dlname(table3.Rows[0]["dl_name"].ToString().Trim());
                            _session.set_kc_rate_owner(new int?(Convert.ToInt32(table3.Rows[0]["kc_rate_owner"])));
                            _session.set_six_rate_owner(new int?(Convert.ToInt32(table2.Rows[0]["six_rate_owner"])));
                            DataTable userOpOdds = CallBLL.cz_rate_kc_bll.GetUserOpOdds(userName.ToLower());
                            if (userOpOdds != null)
                            {
                                if ((userOpOdds.Rows[0]["six_op_odds"] != null) && (userOpOdds.Rows[0]["six_op_odds"].ToString() != ""))
                                {
                                    _session.set_six_op_odds(new int?(int.Parse(userOpOdds.Rows[0]["six_op_odds"].ToString())));
                                }
                                if ((userOpOdds.Rows[0]["kc_op_odds"] != null) && (userOpOdds.Rows[0]["kc_op_odds"].ToString() != ""))
                                {
                                    _session.set_kc_op_odds(new int?(int.Parse(userOpOdds.Rows[0]["kc_op_odds"].ToString())));
                                }
                            }
                            context.Session["user_name"] = userName.ToLower();
                            context.Session[userName + "lottery_session_user_info"] = _session;
                            PageBase.SetAppcationFlag(userName);
                            if (FileCacheHelper.get_RedisStatOnline().Equals(1))
                            {
                                new PageBase_Redis().InitUserOnlineTopToRedis(userName, _session.get_u_type());
                            }
                            else if (FileCacheHelper.get_RedisStatOnline().Equals(2))
                            {
                                new PageBase_Redis().InitUserOnlineTopToRedisStack(userName, _session.get_u_type());
                            }
                            else
                            {
                                MemberPageBase.stat_top_online(userName);
                                MemberPageBase.stat_online(userName, _session.get_u_type());
                            }
                            if (FileCacheHelper.get_RedisStatOnline().Equals(0))
                            {
                                PageBase.ZeroIsOutFlag(userName);
                            }
                            login_log = new cz_login_log();
                            login_log.set_ip(LSRequest.GetIP());
                            login_log.set_login_time(new DateTime?(DateTime.Now));
                            login_log.set_u_name(userName);
                            login_log.set_browser_type(Utils.GetBrowserInfo(HttpContext.Current));
                            Task.Factory.StartNew(delegate {
                                PageBase.zero_retry_times(userName);
                                CallBLL.cz_user_psw_err_log_bll.ZeroErrTimes(userName);
                                CallBLL.cz_login_log_bll.Add(login_log);
                            }).ContinueWith(delegate(Task t) {
                                string str = string.Format("Task Exception: {0}", t.Exception.InnerException.Message);
                                MessageQueueConfig.TaskQueue.Enqueue(new TaskModel(0, str));
                            }, TaskContinuationOptions.OnlyOnFaulted);
                            if (FileCacheHelper.get_GetWebModelView().Equals(0))
                            {
                                HttpContext.Current.Session["Session_LoginSystem_Flag"] = "LoginSystem_OldWeb";
                                _session.set_u_skin("Yellow");
                            }
                            else
                            {
                                HttpContext.Current.Session["Session_LoginSystem_Flag"] = "LoginSystem_NewWeb";
                            }
                            string str10 = _users.get_is_changed().ToString();
                            if (string.IsNullOrEmpty(str10))
                            {
                                result.set_success(550);
                                result.set_tipinfo("新密碼首次登錄,需重置密碼!");
                                strResult = JsonHandle.ObjectToJson(result);
                                context.Session["modifypassword"] = "******";
                            }
                            else if (str10 == "0")
                            {
                                result.set_success(550);
                                result.set_tipinfo("新密碼首次登錄,需重置密碼!");
                                strResult = JsonHandle.ObjectToJson(result);
                                context.Session["modifypassword"] = "******";
                            }
                            else
                            {
                                DateTime?nullable3;
                                DateTime?nullable = _users.get_last_changedate();
                                int      num2     = PageBase.PasswordExpire();
                                if (nullable.HasValue && ((nullable3 = nullable).HasValue ? (nullable3.GetValueOrDefault() < DateTime.Now.AddDays((double)-num2)) : false))
                                {
                                    result.set_success(550);
                                    result.set_tipinfo("密碼過期,需重置密碼!");
                                    strResult = JsonHandle.ObjectToJson(result);
                                    context.Session["modifypassword"] = "******";
                                }
                                else
                                {
                                    CallBLL.cz_credit_lock_bll.Delete(_users.get_u_name());
                                    result.set_data(dictionary);
                                    strResult = JsonHandle.ObjectToJson(result);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 35
0
        public async Task <PageBase <EntityDangerousProduct> > GetPageDangerousInfo(EntityDangerousPageQuery dangerousPageQuery)
        {
            var result = new PageBase <EntityDangerousProduct>
            {
                CurrentPage = dangerousPageQuery.CurrentPage,
                PageSize    = dangerousPageQuery.PageSize
            };

            var strSql = new StringBuilder();

            //计算总数
            strSql.Append(@"        
                            SELECT  @totalCount = COUNT(1)
                            FROM    dbo.T_DangerousProduct WITH ( NOLOCK ) ");

            strSql.Append(" where CompanyId =@companyId ");
            if (!string.IsNullOrEmpty(dangerousPageQuery.ProductName))
            {
                strSql.Append(" and  ProductName like '%' + @productName +'%' ;");
            }
            //分页信息
            strSql.Append(@";SELECT * FROM (SELECT  ROW_NUMBER() OVER ( ORDER BY CreateTime DESC ) RowNumber ,
                            Id ,
                            CompanyId ,
                            ProductName ,
                            AliasName ,
                            ProductAttributes ,
                            Manufacturability ,
                            ProductReserve ,
                            YearProduct ,
                            Cas ,
                            Un ,
                            IsToxicity ,
                            Instructions ,
                            Memo ,
                            CreateTime ,
                            Status ,
                            ExpertOpinion ,
                            ManagementPlan ,
                            RegesterId
                    FROM    dbo.T_DangerousProduct WITH ( NOLOCK ) ");

            strSql.Append(" where CompanyId =@companyId ");
            if (!string.IsNullOrEmpty(dangerousPageQuery.ProductName))
            {
                strSql.Append("  and ProductName like '%' + @productName +'%' ");
            }
            strSql.Append(@"
                                   ) AS a
                            WHERE   a.RowNumber > @startIndex
                                    AND a.RowNumber <= @endIndex              
                        ");
            strSql.Append(@" order by a.RowNumber ");

            var paras = new DynamicParameters(new
            {
                companyId   = dangerousPageQuery.CompanyId,
                productName = dangerousPageQuery.ProductName,
                startIndex  = (dangerousPageQuery.CurrentPage - 1) * dangerousPageQuery.PageSize,
                endIndex    = dangerousPageQuery.CurrentPage * dangerousPageQuery.PageSize
            });
            var dangerousProductRep = GetRepositoryInstance <TableDangerousProduct>();

            paras.Add("totalCount", dbType: DbType.Int32, direction: ParameterDirection.Output);
            var sqlQuery = new SqlQuery(strSql.ToString(), paras);

            var listResult = dangerousProductRep.FindAll(sqlQuery).ToList();

            result.Items = Mapper.Map <List <TableDangerousProduct>, List <EntityDangerousProduct> >(listResult);

            result.TotalCounts = paras.Get <int?>("totalCount") ?? 0;
            result.TotalPages  = Convert.ToInt32(Math.Ceiling(result.TotalCounts / (dangerousPageQuery.PageSize * 1.0)));

            return(result);
        }
Exemplo n.º 36
0
        public static void OpenGamesPopup(this PageBase page, List <object> games, GamesClickSource clickSource, string requestName = "", int selectedIndex = 0, FrameworkElement root = null)
        {
            double         num1 = games.Count > 1 ? 32.0 : 0.0;
            bool           isScrollListeningEnabled = true;
            GamesSlideView gamesSlideView1          = new GamesSlideView();

            gamesSlideView1.AllowVerticalSwipe = true;
            gamesSlideView1.NextHeaderMargin   = num1;
            SolidColorBrush solidColorBrush1 = new SolidColorBrush(Colors.Transparent);

            gamesSlideView1.BackgroundColor = (Brush)solidColorBrush1;
            GamesSlideView slideView     = gamesSlideView1;
            DialogService  dialogService = new DialogService();

            dialogService.KeepAppBar       = false;
            dialogService.HideOnNavigation = false;
            dialogService.HasPopup         = true;
            GamesSlideView gamesSlideView2 = slideView;

            dialogService.Child = (FrameworkElement)gamesSlideView2;
            int num2 = 5;

            dialogService.AnimationType = (DialogService.AnimationTypes)num2;
            int num3 = 1;

            dialogService.AnimationTypeChild = (DialogService.AnimationTypes)num3;
            SolidColorBrush solidColorBrush2 = new SolidColorBrush(Colors.Black);
            double          num4             = 0.5;

            solidColorBrush2.Opacity      = num4;
            dialogService.BackgroundBrush = (Brush)solidColorBrush2;
            DialogService flyout = dialogService;

            CurrentNewsFeedSource.Source = ViewPostSource.GameWall;
            flyout.Closing += (EventHandler)((sender, args) =>
            {
                isScrollListeningEnabled = false;
                if (root == null)
                {
                    return;
                }
                root.Opacity = 1.0;
            });
            slideView.CreateSingleElement = (Func <GameView>)(() =>
            {
                GameView gameView = new GameView()
                {
                    Flyout           = flyout,
                    NewsItemsWidth   = 480.0,
                    GamesClickSource = clickSource,
                    GameRequestName  = requestName
                };
                ViewportControl viewportControl = gameView.ViewportCtrl;
                double viewportY = 0.0;
                viewportControl.ViewportChanged          += (EventHandler <ViewportChangedEventArgs>)((sender, args) => viewportY = viewportControl.Viewport.Y);
                viewportControl.ManipulationStateChanged += (EventHandler <ManipulationStateChangedEventArgs>)((sender, args) =>
                {
                    if (viewportControl.ManipulationState == ManipulationState.Manipulating || viewportY > -100.0)
                    {
                        return;
                    }
                    Rect bounds = viewportControl.Bounds;
                    viewportControl.Bounds = new Rect(bounds.X, viewportY, bounds.Width, bounds.Height);
                    flyout.Hide();
                });
                gameView.WallPanel.ScrollPositionChanged += (EventHandler <MyVirtualizingPanel2.ScrollPositionChangedEventAgrs>)((sender, args) =>
                {
                    if (!isScrollListeningEnabled)
                    {
                        return;
                    }
                    if (args.CurrentPosition > 56.0)
                    {
                        slideView.DisableSwipe();
                    }
                    else
                    {
                        slideView.EnableSwipe();
                    }
                    if (root == null)
                    {
                        return;
                    }
                    root.Opacity = args.CurrentPosition > 200.0 ? 0.0 : 1.0;
                });
                PageBaseExtensions._panels.Add(gameView.WallPanel);
                return(gameView);
            });
            slideView.ItemsCleared += (EventHandler)((sender, args) => flyout.Hide());
            slideView.Items         = new ObservableCollection <object>(games);
            slideView.SelectedIndex = selectedIndex;
            flyout.Closed          += (EventHandler)((o, args) =>
            {
                foreach (MyVirtualizingPanel2 panel in PageBaseExtensions._panels)
                {
                    panel.Cleanup();
                }
                PageBaseExtensions._panels.Clear();
                GameView.Cleanup();
                GC.Collect();
            });
            flyout.Show(null);
            page.InitializeAdornerControls();
        }
Exemplo n.º 37
0
 public void Setup()
 {
     page = new PageBase(driver);
 }
Exemplo n.º 38
0
 public string Render(PageBase hostPage)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 39
0
        private string CreateOrder(HttpContext context)
        {
            PageBase pageBase = new PageBase(context);
            if (!pageBase.IsLogin()) return ToJson(false, "login"); ; int printnum = 0;
            string fileKey = Request["fileKey"]; if (string.IsNullOrEmpty(fileKey)) goto CheckFail;
            string printtype = Request["printtype"]; if (string.IsNullOrEmpty(printtype)) goto CheckFail;
            string person = Request["person"]; if (string.IsNullOrEmpty(person)) goto CheckFail;
            string mobile = Request["mobile"]; if (string.IsNullOrEmpty(mobile)) goto CheckFail;
            string address = Request["address"]; if (string.IsNullOrEmpty(address)) goto CheckFail;
            string _printnum = Request["printnum"]; if (string.IsNullOrEmpty(_printnum) || !int.TryParse(_printnum, out printnum)) goto CheckFail;

            Random ran=new Random();
            int RandKey=ran.Next(10000000,90000000);

            UserModel userModel = UserDAL.GetModel(pageBase.CurrentUser.UserID);

            string orderid = RandKey.ToString() + pageBase.ChooseStore.StoreID.ToString();
            int fileCount = OrderDAL.GetFileCount(fileKey);
            OrderModel model = new OrderModel();
            model.OrderNo = orderid;
            model.StoreID = pageBase.ChooseStore.StoreID;
            model.UserID = pageBase.CurrentUser.UserID;
            model.Person = RemoveJ(person);
            model.Mobile = RemoveJ(mobile);
            model.Address = RemoveJ(address);
            model.FileKey = fileKey;
            model.PrintType = printtype;
            model.PrintNum = printnum;
            model.CreateDate = DateTime.Now;
            model.FreeCount = userModel.IsCheck ? GetUseFreeCount(model.UserID, printtype, fileCount * printnum) : 0;
            model.PayCount = fileCount * printnum - model.FreeCount >= 0 ? (fileCount * printnum - model.FreeCount) : 0;
            model.Price = printtype == "normal" ? ConstData.NormalPaper : ConstData.PhotoPaper;
            model.Total_fee = model.Price * model.PayCount;
            model.State = model.PayCount > 0 ? "未付款" : "免费单";

            bool result = OrderDAL.CreateOrder(model);
            if (result) UpdateUseFreeCount(model.UserID, printtype, model.FreeCount);
            return ToJson(result, result ? orderid + (pageBase.CurrentUser.IsCheck ? "" : "|") : "订单创建失败");

            CheckFail:
            return ToJson(false, "信息不完整,订单添加失败");
        }
        /// <summary>
        /// Invokes the middleware.
        /// </summary>
        /// <param name="context">The current http context</param>
        /// <param name="api">The current api</param>
        /// <param name="service">The application service</param>
        /// <returns>An async task</returns>
        public override async Task Invoke(HttpContext context, IApi api, IApplicationService service)
        {
            var appConfig = new Config(api);

            if (!IsHandled(context) && !context.Request.Path.Value.StartsWith("/manager/assets/"))
            {
                var url      = context.Request.Path.HasValue ? context.Request.Path.Value : "";
                var segments = url.Substring(1).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                int pos      = 0;

                //
                // 1: Store raw url
                //
                service.Url = context.Request.Path.Value;

                //
                // 2: Get the current site
                //
                Site site = null;

                var hostname = context.Request.Host.Host;

                if (_config.UseSiteRouting)
                {
                    // Try to get the requested site by hostname & prefix
                    if (segments.Length > 0)
                    {
                        var prefixedHostname = $"{hostname}/{segments[0]}";
                        site = await api.Sites.GetByHostnameAsync(prefixedHostname)
                               .ConfigureAwait(false);

                        if (site != null)
                        {
                            context.Request.Path = "/" + string.Join("/", segments.Skip(1));
                            hostname             = prefixedHostname;
                            pos = 1;
                        }
                    }

                    // Try to get the requested site by hostname
                    if (site == null)
                    {
                        site = await api.Sites.GetByHostnameAsync(context.Request.Host.Host)
                               .ConfigureAwait(false);
                    }
                }

                // If we didn't find the site, get the default site
                if (site == null)
                {
                    site = await api.Sites.GetDefaultAsync()
                           .ConfigureAwait(false);
                }

                if (site != null)
                {
                    // Update application service
                    service.Site.Id      = site.Id;
                    service.Site.Culture = site.Culture;
                    service.Site.Sitemap = await api.Sites.GetSitemapAsync(site.Id);

                    // Set current culture if specified in site
                    if (!string.IsNullOrEmpty(site.Culture))
                    {
                        var cultureInfo = new CultureInfo(service.Site.Culture);
                        CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = cultureInfo;
                    }
                }
                else
                {
                    // There's no sites available, let the application finish
                    await _next.Invoke(context);

                    return;
                }

                // Store hostname
                service.Hostname = hostname;

                //
                // Check if we shouldn't handle empty requests for start page
                //
                if (segments.Length == 0 && !_config.UseStartpageRouting)
                {
                    await _next.Invoke(context);

                    return;
                }

                //
                // 3: Check for alias
                //
                if (_config.UseAliasRouting && segments.Length > pos)
                {
                    var alias = await api.Aliases.GetByAliasUrlAsync($"/{ string.Join("/", segments.Subset(pos)) }", service.Site.Id);

                    if (alias != null)
                    {
                        context.Response.Redirect(alias.RedirectUrl, alias.Type == RedirectType.Permanent);
                        return;
                    }
                }

                //
                // 4: Get the current page
                //
                PageBase page     = null;
                PageType pageType = null;

                if (segments.Length > pos)
                {
                    // Scan for the most unique slug
                    for (var n = segments.Length; n > pos; n--)
                    {
                        var slug = string.Join("/", segments.Subset(pos, n));
                        page = await api.Pages.GetBySlugAsync <PageBase>(slug, site.Id)
                               .ConfigureAwait(false);

                        if (page != null)
                        {
                            pos = pos + n;
                            break;
                        }
                    }
                }
                else
                {
                    page = await api.Pages.GetStartpageAsync <PageBase>(site.Id)
                           .ConfigureAwait(false);
                }

                if (page != null)
                {
                    pageType       = App.PageTypes.GetById(page.TypeId);
                    service.PageId = page.Id;

                    // Only cache published pages
                    if (page.IsPublished)
                    {
                        service.CurrentPage = page;
                    }
                }

                //
                // 5: Get the current post
                //
                PostBase post = null;

                if (_config.UsePostRouting)
                {
                    if (page != null && pageType.IsArchive && segments.Length > pos)
                    {
                        post = await api.Posts.GetBySlugAsync <PostBase>(page.Id, segments[pos])
                               .ConfigureAwait(false);

                        if (post != null)
                        {
                            pos++;
                        }
                    }

                    if (post != null)
                    {
                        App.PostTypes.GetById(post.TypeId);

                        // Onlyc cache published posts
                        if (post.IsPublished)
                        {
                            service.CurrentPost = post;
                        }
                    }
                }

                _logger?.LogDebug($"Found Site: [{ site.Id }]");
                if (page != null)
                {
                    _logger?.LogDebug($"Found Page: [{ page.Id }]");
                }

                if (post != null)
                {
                    _logger?.LogDebug($"Found Post: [{ post.Id }]");
                }

                //
                // 6: Route request
                //
                var route = new StringBuilder();
                var query = new StringBuilder();

                if (post != null)
                {
                    if (string.IsNullOrWhiteSpace(post.RedirectUrl))
                    {
                        // Handle HTTP caching
                        if (HandleCache(context, site, post, appConfig.CacheExpiresPosts))
                        {
                            // Client has latest version
                            return;
                        }

                        route.Append(post.Route ?? "/post");
                        for (var n = pos; n < segments.Length; n++)
                        {
                            route.Append("/");
                            route.Append(segments[n]);
                        }

                        query.Append("id=");
                        query.Append(post.Id);
                    }
                    else
                    {
                        _logger?.LogDebug($"Setting redirect: [{ post.RedirectUrl }]");

                        context.Response.Redirect(post.RedirectUrl, post.RedirectType == RedirectType.Permanent);
                        return;
                    }
                }
                else if (page != null && _config.UsePageRouting)
                {
                    if (string.IsNullOrWhiteSpace(page.RedirectUrl))
                    {
                        route.Append(page.Route ?? (pageType.IsArchive ? "/archive" : "/page"));

                        // Set the basic query
                        query.Append("id=");
                        query.Append(page.Id);

                        if (!page.ParentId.HasValue && page.SortOrder == 0)
                        {
                            query.Append("&startpage=true");
                        }

                        if (!pageType.IsArchive)
                        {
                            if (HandleCache(context, site, page, appConfig.CacheExpiresPages))
                            {
                                // Client has latest version.
                                return;
                            }

                            // This is a regular page, append trailing segments
                            for (var n = pos; n < segments.Length; n++)
                            {
                                route.Append("/");
                                route.Append(segments[n]);
                            }
                        }
                        else if (post == null)
                        {
                            // This is an archive, check for archive params
                            int? year          = null;
                            bool foundCategory = false;
                            bool foundTag      = false;
                            bool foundPage     = false;

                            for (var n = pos; n < segments.Length; n++)
                            {
                                if (segments[n] == "category" && !foundPage)
                                {
                                    foundCategory = true;
                                    continue;
                                }

                                if (segments[n] == "tag" && !foundPage && !foundCategory)
                                {
                                    foundTag = true;
                                    continue;
                                }

                                if (segments[n] == "page")
                                {
                                    foundPage = true;
                                    continue;
                                }

                                if (foundCategory)
                                {
                                    try
                                    {
                                        var categoryId = (await api.Posts.GetCategoryBySlugAsync(page.Id, segments[n]).ConfigureAwait(false))?.Id;

                                        if (categoryId.HasValue)
                                        {
                                            query.Append("&category=");
                                            query.Append(categoryId);
                                        }
                                    }
                                    finally
                                    {
                                        foundCategory = false;
                                    }
                                }

                                if (foundTag)
                                {
                                    try
                                    {
                                        var tagId = (await api.Posts.GetTagBySlugAsync(page.Id, segments[n]).ConfigureAwait(false))?.Id;

                                        if (tagId.HasValue)
                                        {
                                            query.Append("&tag=");
                                            query.Append(tagId);
                                        }
                                    }
                                    finally
                                    {
                                        foundTag = false;
                                    }
                                }

                                if (foundPage)
                                {
                                    try
                                    {
                                        var pageNum = Convert.ToInt32(segments[n]);
                                        query.Append("&page=");
                                        query.Append(pageNum);
                                        query.Append("&pagenum=");
                                        query.Append(pageNum);
                                    }
                                    catch
                                    {
                                        // We don't care about the exception, we just
                                        // discard malformed input
                                    }
                                    // Page number should always be last, break the loop
                                    break;
                                }

                                if (!year.HasValue)
                                {
                                    try
                                    {
                                        year = Convert.ToInt32(segments[n]);

                                        if (year.Value > DateTime.Now.Year)
                                        {
                                            year = DateTime.Now.Year;
                                        }
                                        query.Append("&year=");
                                        query.Append(year);
                                    }
                                    catch
                                    {
                                        // We don't care about the exception, we just
                                        // discard malformed input
                                    }
                                }
                                else
                                {
                                    try
                                    {
                                        var month = Math.Max(Math.Min(Convert.ToInt32(segments[n]), 12), 1);
                                        query.Append("&month=");
                                        query.Append(month);
                                    }
                                    catch
                                    {
                                        // We don't care about the exception, we just
                                        // discard malformed input
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        _logger?.LogDebug($"Setting redirect: [{ page.RedirectUrl }]");

                        context.Response.Redirect(page.RedirectUrl, page.RedirectType == RedirectType.Permanent);
                        return;
                    }
                }

                if (route.Length > 0)
                {
                    var strRoute = route.ToString();
                    var strQuery = query.ToString();

                    _logger?.LogDebug($"Setting Route: [{ strRoute }]");
                    _logger?.LogDebug($"Setting Query: [{ strQuery }]");

                    context.Request.Path = new PathString(strRoute);
                    if (context.Request.QueryString.HasValue)
                    {
                        context.Request.QueryString =
                            new QueryString(context.Request.QueryString.Value + "&" + strQuery);
                    }
                    else
                    {
                        context.Request.QueryString =
                            new QueryString("?" + strQuery);
                    }
                }
            }
            await _next.Invoke(context);
        }
Exemplo n.º 41
0
    private void SetUpButtons()
    {
        if (Post == null)
        {
            return;
        }
        string modtext = "";

        TopicApprove.Visible = false;
        //TopicHold.Visible = false;
        hReplyQuote.Visible = false;
        hEdit.Visible       = false;
        ViewIP.Visible      = false;
        TopicDelete.Visible = false;
        SplitTopic.Visible  = false;

        PageBase page         = (PageBase)Page;
        bool     _isadmin     = page.IsAdministrator;
        bool     newerreplies = false;

        _topicid = page.TopicId != null ? page.TopicId.Value : Convert.ToInt32(Session["TOPIC"]);

        _topic         = Topics.GetTopic(_topicid);
        _isTopicLocked = _topic.Status == (int)Enumerators.PostStatus.Closed;
        _forum         = Forums.GetForum(_topic.ForumId);
        _topicid       = _topic.Id;
        bool _isForumModerator = Moderators.IsUserForumModerator(HttpContext.Current.User.Identity.Name, _forum.Id);

        if (_post is TopicInfo)
        {
            if (Cache["M" + _topic.AuthorId] == null)
            {
                _author = Members.GetAuthor(_topic.AuthorId);
                Cache.Insert("M" + _topic.AuthorId, _author, null, DateTime.Now.AddMinutes(10d),
                             System.Web.Caching.Cache.NoSlidingExpiration);
            }
            else
            {
                _author = (AuthorInfo)Cache["M" + _topic.AuthorId];
            }
            ThisId = _topic.Id;
            if (_topic.ReplyCount > 0)
            {
                newerreplies = true;
            }
            _posttype = "TOPICS";
            _postdate = _topic.Date;
            _ip       = _topic.PosterIp;

            if (_isadmin || _isForumModerator)
            {
                TopicApprove.Visible = (_topic.Status == (int)Enumerators.PostStatus.UnModerated ||
                                        _topic.Status == (int)Enumerators.PostStatus.OnHold);
                TopicApprove.OnClientClick = string.Format(
                    "mainScreen.LoadServerControlHtml('Moderation',{{'pageID':7,'data':'{0},{1}'}}, 'methodHandlers.BeginRecieve');return false;",
                    false, _topic.Id);
                //TopicHold.Visible = _topic.Status == Enumerators.PostStatus.UnModerated;
            }
            if (_topic.Status == (int)Enumerators.PostStatus.UnModerated || _topic.Status == (int)Enumerators.PostStatus.OnHold)
            {
                _unmoderated = true;
                modtext      = String.Format("<span class=\"moderation\">{0}</span>", webResources.lblRequireModeration);
                if (_topic.Status == (int)Enumerators.PostStatus.OnHold)
                {
                    modtext = String.Format("<span class=\"moderation\">!!{0}!!</span>", webResources.OnHold);
                }
            }
            SplitTopic.Visible        = false;
            hEdit.Text                = webResources.lblEditTopic;
            hEdit.ToolTip             = webResources.lblEditTopic;
            TopicDelete.AlternateText = webResources.lblDelTopic;
            TopicDelete.OnClientClick = "confirmPostBack('Do you want to delete the Topic?','DeleteTopic'," + ThisId + ");return false;";
            imgPosticon.OnClientClick = "confirmBookMark('Do you want to bookmark the Topic?'," + ThisId + ",-1); return false;";
        }
        else if (_post is ReplyInfo)
        {
            ReplyInfo reply = (ReplyInfo)_post;
            _author = Members.GetAuthor(reply.AuthorId);
            ThisId  = reply.Id;
            if (_topic.LastReplyId != reply.Id)
            {
                newerreplies = true;
            }
            _posttype = "REPLY";
            _postdate = reply.Date;
            _ip       = reply.PosterIp;

            if (_isadmin || _isForumModerator)
            {
                TopicApprove.Visible = (reply.Status == (int)Enumerators.PostStatus.UnModerated ||
                                        reply.Status == (int)Enumerators.PostStatus.OnHold);
                TopicApprove.OnClientClick = string.Format(
                    "mainScreen.LoadServerControlHtml('Moderation',{{'pageID':7,'data':'{0},{1},{2}'}}, 'methodHandlers.BeginRecieve');return false;",
                    false, "", reply.Id);
                //TopicHold.Visible = reply.Status == Enumerators.PostStatus.UnModerated;
            }
            if (reply.Status == (int)Enumerators.PostStatus.UnModerated || reply.Status == (int)Enumerators.PostStatus.OnHold)
            {
                _unmoderated = true;
                modtext      = String.Format("<span class=\"moderation\">{0}</span>", webResources.lblRequireModeration);
                if (reply.Status == (int)Enumerators.PostStatus.OnHold)
                {
                    modtext = String.Format("<span class=\"moderation\">!!{0}!!</span>", webResources.OnHold);
                }
            }

            TopicDelete.AlternateText  = webResources.lblDelReply;
            SplitTopic.CommandArgument = ThisId.ToString();
            hEdit.ToolTip             = webResources.lblEditReply;
            hEdit.Text                = webResources.lblEditReply;
            TopicDelete.OnClientClick = "confirmPostBack('Do you want to delete the Reply?','DeleteReply'," + ThisId + ");return false;";
            imgPosticon.OnClientClick = "confirmBookMark('Do you want to bookmark the Reply?'," + ThisId + "," + page.CurrentPage + ");return false;";

            SplitTopic.Visible       = _isForumModerator || _isadmin;
            SplitTopic.OnClientClick = String.Format(
                "mainScreen.LoadServerControlHtml('Split Topic',{{'pageID':6,'data':'{0},asc'}}, 'methodHandlers.BeginRecieve');return false;", reply.Id);
        }
        TopicDelete.Visible = (currentUser.ToLower() == _author.Username.ToLower() &&
                               !newerreplies);

        TopicDelete.Visible       = TopicDelete.Visible || (_isForumModerator || _isadmin);
        imgPosticon.AlternateText = String.Format("#{0}", ThisId);


        date.Text = _unmoderated ? modtext : SnitzTime.TimeAgoTag(_postdate, page.IsAuthenticated, page.Member);


        ViewIP.Visible       = _isadmin && Config.LogIP;
        ViewIP.OnClientClick = string.Format(
            "mainScreen.LoadServerControlHtml('IP Lookup',{{'pageID':4,'data':'{0}'}}, 'methodHandlers.BeginRecieve');return false;",
            _ip);

        hEdit.NavigateUrl = string.Format("~/Content/Forums/post.aspx?method=edit&type={0}&id={1}&TOPIC={2}", _posttype, ThisId, _topicid);
        hEdit.Visible     = (currentUser.ToLower() == _author.Username.ToLower() && !newerreplies);
        hEdit.Visible     = hEdit.Visible && !(_isTopicLocked || _forum.Status == (int)Enumerators.PostStatus.Closed); // but not if it is locked
        hEdit.Visible     = hEdit.Visible || _isForumModerator || _isadmin;                                            //override for admins/moderator

        hReplyQuote.Visible     = page.IsAuthenticated && !(_isTopicLocked || _forum.Status == (int)Enumerators.PostStatus.Closed);
        hReplyQuote.Visible     = hReplyQuote.Visible || (_isForumModerator || _isadmin);
        hReplyQuote.NavigateUrl = String.Format("~/Content/Forums/post.aspx?method=quote&type={0}&id={1}&TOPIC={2}", _posttype, ThisId, _topicid);
    }
Exemplo n.º 42
0
        private string EditUser(HttpContext context)
        {
            PageBase pageBase = new PageBase(context);
            if (pageBase.IsLogin())
            {
                string Address = context.Request["Address"];
                string Mobile = context.Request["Mobile"];
                string QQ = context.Request["QQ"];

                UserModel model = new UserModel();
                model.Address = RemoveJ(Address);
                model.Mobile = RemoveJ(Mobile);
                model.QQ = RemoveJ(QQ);
                model.UserID = pageBase.CurrentUser.UserID;
                if (!string.IsNullOrEmpty(Address)) { bool r = UserDAL.AddDonate(model.UserID, "Address", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } }
                if (!string.IsNullOrEmpty(Mobile)) { bool r = UserDAL.AddDonate(model.UserID, "Mobile", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } }
                if (!string.IsNullOrEmpty(QQ)) { bool r = UserDAL.AddDonate(model.UserID, "QQ", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } }
                if (UserDAL.EditUser(model))
                {
                    return "{\"result\":true,\"message\":\"信息设定成功\"}";
                }
                else
                {
                    return "{\"result\":false,\"message\":\"信息设定失败\"}";
                }
            }
            return "{\"result\":false,\"message\":\"信息设定失败\"}";
        }
Exemplo n.º 43
0
 public NavigateSteps(ScenarioContext scenarioContext) : base(scenarioContext)
 {
     _pageBase = new PageBase(Driver);
 }
Exemplo n.º 44
0
 private string IsLogin(HttpContext context)
 {
     PageBase pageBase = new PageBase(context);
     return pageBase.IsLogin() ? "{\"result\":true,\"message\":\"\"}" : "{\"result\":false,\"message\":\"\"}";
 }
Exemplo n.º 45
0
 /// <summary>
 /// 获取模板内容
 /// </summary>
 /// <param name="fileName">模板文件的文件名称</param>
 /// <returns></returns>
 public static string ConverLable(string inputStr, params System.Data.KeyValueData[] pars)
 {
     if (inputStr.IndexOf("Tag") > 0)
     {
         inputStr = inputStr.Substring(inputStr.IndexOf('.') + 1, inputStr.IndexOf('}') - inputStr.IndexOf('.') - 1);
         string skinroot = PathHelper.Map(cfgHelper.FrameworkRoot) + "/" + TeConfig.Instance.TemplateFolder + "/" + _skinname + "/";
         String content = "";             //方法执行结果
         try
         {
             inputStr = TempInfo.Tags[inputStr];
             string labeltype=string.Empty;
             try
             {
                 labeltype = new PageBase().GetLabelType(inputStr);
             }
             catch
             {
                 return inputStr;
             }
             Type type = Type.GetType(String.Format("XCenter.TemplateEngine.Builder.{0}, XCenter.Code", labeltype), false, true);
             Action builder = (Action)Activator.CreateInstance(type);
             if (pars != null)
             {
                 builder.Params = pars;
             }
             else
             {
                 List<System.Data.KeyValueData> list = new List<System.Data.KeyValueData>();
                 foreach (string key in HttpContext.Current.Request.QueryString.AllKeys)
                 {
                     list.Add(System.Data.KeyValueData.Create(key, HttpContext.Current.Request.QueryString[key]));
                 }
                 foreach (string key in HttpContext.Current.Request.Form.AllKeys)
                 {
                     list.Add(System.Data.KeyValueData.Create(key, HttpContext.Current.Request.Form[key]));
                 }
                 builder.Params = list.ToArray();
             }
             builder.TagContent = inputStr; //标签的完整内容
             builder.ThisContext = HttpContext.Current;   //传递当前请求以备用
             builder.SkinRoot = _skinroot;    //传递当前模板资源的根目录
             if (builder.ParseContent())      //解析标签内容
             {
                 content = type.InvokeMember("TagConvert", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.IgnoreCase, null, builder, new object[] { }).ToString();
                 return content;
             }
         }
         catch{ }
     }
     return string.Empty;
 }
Exemplo n.º 46
0
    public void SetUpBlocks()
    {
        tblBlock      objBlock     = new tblBlock();
        StringBuilder blockContent = new StringBuilder();

        objBlockDt = objBlock.GetBlockByControlId();
        if (Cache["SiteName"] == null)
        {
            tblSettings objSettings = new tblSettings();
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteName);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteTagLine);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteFavicon);
            objSettings.LoadAll();
            if (objSettings.RowCount > 0)
            {
                Cache["SiteName"] = objSettings.AppSiteName;
            }
        }

        for (int i = 0; i <= objBlockDt.Rows.Count - 1; i++)
        {
            blockContent = new StringBuilder();
            DataRow dr = objBlockDt.Rows[i];

            if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString() & (bool)dr["appIsShowContent"] == false)
            {
                objMenuItem = new tblMenuItem();
                objMenuDt   = new DataTable();
                objMenuDt   = objMenuItem.GetChildMenus((int)dr["appMenuTypeId"]);

                if (string.Compare(dr["appControlId"].ToString(), "divTopMenu") == 0)
                {
                    blockContent.Append(" <div style=\"background-color: #ED258F;\">");
                    blockContent.Append(" <div class=\"wrap\">");
                    blockContent.Append(" <div class=\"menu\">");
                    blockContent.Append("<ul class=\"megamenu skyblue\">");
                    LoadTopMenu(ref blockContent, 0);
                    blockContent.Append("</ul></div></div></div>");
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock1") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadFooterMenu(ref blockContent, 0, objMenuType.AppMenuTypeName);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock2") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadCategory(ref blockContent);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divCategoryFooter") == 0)
                {
                    LoadCategoryFooter(ref blockContent);
                }
                else if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString())
                {
                    blockContent.Append("<ul>");
                    SetUpMenu(ref blockContent, 0);
                    blockContent.Append("</ul>");
                }
            }
            else if ((bool)dr["appIsShowContent"] == true)
            {
                blockContent.Append(dr["appContent"]);
            }

            StringBuilder strContent = new StringBuilder();
            strContent.Append(blockContent);
            blockContent = new StringBuilder();
            blockContent.Append(strContent.ToString().Replace("~GetServerURL()~", PageBase.GetServerURL() + "/"));


            if ((this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
            else if ((this.Master.FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
        }
    }
        /// <summary>
        /// Invokes the middleware.
        /// </summary>
        /// <param name="context">The current http context</param>
        /// <param name="api">The current api</param>
        /// <returns>An async task</returns>
        public override async Task Invoke(HttpContext context, IApi api, IApplicationService service)
        {
            if (!IsHandled(context) && !context.Request.Path.Value.StartsWith("/manager/assets/"))
            {
                var url      = context.Request.Path.HasValue ? context.Request.Path.Value : "";
                var segments = url.Substring(1).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                int pos      = 0;

                //
                // 1: Store raw url
                //
                service.Url = context.Request.Path.Value;

                //
                // 2: Get the current site
                //
                Site site = null;

                // Try to get the requested site by hostname & prefix
                if (segments.Length > 0)
                {
                    site = await api.Sites.GetByHostnameAsync($"{context.Request.Host.Host}/{segments[0]}")
                           .ConfigureAwait(false);

                    if (site != null)
                    {
                        context.Request.Path = "/" + string.Join("/", segments.Skip(1));
                        pos = 1;
                    }
                }

                // Try to get the requested site by hostname
                if (site == null)
                {
                    site = await api.Sites.GetByHostnameAsync(context.Request.Host.Host)
                           .ConfigureAwait(false);
                }

                // If we didn't find the site, get the default site
                if (site == null)
                {
                    site = await api.Sites.GetDefaultAsync()
                           .ConfigureAwait(false);
                }

                if (site != null)
                {
                    // Update application service
                    service.Site.Id      = site.Id;
                    service.Site.Culture = site.Culture;
                    service.Site.Sitemap = await api.Sites.GetSitemapAsync(site.Id);

                    // Set current culture if specified in site
                    if (!string.IsNullOrEmpty(site.Culture))
                    {
                        var cultureInfo = new CultureInfo(service.Site.Culture);
                        CultureInfo.CurrentCulture = CultureInfo.CurrentUICulture = cultureInfo;
                    }
                }

                //
                // 3: Get the current page
                //
                PageBase page     = null;
                PageType pageType = null;

                if (segments != null && segments.Length > pos)
                {
                    // Scan for the most unique slug
                    for (var n = segments.Length; n > pos; n--)
                    {
                        var slug = string.Join("/", segments.Subset(pos, n));
                        page = await api.Pages.GetBySlugAsync <PageBase>(slug, site.Id)
                               .ConfigureAwait(false);

                        if (page != null)
                        {
                            pos = pos + n;
                            break;
                        }
                    }
                }
                else
                {
                    page = await api.Pages.GetStartpageAsync <PageBase>(site.Id)
                           .ConfigureAwait(false);
                }

                if (page != null)
                {
                    pageType            = App.PageTypes.GetById(page.TypeId);
                    service.PageId      = page.Id;
                    service.CurrentPage = page;
                }

                //
                // 4: Get the current post
                //
                PostBase post     = null;
                PostType postType = null;

                if (page != null && pageType.IsArchive && segments.Length > pos)
                {
                    post = await api.Posts.GetBySlugAsync <PostBase>(page.Id, segments[pos])
                           .ConfigureAwait(false);

                    if (post != null)
                    {
                        pos++;
                    }
                }

                if (post != null)
                {
                    postType            = App.PostTypes.GetById(post.TypeId);
                    service.CurrentPost = post;
                }

#if DEBUG
                _logger?.LogDebug($"FOUND SITE: [{ site.Id }]");
                if (page != null)
                {
                    _logger?.LogDebug($"FOUND PAGE: [{ page.Id }]");
                }

                if (post != null)
                {
                    _logger?.LogDebug($"FOUND POST: [{ post.Id }]");
                }
#endif

                //
                // 5: Route request
                //
                var route = new StringBuilder();
                var query = new StringBuilder();

                if (post != null)
                {
                    route.Append(post.Route ?? "/post");
                    for (var n = pos; n < segments.Length; n++)
                    {
                        route.Append("/");
                        route.Append(segments[n]);
                    }

                    query.Append("?id=");
                    query.Append(post.Id);
                }
                else if (page != null)
                {
                    route.Append(page.Route ?? (pageType.IsArchive ? "/archive" : "/page"));
                    for (var n = pos; n < segments.Length; n++)
                    {
                        route.Append("/");
                        route.Append(segments[n]);
                    }

                    query.Append("?id=");
                    query.Append(page.Id);

                    if (!page.ParentId.HasValue && page.SortOrder == 0)
                    {
                        query.Append("&startpage=true");
                    }
                }

                if (route.Length > 0)
                {
                    var strRoute = route.ToString();
                    var strQuery = query.ToString();

#if DEBUG
                    _logger?.LogDebug($"SETTING ROUTE: [{ strRoute }]");
                    _logger?.LogDebug($"SETTING QUERY: [{ strQuery }]");
#endif

                    context.Request.Path        = new PathString(strRoute);
                    context.Request.QueryString = new QueryString(strQuery);
                }
            }
            await _next.Invoke(context);
        }
Exemplo n.º 48
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PageBase pb = new PageBase();

            if (Request.Cookies["Cookies"] == null)
            {
                Response.Redirect("../../Login.aspx");
            }
            if (!IsPostBack)
            {
                FineUI.DropDownList        drop  = new FineUI.DropDownList();
                List <Entity.AnalysisItem> items = DAL.AnalysisItem.GetAnalysisItemList(1);
                //foreach (Entity.AnalysisItem item in items)
                //{
                //    FineUI.ListItem li = new FineUI.ListItem();
                //    li.Text = item.ItemName;
                //    li.Value = item.ItemCode;
                //    drop.Items.Add(li);
                //}
                string Code = "";
                if (items.Count > 0)
                {
                    Code = items[0].ItemName;
                }
                string  deleteScript = GetDeleteScript();
                JObject defaultObj   = new JObject();
                //defaultObj.Add("Name", "新用户");
                //defaultObj.Add("Gender", "1");
                defaultObj.Add("ResultID", 999999);
                defaultObj.Add("ItemName", Code);
                defaultObj.Add("Result", 9.1234);
                //List<Entity.EmisstionItem> itemss2 = DAL.SewageWarrantItem.GetAllSewageWarrantItemEx2(1);
                //foreach (Entity.EmisstionItem item in itemss2)
                //{
                //    defaultObj.Add(item.ItemName, "0");
                //}

                //defaultObj.Add("EntranceDate", "2016-09-01");
                //defaultObj.Add("AtSchool", false);
                //defaultObj.Add("ProductInfo", "产品产量");
                defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));

                // 在第一行新增一条数据
                btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, AppendToEnd);

                // 重置表格
                //btnReset.OnClientClick = Confirm.GetShowReference("确定要重置表格数据?", String.Empty, Grid1.GetRejectChangesReference(), String.Empty);


                // 删除选中行按钮
                btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!") + deleteScript;
                //BindGrid();


                if (Request.QueryString["id"] != null)
                {
                    sGuid = Request.QueryString["id"].ToString().Trim();
                    LoadData(sGuid);
                    BindGrid();
                }
                //BindGrid();
            }
        }
Exemplo n.º 49
0
 private static Skin LoadSkin(PageBase page, string skinPath)
 {
     Skin ctlSkin = null;
     try
     {
         string skinSrc = skinPath;
         if (skinPath.ToLower().IndexOf(Globals.ApplicationPath, StringComparison.Ordinal) != -1)
         {
             skinPath = skinPath.Remove(0, Globals.ApplicationPath.Length);
         }
         ctlSkin = ControlUtilities.LoadControl<Skin>(page, skinPath);
         ctlSkin.SkinSrc = skinSrc;
         //call databind so that any server logic in the skin is executed
         ctlSkin.DataBind();
     }
     catch (Exception exc)
     {
         //could not load user control
         var lex = new PageLoadException("Unhandled error loading page.", exc);
         if (TabPermissionController.CanAdminPage())
         {
             //only display the error to administrators
             var skinError = (Label)page.FindControl("SkinError");
             skinError.Text = string.Format(Localization.GetString("SkinLoadError", Localization.GlobalResourceFile), skinPath, page.Server.HtmlEncode(exc.Message));
             skinError.Visible = true;
         }
         Exceptions.LogException(lex);
     }
     return ctlSkin;
 }
Exemplo n.º 50
0
    protected void write_json()
    {
        IDictionary <string, object> dictionary = new Dictionary <string, object>();

        if (!base.IsUserLoginByMobileForAjax())
        {
            dictionary.Add("status", "2");
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
        else
        {
            string str = "_m_jsk3_jqkj";
            dictionary.Add("status", "1");
            List <object> cache = new List <object>();
            if (CacheHelper.GetCache("balance_kc_FileCacheKey" + str) != null)
            {
                cache = CacheHelper.GetCache("balance_kc_FileCacheKey" + str) as List <object>;
            }
            else
            {
                string  str2     = "";
                string  str3     = "";
                string  str4     = "";
                string  str5     = "";
                DataSet topPhase = CallBLL.cz_phase_jsk3_bll.GetTopPhase(0x16);
                if (topPhase != null)
                {
                    DataTable table = topPhase.Tables[0];
                    Dictionary <string, object> dictionary2 = new Dictionary <string, object>();
                    StringBuilder builder = new StringBuilder();
                    foreach (DataRow row in table.Rows)
                    {
                        str2 = row["phase"].ToString().Trim().Substring(9, 2);
                        str3 = row["play_open_date"].ToString();
                        int num  = Convert.ToInt32(row["n1"].ToString());
                        int num2 = Convert.ToInt32(row["n2"].ToString());
                        int num3 = Convert.ToInt32(row["n3"].ToString());
                        str4 = ((num + num2) + num3).ToString();
                        if ((num == num2) && (num2 == num3))
                        {
                            str5 = "通吃";
                        }
                        else if (Convert.ToInt32(str4) <= 10)
                        {
                            str5 = "小";
                        }
                        else
                        {
                            str5 = "大";
                        }
                        string item = string.Format("{0},{1},{2},{3},{4},{5}", new object[] { str2, num, num2, num3, str4, str5 });
                        cache.Add(item);
                    }
                }
                CacheHelper.SetCache("balance_kc_FileCacheKey" + str, cache);
                CacheHelper.SetPublicFileCache("balance_kc_FileCacheKey" + str, cache, PageBase.GetPublicForderPath(base.get_KC_BalanceFileName()));
            }
            dictionary.Add("k3Long", cache);
            base.OutJson(JsonHandle.ObjectToJson(dictionary));
        }
    }
Exemplo n.º 51
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSkin gets the Skin
        /// </summary>
        /// <param name="page">The Page</param>
        /// <history>
        /// 	[cnurse]	12/04/2007  documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public static Skin GetSkin(PageBase page)
        {
            Skin skin = null;
            string skinSource = Null.NullString;

            //skin preview
            if ((page.Request.QueryString["SkinSrc"] != null))
            {
                skinSource = SkinController.FormatSkinSrc(Globals.QueryStringDecode(page.Request.QueryString["SkinSrc"]) + ".ascx", page.PortalSettings);
                skin = LoadSkin(page, skinSource);
            }

            //load user skin ( based on cookie )
            if (skin == null)
            {
                HttpCookie skinCookie = page.Request.Cookies["_SkinSrc" + page.PortalSettings.PortalId];
                if (skinCookie != null)
                {
                    if (!String.IsNullOrEmpty(skinCookie.Value))
                    {
                        skinSource = SkinController.FormatSkinSrc(skinCookie.Value + ".ascx", page.PortalSettings);
                        skin = LoadSkin(page, skinSource);
                    }
                }
            }

            //load assigned skin
            if (skin == null)
            {
                skinSource = Globals.IsAdminSkin() ? SkinController.FormatSkinSrc(page.PortalSettings.DefaultAdminSkin, page.PortalSettings) : page.PortalSettings.ActiveTab.SkinSrc;
                if (!String.IsNullOrEmpty(skinSource))
                {
                    skinSource = SkinController.FormatSkinSrc(skinSource, page.PortalSettings);
                    skin = LoadSkin(page, skinSource);
                }
            }

            //error loading skin - load default
            if (skin == null)
            {
                skinSource = SkinController.FormatSkinSrc(SkinController.GetDefaultPortalSkin(), page.PortalSettings);
                skin = LoadSkin(page, skinSource);
            }

            //set skin path
            page.PortalSettings.ActiveTab.SkinPath = SkinController.FormatSkinPath(skinSource);

            //set skin id to an explicit short name to reduce page payload and make it standards compliant
            skin.ID = "dnn";

            return skin;
        }
        public void MyTestCleanup()
        {
            PageBase <SilverlightAppLauncher> .DisposeWindow();

            SilverlightAppLauncher.UnloadBrowser(GetBrowserTitle());
        }
Exemplo n.º 53
0
 public static string getDictName(string strDictCode, string strDictType)
 {
     return(PageBase.getDictName(strDictCode, strDictType));
 }
Exemplo n.º 54
0
    public void SetUpPageContent(ref HtmlGenericControl PageContentControl, ref HtmlGenericControl PageHeadingControl, ref string metaDescription, ref string metaKeywords)
    {
        string pageName = "";

        pageName = GetPageAliasFromURL();


        tblPage objPage = new tblPage();

        DataTable dtPageDetail = objPage.GetPageDetailByAlias();

        DataRow[] arDataRow = dtPageDetail.Select("appAlias='" + pageName + "'");
        if (!(arDataRow.Length > 0))
        {
            arDataRow = dtPageDetail.Select("appAlias='" + pageName.Split('/')[0] + "/{*name}" + "'");
        }

        //objPage.Where.AppPageName.Value = pageName
        //'objPage.Where.AppAlias.Value = pageName
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageId)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageTitle)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageContent)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppPageHeading)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppSEOWord)
        //'objPage.Query.AddResultColumn(tblPage.ColumnNames.AppSEODescription)
        //'objPage.Query.Load()


        if (arDataRow.Length > 0)
        {
            Page.Title = arDataRow[0][tblPage.ColumnNames.AppPageTitle].ToString();

            ViewState["CurrentPageTitle"] = arDataRow[0][tblPage.ColumnNames.AppPageTitle];


            if ((PageContentControl != null))
            {
                PageContentControl.InnerHtml = arDataRow[0][tblPage.ColumnNames.AppPageContent].ToString().Replace("<pre ", "<p ").Replace("</pre>", "</p>");
                PageContentControl.InnerHtml = PageContentControl.InnerHtml.Replace("~GetServerURL()~", PageBase.GetServerURL() + "/");
            }

            if ((PageHeadingControl != null))
            {
                PageHeadingControl.InnerText = arDataRow[0][tblPage.ColumnNames.AppPageHeading].ToString();
            }

            metaDescription = arDataRow[0][tblPage.ColumnNames.AppSEODescription].ToString();
            metaKeywords    = arDataRow[0][tblPage.ColumnNames.AppSEOWord].ToString();

            ViewState["CurrentPageMetaDesc"]     = arDataRow[0][tblPage.ColumnNames.AppSEODescription];
            ViewState["CurrentPageMetaKeyWords"] = arDataRow[0][tblPage.ColumnNames.AppSEOWord];
        }
    }
Exemplo n.º 55
0
        private string EditPwd(HttpContext context)
        {
            PageBase pageBase = new PageBase(context);
            string Pwd = context.Request["Pwd"];

            if (!string.IsNullOrEmpty(Pwd))
            {
                if (UserDAL.EditPwd(pageBase.CurrentUser.UserID, Pwd))
                {
                    return "{\"result\":true,\"message\":\"密码修改成功\"}";
                }
                else
                {
                    return "{\"result\":false,\"message\":\"密码修改失败\"}";
                }
            }
            else
            {
                return "{\"result\":false,\"message\":\"密码修改失败\"}";
            }
        }
Exemplo n.º 56
0
 public static AutomationElement GetFundsLabel(string fundsText)
 {
     return(PageBase <TApp> .FindControlByContent(fundsText));
 }
Exemplo n.º 57
0
        private string GetPwd(HttpContext context)
        {
            PageBase pageBase = new PageBase(context);
            string email = context.Request["Email"];

            if (!string.IsNullOrEmpty(email))
            {
                if (SmtpHelper.SendCPwdMail(email))
                {
                    return "{\"result\":true,\"message\":\"邮件已经发送\"}";
                }
                else
                {
                    return "{\"result\":false,\"message\":\"邮件发送失败\"}";
                }
            }
            else
            {
                return "{\"result\":false,\"message\":\"该邮箱不存在系统中\"}";
            }
        }
Exemplo n.º 58
0
 public static AutomationElementCollection GetAllFundsLabels(string fundsText)
 {
     return(PageBase <TApp> .FindAllControlsByContent(fundsText));
 }
Exemplo n.º 59
0
        private string SendActionMail(HttpContext context)
        {
            PageBase pageBase = new PageBase(context);
            string email = context.Request["Email"];

            if (pageBase.IsLogin())
            {
                if (SmtpHelper.SendActiveMail(pageBase.CurrentUser.UserID,pageBase.CurrentUser.Email))
                {
                    return "{\"result\":true,\"message\":\"激活邮件已经发送,请进入你的邮箱\"}";
                }
                else
                {
                    return "{\"result\":false,\"message\":\"邮件发送失败\"}";
                }
            }
            else
            {
                return "{\"result\":false,\"message\":\"该邮箱不存在系统中\"}";
            }
        }
Exemplo n.º 60
0
        /// <summary>
        /// Invites the inventory users.
        /// </summary>
        public void InviteInventoryUsers()
        {
            bool            isInventoryAdmin         = Utils.IsCompanyInventoryAdmin(this.CompanyId, UserID);
            CompanyUserRole highestRole              = GetBL <InventoryBL>().GetHighestInventoryRole(this.CompanyId, UserID);
            bool            hasStaffMemberPermission = isInventoryAdmin || (highestRole != null && highestRole.Code.SortOrder <= Utils.GetCodeByValue("CompanyUserTypeCode", "INVSTAFF").SortOrder);

            if (isInventoryAdmin || GetBL <InventoryBL>().IsCompanyLocationManagerAnyLocation(this.CompanyId, UserID))
            {
                HideNotifications();

                Invitation pendingInvitation = null;
                User       user = null;
                if (SelectedUserId > 0)
                {
                    user = this.GetBL <PersonalBL>().GetUser(SelectedUserId);
                    //Check whether this user already has a pending invitation.
                    pendingInvitation = GetPendingInvitationForUser(user);
                }
                else
                {
                    pendingInvitation = GetPendingInvitationForEmail(SelectedUserEmail);
                }

                if (pendingInvitation != null)
                {
                    //This scenario can only occur if the user accidentaly double clicks the send button.
                    //So the popup is silently closed without doing anything.
                    divSearchResults.Visible = false;
                    //ucUserInvitationPopup.HideInivitePopup();
                    popupInviteProjectMember.HidePopup();
                }
                else
                {
                    string toUserFullName   = txtInventoryUserName.Text.Trim();
                    string toEmail          = SelectedUserEmail;
                    string fromUserFullName = (Support.UserFirstName + " " + Support.UserLastName).Trim();
                    string fromUserEmail    = GetBL <PersonalBL>().GetUser(this.UserID).Email1;
                    string companyName      = GetBL <CompanyBL>().GetCompany(this.CompanyId).CompanyName;

                    #region Create and save Invitation object

                    Invitation invitation = new Invitation();
                    DataContext.Invitations.AddObject(invitation);

                    invitation.FromUserId = UserID;

                    if (SelectedUserId > 0)
                    {
                        invitation.ToUserId = SelectedUserId;
                        invitation.ToEmail  = user.Email1;
                    }
                    else
                    {
                        invitation.ToName  = toUserFullName;
                        invitation.ToEmail = SelectedUserEmail;
                    }

                    invitation.InvitationTypeCodeId   = GetInvitationTypeCodeId(ViewMode.InventoryTeam);
                    invitation.InvitationStatusCodeId = Support.GetCodeIdByCodeValue("InvitationStatus", "PENDING");
                    invitation.RelatedTable           = StageBitz.Common.Constants.GlobalConstants.RelatedTables.UserRoleTypes.Companies;
                    invitation.RelatedId = CompanyId;

                    invitation.CreatedByUserId = invitation.LastUpdatedByUserId = UserID;
                    invitation.CreatedDate     = invitation.LastUpdatedDate = Now;
                    StringBuilder sbInviteInventoryStaffEmail    = new StringBuilder();
                    StringBuilder sbInviteInventoryObserverEmail = new StringBuilder();
                    string        staffHtml      = string.Empty;
                    string        observerHtml   = string.Empty;
                    string        allNoAcessHtml = string.Empty;

                    Dictionary <int, int> locationRoles = sbInventoryLocationRoles.LocationPermissions;
                    if (locationRoles.Count == 0)
                    {
                        popupInviteInventoryUsers.HidePopup();
                        if (isInventoryAdmin)
                        {
                            PageBase.ShowErrorPopup(ErrorCodes.InventoryLocationDeleted);
                        }
                        else
                        {
                            if (OnInformCompanyInventoryToShowErrorPopup != null)
                            {
                                OnInformCompanyInventoryToShowErrorPopup(ErrorCodes.NoEditPermissionForInventory, true);
                            }
                        }

                        return;
                    }

                    foreach (int locationId in locationRoles.Keys)
                    {
                        if (Utils.HasLocationManagerPermission(this.CompanyId, this.UserID, locationId))
                        {
                            int userTypeCodeId = locationRoles[locationId];
                            invitation.InvitationUserRoles.Add(
                                new InvitationUserRole
                            {
                                CreatedByUserId     = UserID,
                                CreatedDate         = Now,
                                IsActive            = true,
                                LastUpdatedByUserId = UserID,
                                LastUpdatedDate     = Now,
                                UserTypeCodeId      = userTypeCodeId,
                                LocationId          = locationId
                            }
                                );

                            Data.Location location              = GetBL <LocationBL>().GetLocation(locationId);
                            Code          inventoryStaffCode    = Utils.GetCodeByValue("CompanyUserTypeCode", "INVSTAFF");
                            Code          inventoryObserverCode = Utils.GetCodeByValue("CompanyUserTypeCode", "INVOBSERVER");

                            if (userTypeCodeId == inventoryStaffCode.CodeId)
                            {
                                sbInviteInventoryStaffEmail.Append(string.Format("<li>{0}</li>", location.LocationName));
                            }
                            else if (userTypeCodeId == inventoryObserverCode.CodeId)
                            {
                                sbInviteInventoryObserverEmail.Append(string.Format("<li>{0}</li>", location.LocationName));
                            }
                        }
                        else
                        {
                            if (OnInformCompanyInventoryToShowErrorPopup != null)
                            {
                                popupInviteInventoryUsers.HidePopup();
                                OnInformCompanyInventoryToShowErrorPopup(ErrorCodes.NoEditPermissionForInventory, !hasStaffMemberPermission);
                            }

                            return;
                        }
                    }

                    if (sbInviteInventoryStaffEmail.Length > 0)
                    {
                        staffHtml = string.Format(@"<p>You have been invited as Inventory Staff for the following location(s):</p>
                                                    <ul>
                                                     {0}
                                                    </ul>
                                                    <div style='margin-left:25px;'><p>This means that for this location:</p>
                                                    <ul>
                                                     <li>You can now view all the bookings for your Inventory</li>
                                                     <li>You can create, edit and delete inventory Items</li>
                                                     <li>And you can still make your own bookings.</li>
                                                    </ul></div>", sbInviteInventoryStaffEmail.ToString());
                    }

                    if (sbInviteInventoryObserverEmail.Length > 0)
                    {
                        observerHtml = string.Format(@"<p>You have been invited as Inventory Observer for the following location(s):</p>
                                                    <ul>
                                                     {0}
                                                    </ul>
                                                    <div style='margin-left:25px;'><p>This means that for this location:</p>
                                                    <ul>
                                                     <li>You’ll be able to browse their Inventory</li>
                                                     <li>You can request Items from it for your own bookings.</li>
                                                    </ul></div>", sbInviteInventoryObserverEmail.ToString());
                    }

                    if (sbInviteInventoryObserverEmail.Length == 0 && sbInviteInventoryStaffEmail.Length == 0)
                    {
                        allNoAcessHtml = @"<p>You'll have Inventory Observer access to Items listed against the default Inventory location for
                                            @CompanyName. This means that you'll be able to browse these Items and also request these Items for your own bookings</p>";
                    }

                    DataContext.SaveChanges();

                    #endregion Create and save Invitation object

                    if (SelectedUserId > 0)
                    {
                        toEmail = user.Email1;
                        string dashboardUrl = string.Format("{0}/Default.aspx", StageBitzUrl);
                        //For Non registered users First need to activate the account
                        if (!user.IsActive)
                        {
                            dashboardUrl = string.Format("{0}/Public/Invitation.aspx?invitationCode={1}", StageBitzUrl, HttpServerUtility.UrlTokenEncode(Utils.EncryptStringAES(invitation.InvitationId.ToString())));
                        }

                        EmailSender.StageBitzUrl = StageBitzUrl;
                        EmailSender.InviteInventoryUserExistingUser(toEmail, user.FirstName, fromUserFullName, fromUserEmail,
                                                                    companyName, dashboardUrl, staffHtml, observerHtml, allNoAcessHtml);
                        divInviteSent.InnerText = string.Format("{0} ({1}) has been invited to the Company Inventory.", Support.TruncateString(toUserFullName, 50), toEmail);
                    }
                    else
                    {
                        string invitationCode = HttpServerUtility.UrlTokenEncode(Utils.EncryptStringAES(invitation.InvitationId.ToString()));
                        string invitationUrl  = string.Format("{0}/Public/Invitation.aspx?invitationCode={1}", StageBitzUrl, invitationCode);
                        StageBitz.Common.EmailSender.StageBitzUrl = StageBitzUrl;

                        EmailSender.InviteInventoryUserNewUser(toEmail, toUserFullName, fromUserFullName, fromUserEmail,
                                                               companyName, invitationUrl, staffHtml, observerHtml, allNoAcessHtml);

                        divInviteSent.InnerText = string.Format("{0} ({1}) has been invited to the Company Inventory.", Support.TruncateString(toUserFullName, 50), toEmail);
                    }

                    divInviteSent.Visible    = true;
                    divSearchResults.Visible = false;
                    popupInviteInventoryUsers.HidePopup();
                }

                if (InvitationSent != null)
                {
                    InvitationSent(this, EventArgs.Empty);
                }
            }
            else
            {
                if (OnInformCompanyInventoryToShowErrorPopup != null)
                {
                    popupInviteInventoryUsers.HidePopup();
                    OnInformCompanyInventoryToShowErrorPopup(ErrorCodes.NoEditPermissionForInventory, !hasStaffMemberPermission);
                }
            }
        }