public void GoToPage(PageType pageType) { if(_currentPageType == pageType) return; //we're already on the same page, so don't bother doing anything BasePage pageToCreate = null; if(pageType == PageType.TitlePage) { pageToCreate = new TitlePage(); } if(pageType == PageType.InGamePage) { pageToCreate = new InGamePage(); } else if (pageType == PageType.ScorePage) { pageToCreate = new ScorePage(); } if(pageToCreate != null) //destroy the old page and create a new one { _currentPageType = pageType; if(_currentPage != null) { _currentPage.Destroy(); _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BasePage objBase = new BasePage(); DataSet ds = UserInfo.GetAllActiveLanguages(); DataRow dr = ds.Tables[0].Select("LanguageId =" + objBase.LanguageId)[0]; litLangauge.Text = Convert.ToString(dr["CountryName"]); img.Src = "/images/" + Convert.ToString(dr["Flag"]); DataView dv = ds.Tables[0].DefaultView; dv.RowFilter = "LanguageId <>" + objBase.LanguageId; rptLanguage.DataSource = dv; rptLanguage.DataBind(); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"])) { Utils.SetCulture(HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"].ToString(), HttpContext.Current.Request.Cookies["CultureCookie"]["UICulture"].ToString()); } } }
protected void CargaMenuUsuario() { BasePage oPagina = new BasePage(); Usuarios objUsuario = (Usuarios)oPagina.LeerVariableSesion("oUsuario"); string cUrl = ""; string menuTitle = ""; //string cDescription = ""; int nNumCor = 1; string menuItemID = ""; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("~/" + objUsuario.Roles.rolMenu.ToString())); XmlNode SiteMap = xmlDoc.LastChild; ///MENU PRINCIAL foreach (XmlNode menuNode in SiteMap) { cUrl = menuNode.Attributes["url"].Value; menuTitle = menuNode.Attributes["title"].Value; //cDescription = menuNode.Attributes["description"].Value; menuItemID = menuTitle + "_" + nNumCor.ToString(); EasymenuMain.AddItem(new OboutInc.EasyMenu_Pro.MenuItem(menuItemID, menuTitle, "", "", "", "")); EasymenuMain.AddSeparator("MenuSeparator" + nNumCor.ToString(), "|"); if (cUrl == "#") LeerSubmenu(menuNode, menuItemID, true); nNumCor++; } }
//private const string uploadPath = "../commup/upload/"; public void ProcessRequest(HttpContext context) { string vlreturn = "", error = "", json = ""; BasePage basepage = new BasePage(); if (context.Request.Files.Count == 0) { vlreturn = ""; error = CCommon.Get_Definephrase(Definephrase.Invalid_file); } else { string uploadPath = context.Request.QueryString["up"]; uploadPath = CFunctions.IsNullOrEmpty(uploadPath) ? "commup/upload/" : CFunctions.MBDecrypt(uploadPath); DirectoryInfo pathInfo = new DirectoryInfo(context.Server.MapPath(uploadPath)); for (int i = 0; i < context.Request.Files.Count; i++) { HttpPostedFile fileUpload = context.Request.Files[i]; if (CFunctions.IsNullOrEmpty(fileUpload.FileName)) continue; vlreturn = ""; error = ""; string fileExtension = Path.GetExtension(fileUpload.FileName).ToLower(); if (extension_img.IndexOf(fileExtension) == -1) { error = CCommon.Get_Definephrase(Definephrase.Invalid_filetype_image); } else { string fileName; if (pathInfo.GetFiles(fileUpload.FileName).Length == 0) { fileName = Path.GetFileName(fileUpload.FileName); } else { fileName = this.Get_Filename() + fileExtension; //error = CCommon.Get_Definephrase(Definephrase.Notice_fileupload_duplicate); } string uploadLocation = context.Server.MapPath(uploadPath) + "\\" + fileName; if (fileUpload.ContentLength > CConstants.FILEUPLOAD_SIZE) { this.ResizeImage(fileUpload, uploadLocation, 800, 760, true); } else { fileUpload.SaveAs(uploadLocation); } vlreturn = uploadPath.Replace("../", "") + fileName; error = CCommon.Get_Definephrase(Definephrase.Notice_fileupload_done); } json += (CFunctions.IsNullOrEmpty(json) ? "" : ",") + "{\"name\":\"" + vlreturn + "\", \"error\":\"" + error + "\"}"; } } context.Response.ContentType = "text/plain"; //context.Response.Write("{\"name\":\"" + vlreturn + "\", \"error\":\"" + error + "\"}"); context.Response.Write("{\"bindings\": [" + json + "]}"); }
private BasePage ReadPageJournal(BinaryReader reader) { var stream = reader.BaseStream; var posStart = stream.Position * BasePage.PAGE_SIZE; var posEnd = posStart + BasePage.PAGE_SIZE; // Create page instance and read from disk (read page header + content page) var page = new BasePage(); // read page header page.ReadHeader(reader); // Convert BasePage to correct Page Type if (page.PageType == PageType.Header) page = page.CopyTo<HeaderPage>(); else if (page.PageType == PageType.Collection) page = page.CopyTo<CollectionPage>(); else if (page.PageType == PageType.Index) page = page.CopyTo<IndexPage>(); else if (page.PageType == PageType.Data) page = page.CopyTo<DataPage>(); else if (page.PageType == PageType.Extend) page = page.CopyTo<ExtendPage>(); // read page content if page is not empty if (page.PageType != PageType.Empty) { // read page content page.ReadContent(reader); } // read non-used bytes on page and position cursor to next page reader.ReadBytes((int)(posEnd - stream.Position)); return page; }
public EmptyPage(BasePage page) : base(page.PageID) { if(page.DiskData.Length > 0) { this.DiskData = new byte[BasePage.PAGE_SIZE]; Buffer.BlockCopy(page.DiskData, 0, this.DiskData, 0, BasePage.PAGE_SIZE); } }
protected void butCierre_Click(object sender, EventArgs e) { //elimina objeto sesión que contiene objeto USUARIO BasePage oPaginaBase = new BasePage(); oPaginaBase.EliminarVariableSesion("oUsuario"); Response.Redirect("~/index.html"); }
public EmptyPage(BasePage page) : this(page.PageID) { // if page is not dirty but it´s changing to empty, lets copy disk content to add in journal if (!page.IsDirty && page.DiskData.Length > 0) { this.DiskData = new byte[BasePage.PAGE_SIZE]; Buffer.BlockCopy(page.DiskData, 0, this.DiskData, 0, BasePage.PAGE_SIZE); } }
/// <summary> /// Add a page to cache. if this page is in cache, override /// </summary> public void AddPage(BasePage page) { // do not cache extend page - never will be reused if (page.PageType != PageType.Extend) { lock(_cache) { _cache[page.PageID] = page; } } }
public void ProcessRequest(HttpContext context) { string vlreturn = "", error = ""; BasePage basepage = new BasePage(); if (context.Request.Files.Count == 0) { vlreturn = ""; error = CCommon.Get_Definephrase(Definephrase.Invalid_file); } else { HttpPostedFile fileUpload = context.Request.Files[0]; string fileExtension = Path.GetExtension(fileUpload.FileName).ToLower(); if (extension_img.IndexOf(fileExtension) == -1) { vlreturn = ""; error = CCommon.Get_Definephrase(Definephrase.Invalid_filetype_image); } else { string uploadPath = context.Request.QueryString["up"]; uploadPath = CFunctions.IsNullOrEmpty(uploadPath) ? "../commup/upload/" : CFunctions.MBDecrypt(uploadPath); string uploadPathDir = context.Server.MapPath(uploadPath); DirectoryInfo pathInfo = new DirectoryInfo(uploadPathDir); string fileName; if (pathInfo.GetFiles(fileUpload.FileName).Length == 0) { fileName = Path.GetFileName(fileUpload.FileName); } else { fileName = this.Get_Filename() + fileExtension; error = CCommon.Get_Definephrase(Definephrase.Notice_fileupload_duplicate); } if (CConstants.FILEUPLOAD_THUMBNAIL) { string uploadLocation_thumb = uploadPathDir + "\\thumb_" + fileName; this.CreateThumbnail(fileUpload, uploadLocation_thumb, true); } string uploadLocation = uploadPathDir + "\\" + fileName; fileUpload.SaveAs(uploadLocation); vlreturn = uploadPath.Replace("../", "") + fileName; error += CCommon.Get_Definephrase(Definephrase.Notice_fileupload_done); } } context.Response.ContentType = "text/plain"; context.Response.Write("{\"name\":\"" + vlreturn + "\", \"error\":\"" + error + "\"}"); }
/// <summary> /// 重写虚方法,此方法将在Init事件前执行 /// </summary> protected override void ShowPage() { Model.contents.article_category model = new BLL.channels.category().GetModel(this.category_id); if (model != null) { string _name = model.call_index; string _class_list = model.class_list; string _key = BasePage.pageUrl(model.model_id); string _where = "status=0 and category_id=" + this.category_id; DataRowCollection list = new BasePage().get_article_list(_name, page, _where, out totalcount, out pagelist, _key, this.category_id, "__id__").Rows; vh.Put("channel_id", category_id); vh.Put("list", list); vh.Put("page", pagelist); vh.Display("../Template/newList.html"); } }
protected bool CargaNombreUsuario() { BasePage oPagina = new BasePage(); Usuarios objUsuario = (Usuarios)oPagina.LeerVariableSesion("oUsuario"); if (objUsuario != null) lblUsuario.Text = "Bienvenido " + objUsuario.usrLogin.ToString(); else { return false; //oPagina.MessageBox("El Usuario tiene que Iniciar una Sesion"); //String scriptMsj = ""; //scriptMsj = "window.location = '~/index.html'"; //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "MENSAJE", scriptMsj, true); //Server.Transfer("~/index.html"); } return true; }
/// <summary> /// Write a page in sequence, not in absolute position /// </summary> private void WritePageInJournal(BinaryWriter writer, BasePage page) { // no need position cursor - journal writes in sequence var stream = writer.BaseStream; var posStart = stream.Position; var posEnd = posStart + BasePage.PAGE_SIZE; // Write page header page.WriteHeader(writer); // write content except for empty pages if (page.PageType != PageType.Empty) { page.WriteContent(writer); } // write with zero non-used page writer.Write(new byte[posEnd - stream.Position]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BasePage objBase = new BasePage(); DataSet ds = UserInfo.GetAllActiveLanguages(); DataRow dr = ds.Tables[0].Select("LanguageId =" + objBase.LanguageId)[0]; litLangauge.Text = Convert.ToString(dr["CountryName"]); img.Src = "/images/" + Convert.ToString(dr["Flag"]); DataView dv = ds.Tables[0].DefaultView; dv.RowFilter = "LanguageId <>" + objBase.LanguageId; rptLanguage.DataSource = dv; rptLanguage.DataBind(); } }
/// <summary> /// 分页初始化参数 /// </summary> /// <param name="page"></param> public static void initParam(BasePage page) { try { HiddenField hfPageIndex = (HiddenField)page.FindControl("hfPageIndex"); HiddenField hfPageSize = (HiddenField)page.FindControl("hfPageSize"); if (!String.IsNullOrEmpty(hfPageIndex.Value)) { page.pageIndex = Convert.ToInt32(hfPageIndex.Value); } if (!String.IsNullOrEmpty(hfPageSize.Value)) { page.pageSize = Convert.ToInt32(hfPageSize.Value); } } catch (Exception) { } }
protected void bnLogin_Click(object sender, EventArgs e) { //check and see if the login exists BasePage bp = new BasePage(); //Clear any previous login Sessions HttpContext.Current.Session["BPRDevLogin"] = null; SqlParameter SqlUSERID = new SqlParameter("@USERID", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "USERID", DataRowVersion.Default, txtUser.Text); SqlParameter SqlPASSWORD = new SqlParameter("@PASSWORD", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "PASSWORD", DataRowVersion.Default, txtPassword.Text); DataSet dsTemp = _dataAccessHelper.Data.ExecuteDataset("SELECT * FROM LOGIN WHERE Username=@USERID AND Password=@PASSWORD", SqlUSERID, SqlPASSWORD); if (dsTemp != null) { if (dsTemp.Tables[0].Rows.Count >= 1) { //SET Session Variable HttpContext.Current.Session["BPRDevLogin"] = true; HttpContext.Current.Session["BPRDevReferer"] = txtRefer.Text.ToString().Trim(); lblLoginError.Visible = false; Response.Redirect("/default.aspx"); } else { HttpContext.Current.Session["BPRDevLogin"] = false; HttpContext.Current.Session["BPRDevReferer"] = ""; //Then return back to the login page with error txtPassword.Text = ""; lblLoginError.Text = "Username or Password is incorrect."; lblLoginError.Visible = true; //log incorrect login attempt //after 3 lock the account } } }
/// <summary> /// Add a page as dirty page /// </summary> public void SetPageDirty(BasePage page) { lock(_cache) { // add page to dirty list _dirty[page.PageID] = page; // and remove from clean cache (keeps page in only one list) _cache.Remove(page.PageID); if (page.IsDirty) return; page.IsDirty = true; // if page is new (not exits on datafile), there is no journal for them if (page.DiskData.Length > 0) { // call action passing dirty page - used for journal file writes MarkAsDirtyAction(page); } } }
public static UserManagementDataContext GetDatabaseContext() { UserManagementDataContext result = null; BasePage bp = new BasePage(); XElement context = bp.UserContext; if (HttpContext.Current != null) { result = (UserManagementDataContext)HttpContext.Current.Items["UserManagementDataContext"]; } if (result == null) { result = new UserManagementDataContext(context); if (HttpContext.Current != null) { HttpContext.Current.Items["UserManagementDataContext"] = result; } } return result; }
private void ReloadPage() { builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("靓号管理"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); int uid = int.Parse(Utils.GetRequest("uid", "all", 1, @"^[1-9]\d*$", "0")); int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[0-4]$", "0")); if (ptype == 0) { builder.Append("全部|"); } else { builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=uidlist&ptype=0") + "\">全部</a>|"); } if (ptype == 1) { builder.Append("查询中|"); } else { builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=uidlist&ptype=1") + "\">查询中</a>|"); } if (ptype == 2) { builder.Append("已报价|"); } else { builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=uidlist&ptype=2") + "\">已报价</a>|"); } if (ptype == 3) { builder.Append("已成交|"); } else { builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=uidlist&ptype=3") + "\">已成交</a>|"); } if (ptype == 4) { builder.Append("已撤销"); } else { builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=uidlist&ptype=4") + "\">已撤销</a>"); } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; string strWhere = string.Empty; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string[] pageValUrl = { "act", "ptype", "uid", "backurl" }; pageIndex = Utils.ParseInt(Request["page"]); if (pageIndex == 0) { pageIndex = 1; } strWhere = "Types=0"; if (ptype == 4) { strWhere += " and State=9";//已撤销 } else { if (ptype > 0 && ptype < 3) { strWhere += " and State=" + ptype + ""; } else if (ptype >= 3) { strWhere += " and State>=3 and State<>9"; } } if (uid > 0) { strWhere += " and usid=" + uid + ""; } // 开始读取专题 IList <BCW.Model.SellNum> listSellNum = new BCW.BLL.SellNum().GetSellNums(pageIndex, pageSize, strWhere, out recordCount); if (listSellNum.Count > 0) { int k = 1; foreach (BCW.Model.SellNum n in listSellNum) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } builder.Append("<a href=\"" + Utils.getUrl("../uinfo.aspx?uid=" + n.UsID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + n.UsName + "</a>"); if (n.State == 1) { builder.Append("<b>查询中</b>ID号:" + n.BuyUID + "|提交时间" + DT.FormatDate(n.AddTime, 5) + ""); builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=priceok&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[报价]</a>"); builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=priceno&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[撤销]</a>"); } else if (n.State == 2) { builder.Append("<b>已报价</b>ID号:" + n.BuyUID + "|提交时间" + DT.FormatDate(n.AddTime, 5) + "[报价" + n.Price + "" + ub.Get("SiteBz") + "]"); builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=priceno&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[撤销]</a>"); } else if (n.State == 9) { builder.Append("<b>已撤销</b>ID号:" + n.BuyUID + "|提交时间" + DT.FormatDate(n.AddTime, 5) + "[报价" + n.Price + "" + ub.Get("SiteBz") + "]"); } else if (n.State == 3) { builder.Append("<b>已兑换</b>ID号:" + n.BuyUID + "|提交时间" + DT.FormatDate(n.AddTime, 5) + "[报价" + n.Price + "" + ub.Get("SiteBz") + "]"); builder.Append("<br />绑定手机号:" + n.Mobile + ""); builder.Append("<br />兑换时间" + DT.FormatDate(n.PayTime, 5) + ""); builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=replyok&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[回复]</a>"); builder.Append("<a href=\"" + Utils.getUrl("sellnum.aspx?act=priceno2&id=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">[撤销]</a>"); } else { builder.Append("<b>已成交</b>ID号:" + n.BuyUID + "|提交时间" + DT.FormatDate(n.AddTime, 5) + "[报价" + n.Price + "" + ub.Get("SiteBz") + "]"); builder.Append("<br />绑定手机号:" + n.Mobile + ""); builder.Append("<br />备注:" + n.Notes + ""); builder.Append("<br />成交时间" + DT.FormatDate(n.PayTime, 5) + ""); } k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } string strText = "输入用户ID:/,"; string strName = "uid,ptype"; string strType = "num,hidden"; string strValu = "'" + ptype + ""; string strEmpt = "true,false"; string strIdea = "/"; string strOthe = "搜记录,sellnum.aspx,post,1,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">应用中心</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>"); builder.Append(Out.Tab("</div>", "<br />")); }
public override void SetDefaultValues(UnicontaBaseEntity dataEntity, int selectedIndex) { var newRow = (ProjectBudgetLineLocal)dataEntity; var lst = (IList)this.ItemsSource; if (lst == null || lst.Count == 0) { newRow._Date = BasePage.GetSystemDefaultDate().Date; } else { ProjectBudgetLineLocal last = null; ProjectBudgetLineLocal Cur = null; int n = -1; DateTime LastDateTime = DateTime.MinValue; var castItem = lst.Cast <ProjectBudgetLineLocal>(); foreach (var journalLine in castItem) { if (journalLine._Date != DateTime.MinValue && Cur == null) { LastDateTime = journalLine._Date; } n++; if (n == selectedIndex) { Cur = journalLine; } last = journalLine; } if (Cur == null) { Cur = last; } newRow._Date = LastDateTime != DateTime.MinValue ? LastDateTime : BasePage.GetSystemDefaultDate().Date; newRow._Project = last._Project; newRow._PrCategory = last._PrCategory; newRow.PrCategorySource = last.PrCategorySource; } }
protected void Page_Load(object sender, EventArgs e) { foreach (DataRow row in FileSystemObject.GetDirectoryInfos(HttpContext.Current.Server.MapPath("~/Images/ModelIcon/"), FsoMethod.File).Rows) { this.DrpItemIcon.Items.Add(new ListItem(row["name"].ToString(), row["name"].ToString())); } this.DrpItemIcon.Attributes.Add("onchange", "ChangeImgItemIcon(this.value);ChangeTxtItemIcon(this.value);"); this.TxtItemIcon.Attributes.Add("onchange", "ChangeImgItemIcon(this.value);"); if (!base.IsPostBack) { string str = BasePage.RequestString("Action", "Add"); this.ViewState["action"] = str; if (str == "Modify") { ModelInfo modelInfoById = ModelManager.GetModelInfoById(BasePage.RequestInt32("ModelID")); if (modelInfoById.IsNull) { AdminPage.WriteErrMsg("<li>模型不存在!</li>"); } this.TxtModelName.Text = modelInfoById.ModelName.ToString(); this.TxtDescription.Text = modelInfoById.Description; this.TxtItemName.Text = modelInfoById.ItemName; this.TxtItemUnit.Text = modelInfoById.ItemUnit; string selectValue = string.IsNullOrEmpty(modelInfoById.ItemIcon) ? "Default.gif" : modelInfoById.ItemIcon; this.ImgItemIcon.ImageUrl = "~/Images/ModelIcon/" + selectValue; BasePage.SetSelectedIndexByValue(this.DrpItemIcon, selectValue); this.TxtItemIcon.Text = modelInfoById.ItemIcon; this.TxtTableName.Text = modelInfoById.TableName; this.FileCTemplate.Text = modelInfoById.DefaultTemplateFile; this.TscPrintTemplate.Text = modelInfoById.PrintTemplate; this.TscSearchTemplate.Text = modelInfoById.SearchTemplate; this.TscAdvanceSearchFormTemplate.Text = modelInfoById.AdvanceSearchFormTemplate; this.TscAdvanceSearchTemplate.Text = modelInfoById.AdvanceSearchTemplate; this.TscCommentManageTemplate.Text = modelInfoById.CommentManageTemplate; this.TxtTableName.Enabled = false; this.RadioIsCountHits.SelectedValue = modelInfoById.IsCountHits.ToString(); this.RadioDisabled.SelectedValue = modelInfoById.Disabled.ToString(); this.HdnModelId.Value = modelInfoById.ModelId.ToString(); this.HdnModelName.Value = modelInfoById.ModelName; this.HdnTableName.Value = modelInfoById.TableName; this.LblTablePrefix.Visible = false; this.TxtAddInfoFilePath.Text = modelInfoById.AddInfoFilePath; this.TxtManageInfoFilePath.Text = modelInfoById.ManageInfoFilePath; this.TxtPreviewInfoFilePath.Text = modelInfoById.PreviewInfoFilePath; this.TxtBatchInfoFilePath.Text = modelInfoById.BatchInfoFilePath; this.TxtModelChargeTips.Text = modelInfoById.ChargeTips; this.RadioEnableCharge.SelectedValue = modelInfoById.EnableCharge.ToString(); this.RadioEnableSignin.SelectedValue = modelInfoById.EnableSignIn.ToString(); this.RadVote.SelectedValue = modelInfoById.EnbaleVote.ToString(); this.trModelTemmpalteId.Visible = false; this.TxtMaxPerUser.Text = modelInfoById.MaxPerUser.ToString(); } else { this.ShowFieldModelList(); } if (!SiteConfig.SiteOption.EnablePointMoneyExp) { this.EnableCharge.Style.Add("display", "none"); this.EnableChargeTips.Style.Add("display", "none"); } } }
protected void Page_Load(object sender, EventArgs e) { // lbl_benvenuto.Text = "Bentornato " + ((Anag_Utente)Session[SessionManager.UTENTE]).Nome + " " + ((Anag_Utente)Session[SessionManager.UTENTE]).Cognome; try { if (Session[SessionManager.UTENTE] != null) { Anag_Utenti utenteConnesso = (Anag_Utenti)Session[SessionManager.UTENTE]; lbl_benvenuto.Text = "Utente: " + utenteConnesso.Nome + " " + utenteConnesso.Cognome + " - Ruolo: " + utenteConnesso.tipoUtente; lblVersione.Text = BasePage.versione; lblDataVersione.Text = BasePage.dataVersione; // IMPOSTO LA VISIBILITA' DEI MENU switch (utenteConnesso.tipoUtente) { case "VISUALIZZATORE": div_ANAGRAFICHE.Visible = false; div_ARTICOLI.Visible = false; div_DOCUMENTITRASPORTO.Visible = false; div_MAGAZZINO.Visible = false; div_PROTOCOLLI.Visible = false; div_REPORT.Visible = false; div_SCADENZARIO.Visible = false; div_STATISTICHE.Visible = false; div_TABELLE.Visible = false; div_UTENTI.Visible = false; break; default: div_ANAGRAFICHE.Visible = true; div_ARTICOLI.Visible = true; div_DOCUMENTITRASPORTO.Visible = true; div_MAGAZZINO.Visible = true; div_PROTOCOLLI.Visible = true; div_REPORT.Visible = true; div_SCADENZARIO.Visible = true; div_STATISTICHE.Visible = true; div_TABELLE.Visible = true; div_UTENTI.Visible = true; break; } } else { //Session["ErrorPageText"] = "TimeOut Sessione"; BasePage b = new BasePage(); b.ShowError("TimeOut Sessione"); string url = String.Format("~/Login.aspx"); Response.Redirect(url, true); } //} } catch (Exception ex) { string eccezione = "Site.Master.cs - Page_Load " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace; //Session["ErrorPageText"] = eccezione; //string url = String.Format("~/pageError.aspx"); //Response.Redirect(url, true); //BasePage b = new BasePage(); //b.ShowError("TimeOut Sessione"); string url = String.Format("~/Login.aspx"); Response.Redirect(url, true); } }
protected void Page_Load(object sender, EventArgs e) { Master.Title = "推荐注册排行榜"; int meid = new BCW.User.Users().GetUsId(); int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[0-2]\d*$", "0")); int Year = int.Parse(Utils.GetRequest("Year", "get", 1, @"^(?:19[3-9]\d|20[01]\d)$", "0")); int Month = int.Parse(Utils.GetRequest("Month", "get", 1, @"^(?:[0]?[1-9]|1[012])$", "0")); if (Year < 2010) Year = 0; builder.Append(Out.Tab("<div class=\"title\">", "")); if (Year == 0 || Month == 0) { if (ptype == 0) builder.Append("总榜|"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?backurl=" + Utils.getPage(0) + "") + "\">总榜</a>|"); if (ptype == 1) builder.Append("本月|"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?ptype=1&backurl=" + Utils.getPage(0) + "") + "\">本月</a>|"); if (ptype == 2) builder.Append("上月"); else builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?ptype=2&backurl=" + Utils.getPage(0) + "") + "\">上月</a>"); } else { builder.Append("<a href=\"" + Utils.getPage("recomuser.aspx?backurl=" + Utils.getPage(0) + "") + "\">总榜</a>|" + Year + "年" + Month + "月"); ptype = 3; } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = 20;// Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = ""; string[] pageValUrl = {"ptype", "Year", "Month", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) pageIndex = 1; //查询条件 if (ptype == 1) strWhere = "Year(RegTime)=" + DateTime.Now.Year + " and Month(RegTime)=" + DateTime.Now.Month + " and "; else if (ptype == 2) { DateTime ForDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToShortDateString()); int ForYear = ForDate.Year; int ForMonth = ForDate.Month; strWhere = "Year(RegTime) = " + (ForYear) + " AND Month(RegTime) = " + (ForMonth) + " and "; } else if (ptype == 3) strWhere = "(Year(RegTime) = " + Year + ") AND (Month(RegTime) = " + Month + ") and "; strWhere += "InviteNum>0 and IsVerify=1"; // 开始读取列表 IList<BCW.Model.User> listUser = new BCW.BLL.User().GetInvites(pageIndex, pageSize, strWhere, out recordCount); if (listUser.Count > 0) { int k = 1; foreach (BCW.Model.User n in listUser) { if (k % 2 == 0) builder.Append(Out.Tab("<div class=\"text\">", "<br />")); else { if (k == 1) builder.Append(Out.Tab("<div>", "")); else builder.Append(Out.Tab("<div>", "<br />")); } builder.Append("<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + BCW.User.Users.SetUser(n.ID) + "(" + n.InviteNum + "人)</a>"); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } if (pageIndex == 1) { builder.Append(Out.Tab("<div class=\"text\">", Out.Hr())); builder.Append("按月份查询:"); builder.Append(Out.Tab("</div>", "<br />")); string strText = "年,月:,"; string strName = "Year,Month,backurl"; string strType = "snum,snum,hidden"; string strValu = "" + DateTime.Now.Year + "'" + DateTime.Now.Month + "'" + Utils.getPage(0) + ""; string strEmpt = "true,true,false"; string strIdea = ""; string strOthe = "查询,recomuser.aspx,get,3,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); if (meid > 0) { builder.Append(Out.Tab("<div>", "<br />")); builder.Append("您的推荐地址:<br /><a href=\"http://" + Utils.GetDomain() + "/reg-" + meid + ".aspx\">http://" + Utils.GetDomain() + "/reg-" + meid + ".aspx</a>"); builder.Append(Out.Tab("</div>", "")); } } builder.Append(Out.Tab("<div class=\"title\">", Out.Hr())); builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-"); builder.Append("<a href=\"" + Utils.getPage("uinfo.aspx") + "\">上级</a>"); builder.Append(Out.Tab("</div>", "")); }
public void BasePage_Update() { var data = new byte[Constants.PAGE_SIZE]; var buffer = new PageBuffer(data, 0, 0); // mark buffer as writable (debug propose) buffer.ShareCounter = Constants.BUFFER_WRITABLE; var page = new BasePage(buffer, 1, PageType.Empty); page.Insert(100, out var index0).Fill(101); page.Insert(200, out var index1).Fill(102); page.Insert(300, out var index2).Fill(103); page.Insert(400, out var index3).Fill(104); page.FragmentedBytes.Should().Be(0); page.UsedBytes.Should().Be(1000); page.NextFreePosition.Should().Be(32 + 1000); // update same segment length page.Update(index0, 100).Fill(201); page.Get(index0).All(201).Should().BeTrue(); page.FragmentedBytes.Should().Be(0); page.UsedBytes.Should().Be(1000); page.NextFreePosition.Should().Be(32 + 1000); // less bytes (segment in middle of page) page.Update(index1, 150).Fill(202); page.Get(index1).All(202).Should().BeTrue(); page.FragmentedBytes.Should().Be(50); page.UsedBytes.Should().Be(950); page.NextFreePosition.Should().Be(32 + 1000); // less bytes (segment in end of page) page.Update(index3, 350).Fill(204); page.Get(index3).All(204).Should().BeTrue(); page.FragmentedBytes.Should().Be(50); page.UsedBytes.Should().Be(900); page.NextFreePosition.Should().Be(32 + 950); // more bytes (segment in end of page) page.Update(index3, 550).Fill(214); page.Get(index3).All(214).Should().BeTrue(); page.FragmentedBytes.Should().Be(50); page.UsedBytes.Should().Be(1100); page.NextFreePosition.Should().Be(32 + 1150); // more bytes (segment in middle of page) page.Update(index0, 200).Fill(211); page.Get(index0).All(211).Should().BeTrue(); page.FragmentedBytes.Should().Be(150); page.UsedBytes.Should().Be(1200); page.NextFreePosition.Should().Be(32 + 1350); buffer.ShareCounter = 0; }
public static CodeTorch.Web.FieldTemplates.BaseFieldTemplate FindFieldRecursive(BasePage page, Control container, string id) { CodeTorch.Web.FieldTemplates.BaseFieldTemplate retVal = null; ControlCollection controls = null; if (container == null) { controls = page.Controls; } else { controls = container.Controls; } foreach (Control c in controls) { if ((c.ID != null) && (c.ID.ToLower() == id.ToLower())) { if (c is CodeTorch.Web.FieldTemplates.BaseFieldTemplate) { retVal = (CodeTorch.Web.FieldTemplates.BaseFieldTemplate)c; return(retVal); } } else { if (c.HasControls()) { Control child = FindControlRecursive(c, id); if (child != null) { if (child is CodeTorch.Web.FieldTemplates.BaseFieldTemplate) { retVal = (CodeTorch.Web.FieldTemplates.BaseFieldTemplate)child; return(retVal); } } } } } return(retVal); }
public static void DataContactActionView(BasePage page, Contact targetContact, List <CustomField> data, List <ContactInfo> networks) { var tags = targetContact != null?Global.DaoFactory.GetTagDao().GetEntityTags(EntityType.Contact, targetContact.ID) : new string[] { }; var availableTags = Global.DaoFactory.GetTagDao().GetAllTags(EntityType.Contact).Where(item => !tags.Contains(item)); String json; using (var stream = new MemoryStream()) { var serializer = new DataContractJsonSerializer(data.GetType()); serializer.WriteObject(stream, data); json = Encoding.UTF8.GetString(stream.ToArray()); } var listItems = Global.DaoFactory.GetListItemDao().GetItems(ListType.ContactType); var presetCompanyForPersonJson = ""; if (targetContact != null && targetContact is Person && ((Person)targetContact).CompanyID > 0) { var company = Global.DaoFactory.GetContactDao().GetByID(((Person)targetContact).CompanyID); if (company == null) { log4net.LogManager.GetLogger("ASC.CRM").ErrorFormat("Can't find parent company (CompanyID = {0}) for person with ID = {1}", ((Person)targetContact).CompanyID, targetContact.ID); } else { presetCompanyForPersonJson = JsonConvert.SerializeObject(new { id = company.ID, displayName = company.GetTitle().HtmlEncode().ReplaceSingleQuote().Replace(@"\", @"\\"), smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(company.ID, true) }); } } var presetPersonsForCompanyJson = ""; if (targetContact != null && targetContact is Company) { var people = Global.DaoFactory.GetContactDao().GetMembers(targetContact.ID); if (people.Count != 0) { presetPersonsForCompanyJson = JsonConvert.SerializeObject(people.ConvertAll(item => new { id = item.ID, displayName = item.GetTitle().HtmlEncode().ReplaceSingleQuote().Replace(@"\", @"\\"), smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(item.ID, false) })); } } var script = String.Format(@" var customFieldList = {0}; var contactNetworks = {1}; var contactActionTags = {2}; var contactActionAvailableTags = {3}; var contactAvailableTypes = {4}; var presetCompanyForPersonJson = '{5}'; var presetPersonsForCompanyJson = '{6}'; var facebokSearchEnabled = {7}; var linkedinSearchEnabled = {8}; var twitterSearchEnabled = {9}; var contactActionCurrencies = {10}; var countryListExt = {11}; var currentCultureName = '{12}'; ", json, JsonConvert.SerializeObject(networks), JsonConvert.SerializeObject(tags.ToList().ConvertAll(t => t.HtmlEncode())), JsonConvert.SerializeObject(availableTags.ToList().ConvertAll(t => t.HtmlEncode())), JsonConvert.SerializeObject( listItems.ConvertAll(n => new { id = n.ID, title = n.Title.HtmlEncode() })), presetCompanyForPersonJson, presetPersonsForCompanyJson, IsFacebookSearchEnabled.ToString().ToLower(), IsLinkedInSearchEnabled.ToString().ToLower(), IsTwitterSearchEnabled.ToString().ToLower(), JsonConvert.SerializeObject(CurrencyProvider.GetAll()), JsonConvert.SerializeObject(Global.GetCountryListExt()), new RegionInfo(CultureInfo.CurrentCulture.Name).EnglishName ); page.RegisterInlineScript(script, onReady: false); }
public static void DataDealActionView(BasePage page, Deal targetDeal) { var customFieldList = targetDeal != null ? Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Opportunity, targetDeal.ID, true) : Global.DaoFactory.GetCustomFieldDao().GetFieldsDescription(EntityType.Opportunity); var dealExcludedIDs = new List <Int32>(); var dealClientIDs = new List <Int32>(); var dealMembersIDs = new List <Int32>(); if (targetDeal != null) { dealExcludedIDs = Global.DaoFactory.GetDealDao().GetMembers(targetDeal.ID).ToList(); dealMembersIDs = new List <int>(dealExcludedIDs); if (targetDeal.ContactID != 0) { dealMembersIDs.Remove(targetDeal.ContactID); dealClientIDs.Add(targetDeal.ContactID); } } var presetClientContactsJson = ""; var presetMemberContactsJson = ""; var showMembersPanel = false; var selectedContacts = new List <Contact>(); var hasTargetClient = false; if (targetDeal != null && targetDeal.ContactID != 0) { var contact = Global.DaoFactory.GetContactDao().GetByID(targetDeal.ContactID); if (contact != null) { selectedContacts.Add(contact); } } else { var URLContactID = UrlParameters.ContactID; if (URLContactID != 0) { var target = Global.DaoFactory.GetContactDao().GetByID(URLContactID); if (target != null) { selectedContacts.Add(target); hasTargetClient = true; } } } if (selectedContacts.Count > 0) { presetClientContactsJson = JsonConvert.SerializeObject(selectedContacts.ConvertAll(item => new { id = item.ID, displayName = item.GetTitle().HtmlEncode().ReplaceSingleQuote().Replace(@"\", @"\\"), smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(item.ID, item is Company) })); } selectedContacts = new List <Contact>(); selectedContacts.AddRange(Global.DaoFactory.GetContactDao().GetContacts(dealMembersIDs.ToArray())); if (selectedContacts.Count > 0) { showMembersPanel = true; presetMemberContactsJson = JsonConvert.SerializeObject(selectedContacts.ConvertAll(item => new { id = item.ID, displayName = item.GetTitle().HtmlEncode().ReplaceSingleQuote().Replace(@"\", @"\\"), smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(item.ID, item is Company) })); } var ResponsibleSelectedUserId = targetDeal == null ? SecurityContext.CurrentAccount.ID : (targetDeal.ResponsibleID != Guid.Empty ? targetDeal.ResponsibleID : Guid.Empty); var script = String.Format(@" var presetClientContactsJson = '{0}'; var presetMemberContactsJson = '{1}'; var hasDealTargetClient = {2}; var showMembersPanel = {3}; var dealClientIDs = {4}; var dealMembersIDs = {5}; var responsibleId = '{6}'; ", presetClientContactsJson, presetMemberContactsJson, hasTargetClient.ToString().ToLower(), showMembersPanel.ToString().ToLower(), JsonConvert.SerializeObject(dealClientIDs), JsonConvert.SerializeObject(dealMembersIDs), ResponsibleSelectedUserId ); page.RegisterInlineScript(script, onReady: false); page.JsonPublisher(customFieldList, "customFieldList"); page.JsonPublisher(Global.DaoFactory.GetDealMilestoneDao().GetAll(), "dealMilestones"); if (targetDeal != null) { page.JsonPublisher(targetDeal, "targetDeal"); } }
public static void DataContactFullCardView(BasePage page, Contact targetContact) { List <CustomField> data; if (targetContact is Company) { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Company, targetContact.ID, false); } else { data = Global.DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Person, targetContact.ID, false); } var networks = Global.DaoFactory.GetContactInfoDao().GetList(targetContact.ID, null, null, null).ConvertAll( n => new { data = n.Data.HtmlEncode(), infoType = n.InfoType, isPrimary = n.IsPrimary, categoryName = n.CategoryToString(), infoTypeLocalName = n.InfoType.ToLocalizedString() }); String json; using (var stream = new MemoryStream()) { var serializer = new DataContractJsonSerializer(data.GetType()); serializer.WriteObject(stream, data); json = Encoding.UTF8.GetString(stream.ToArray()); } var listItems = Global.DaoFactory.GetListItemDao().GetItems(ListType.ContactStatus); var tags = Global.DaoFactory.GetTagDao().GetEntityTags(EntityType.Contact, targetContact.ID); var availableTags = Global.DaoFactory.GetTagDao().GetAllTags(EntityType.Contact).Where(item => !tags.Contains(item)); var responsibleIDs = CRMSecurity.GetAccessSubjectGuidsTo(targetContact); var script = String.Format(@" var customFieldList = {0}; var contactNetworks = {1}; var sliderListItems = {2}; var contactTags = {3}; var contactAvailableTags = {4}; var contactResponsibleIDs = {5}; ", json, JsonConvert.SerializeObject(networks), JsonConvert.SerializeObject(new { id = targetContact.ID, status = targetContact.StatusID, positionsCount = listItems.Count, items = listItems.ConvertAll(n => new { id = n.ID, color = n.Color, title = n.Title.HtmlEncode() }) }), JsonConvert.SerializeObject(tags.ToList().ConvertAll(t => t.HtmlEncode())), JsonConvert.SerializeObject(availableTags.ToList().ConvertAll(t => t.HtmlEncode())), JsonConvert.SerializeObject(responsibleIDs) ); page.RegisterInlineScript(script, onReady: false); }
public void GivenUserOpensPage(string url) { basePage = new BasePage(driver); homePage = basePage.GetHomePage(); homePage.OpenHomePage(url); }
public override void SetDefaultValues(UnicontaBaseEntity dataEntity, int selectedIndex) { var newRow = (ProjectJournalLineLocal)dataEntity; var header = this.masterRecord as Uniconta.DataModel.PrJournal; if (header != null) { newRow.SetMaster(header); newRow._Dim1 = header._Dim1; newRow._Dim2 = header._Dim2; newRow._Dim3 = header._Dim3; newRow._Dim4 = header._Dim4; newRow._Dim5 = header._Dim5; newRow._Employee = header._Employee; newRow._TransType = header._TransType; } var lst = (IList)this.ItemsSource; if (lst == null || lst.Count == 0) { newRow._Date = BasePage.GetSystemDefaultDate().Date; } else { ProjectJournalLineLocal last = null; ProjectJournalLineLocal Cur = null; int n = -1; DateTime LastDateTime = DateTime.MinValue; var castItem = lst as IEnumerable <ProjectJournalLineLocal>; foreach (var journalLine in castItem) { if (journalLine._Date != DateTime.MinValue && Cur == null) { LastDateTime = journalLine._Date; } n++; if (n == selectedIndex) { Cur = journalLine; } last = journalLine; } if (Cur == null) { Cur = last; } newRow._Date = LastDateTime != DateTime.MinValue ? LastDateTime : BasePage.GetSystemDefaultDate().Date; newRow._Project = last._Project; newRow._PrCategory = last._PrCategory; newRow._Invoiceable = last._Invoiceable; newRow.PrCategorySource = last.PrCategorySource; } }
protected void btn_ViewDesignationDetails_Click(object sender, EventArgs e) { multiView_DesignationDetails.SetActiveView(view_GridView); BindGridView(); BasePage.ShowHidePagePermissions(gview_Designation, btn_AddDesignation, this.Page); }
public override void OnInitTemplateInfo(EventArgs e) { TemplateInfo info = new TemplateInfo(); int num = BasePage.RequestInt32("searchtype"); string str = DataSecurity.FilterBadChar(base.Request.QueryString["keyword"]); int modelId = BasePage.RequestInt32("ModelId"); string dynamicConfigTemplatePath = ""; NameValueCollection queryString = new NameValueCollection(); switch (num) { case 0: if (!string.IsNullOrEmpty(str)) { this.SaveKeyword(str); } queryString = base.Request.QueryString; dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath("Search"); break; case 1: if ((DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]) == "keyword") && !string.IsNullOrEmpty(str)) { this.SaveKeyword(str); } queryString = base.Request.QueryString; dynamicConfigTemplatePath = this.GetTemplateFile(modelId); break; case 2: if (BasePage.RequestInt32("showtype") != 1) { dynamicConfigTemplatePath = this.GetAdvanceTemplateForm(modelId); break; } queryString = base.Request.QueryString; dynamicConfigTemplatePath = this.GetAdvanceTemplateFile(modelId); break; case 3: { string[] strArray = DataSecurity.FilterBadChar(base.Request.QueryString["specialid"]).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); int specialid = DataConverter.CLng(strArray[1]); int specialcategoryid = DataConverter.CLng(strArray[0]); queryString.Add("specialid", specialid.ToString()); queryString.Add("specialcategoryid", specialcategoryid.ToString()); string str5 = DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]); queryString.Add("fieldoption", str5); if ((str5 == "keyword") && !string.IsNullOrEmpty(str)) { this.SaveKeyword(str); } queryString.Add("keyword", str); dynamicConfigTemplatePath = this.GetSpecialTemplate(specialid, specialcategoryid); break; } default: queryString = base.Request.QueryString; if (!string.IsNullOrEmpty(str)) { this.SaveKeyword(str); } dynamicConfigTemplatePath = this.GetTemplatePath("Search"); break; } if (!string.IsNullOrEmpty(dynamicConfigTemplatePath)) { info.QueryList = queryString; info.PageName = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString); info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath); info.RootPath = HttpContext.Current.Request.PhysicalApplicationPath; info.CurrentPage = DataConverter.CLng(base.Request.QueryString["page"], 1); info.IsDynamicPage = true; info.PageType = 1; base.TemplateInfo = info; } else { TemplatePage.WriteErrMsg("全站搜索结果页未设置模板!", "Default.aspx"); } }
/// <summary> /// Gets the filename of the page template. /// </summary> /// <remarks> /// If the PageTypeCategory of the specified <see cref="Page"/> /> /// </remarks> /// <param name="page">The page.</param> /// <returns></returns> private string GetTemplateFileName(BasePage page) { string templateFileName; if (CurrentPage.PageType.PageTypeCategory == PageTypeCategories.PRODUCT_CATALOG) { var state = new WebControlState(this); var product = state.ProductCatalog.CurrentProduct; templateFileName = product == null ? System.IO.Path.GetFileNameWithoutExtension(state.ProductCatalog.CurrentProductGroup.Template.DisplayTemplate.FileName) : System.IO.Path.GetFileNameWithoutExtension(state.ProductCatalog.GetCurrentProductArticle(product).Template.DisplayTemplate.FileName); } else { templateFileName = System.IO.Path.GetFileNameWithoutExtension(page.Template.FileName); } return templateFileName; }
public static object GetParameterInputValue(BasePage page, IScreenParameter parameter, Control container) { object retVal = null; App app = CodeTorch.Core.Configuration.GetInstance().App; CodeTorch.Web.FieldTemplates.BaseFieldTemplate f = null; switch (parameter.InputType) { case ScreenInputType.AppSetting: retVal = ConfigurationManager.AppSettings[parameter.InputKey]; break; case ScreenInputType.Control: if (container == null) { f = page.FindFieldRecursive(parameter.InputKey); } else { f = page.FindFieldRecursive(container, parameter.InputKey); } if (f != null) { retVal = f.Value; } break; case ScreenInputType.ControlText: if (container == null) { f = page.FindFieldRecursive(parameter.InputKey); } else { f = page.FindFieldRecursive(container, parameter.InputKey); } if (f != null) { retVal = f.DisplayText; } break; case ScreenInputType.Cookie: retVal = page.Request.Cookies[parameter.InputKey].Value; break; case ScreenInputType.Form: retVal = page.Request.Form[parameter.InputKey]; break; case ScreenInputType.Header: retVal = page.Request.Headers[parameter.InputKey]; break; case ScreenInputType.QueryString: retVal = page.Request.QueryString[parameter.InputKey]; break; case ScreenInputType.Session: retVal = page.Session[parameter.InputKey]; break; case ScreenInputType.Special: switch (parameter.InputKey.ToLower()) { case "null": retVal = null; break; case "dbnull": retVal = DBNull.Value; break; case "username": retVal = UserIdentityService.GetInstance().IdentityProvider.GetUserName(); break; case "hostheader": retVal = HttpContext.Current.Request.ServerVariables["HTTP_HOST"]; break; case "applicationpath": retVal = HttpContext.Current.Request.ApplicationPath; break; case "absoluteapplicationpath": retVal = String.Format("{0}://{1}{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.ServerVariables["HTTP_HOST"], ((HttpContext.Current.Request.ApplicationPath == "/") ? String.Empty : HttpContext.Current.Request.ApplicationPath)); break; } break; case ScreenInputType.User: try { retVal = GetProfileProperty(parameter.InputKey); } catch { } break; case ScreenInputType.Constant: retVal = parameter.InputKey; break; case ScreenInputType.ServerVariables: retVal = HttpContext.Current.Request.ServerVariables[parameter.InputKey]; break; } if (parameter.InputType != ScreenInputType.Special) { if (retVal == null) { retVal = parameter.Default; } } return(retVal); }
protected void Page_Load(object sender, EventArgs e) { this.m_GeneralId = BasePage.RequestInt32("GeneralID"); this.InitPage(); }
private void TopPage() { Master.Title = "社区统计"; int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[1-4]$", "1")); int showtype = int.Parse(Utils.GetRequest("showtype", "get", 1, @"^[0-1]$", "0")); int p = int.Parse(Utils.GetRequest("p", "get", 1, @"^[0-1]$", "0")); builder.Append(Out.Tab("<div class=\"title\">", "")); if (ptype == 1) { builder.Append(ub.Get("SiteBz") + "排行榜"); } else if (ptype == 2) { builder.Append("银行" + ub.Get("SiteBz") + "排行榜"); } else if (ptype == 3) { builder.Append(ub.Get("SiteBz2") + "排行榜"); } else if (ptype == 4) { builder.Append("积分排行榜"); } builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div>", "")); if (showtype == 0) { builder.Append("主号排行|"); } else { builder.Append("<a href=\"" + Utils.getUrl("bbsstat.aspx?act=top&ptype=" + ptype + "&showtype=0") + "\">主号排行</a>|"); } if (showtype == 1) { builder.Append("机器排行"); } else { builder.Append("<a href=\"" + Utils.getUrl("bbsstat.aspx?act=top&ptype=" + ptype + "&showtype=1") + "\">机器排行</a>"); } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = string.Empty; string strOrder = string.Empty; string[] pageValUrl = { "act", "ptype", "p", "showtype", "backurl" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } //查询条件 if (showtype == 0) { strWhere = "IsSpier=0"; } else { strWhere = "IsSpier=1"; } string sr = ""; if (p == 0) { sr = " Desc"; } else { sr = " Asc"; } if (ptype == 1) { strOrder = "iGold" + sr + ""; } else if (ptype == 2) { strOrder = "iBank" + sr + ""; } else if (ptype == 3) { strOrder = "iMoney" + sr + ""; } else if (ptype == 4) { strOrder = "iScore" + sr + ""; } // 开始读取列表 IList <BCW.Model.User> listUser = new BCW.BLL.User().GetUsers(pageIndex, pageSize, strWhere, strOrder, out recordCount); if (listUser.Count > 0) { int k = 1; foreach (BCW.Model.User n in listUser) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } string OutText = string.Empty; if (ptype == 1) { OutText = "(" + Utils.ConvertGold(n.iGold) + "" + ub.Get("SiteBz") + ")"; } else if (ptype == 2) { OutText = "(" + Utils.ConvertGold(n.iBank) + "" + ub.Get("SiteBz") + ")"; } else if (ptype == 3) { OutText = "(" + ub.Get("SiteBz2") + "" + n.iMoney + ")"; } else if (ptype == 4) { OutText = "(积分" + n.iScore + ")"; } builder.Append("<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.ID + "&backurl=" + Utils.PostPage(1) + "") + "\">" + ((pageIndex - 1) * pageSize + k) + "." + n.UsName + "" + OutText + "</a>"); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } builder.Append(Out.Tab("<div>", "<br />")); builder.Append("排序:"); if (p == 0) { builder.Append("倒序|"); } else { builder.Append("<a href=\"" + Utils.getUrl("bbsstat.aspx?act=top&ptype=" + ptype + "&showtype=" + showtype + "&p=0") + "\">倒序</a>|"); } if (p == 1) { builder.Append("正序"); } else { builder.Append("<a href=\"" + Utils.getUrl("bbsstat.aspx?act=top&ptype=" + ptype + "&showtype=" + showtype + "&p=1") + "\">正序</a>"); } builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("bbsstat.aspx") + "\">返回上一级</a>"); builder.Append(Out.Tab("</div>", "<br />")); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"); builder.Append(Out.Tab("</div>", "<br />")); }
private void user_point_convert(HttpContext context) { //检查系统是否启用兑换积分功能 if (userConfig.pointcashrate == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,网站已关闭兑换积分功能!\"}"); return; } //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } int amout = DTRequest.GetFormInt("txtAmount"); string password = DTRequest.GetFormString("txtPassword"); if (model.amount < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您账户上的余额不足!\"}"); return; } if (amout < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,最小兑换金额为1元!\"}"); return; } if (amout > model.amount) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您兑换的金额大于账户余额!\"}"); return; } if (password == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入您账户的密码!\"}"); return; } //验证密码 if (DESEncrypt.Encrypt(password) != model.password) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您输入的密码不正确!\"}"); return; } //计算兑换后的积分值 int convertPoint = (int)(Convert.ToDecimal(amout) * userConfig.pointcashrate); //扣除金额 int amountNewId = new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.Convert.ToString(), amout * -1, "用户兑换积分", 1); //增加积分 if (amountNewId < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"转换过程中发生错误,请重新提交!\"}"); return; } int pointNewId = new BLL.point_log().Add(model.id, model.user_name, convertPoint, "用户兑换积分"); if (pointNewId < 1) { //返还金额 new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.Convert.ToString(), amout, "用户兑换积分失败,返还金额", 1); context.Response.Write("{\"msg\":0, \"msgbox\":\"转换过程中发生错误,请重新提交!\"}"); return; } context.Response.Write("{\"msg\":1, \"msgbox\":\"恭喜您,积分兑换成功啦!\"}"); return; }
public void BasePage_Delete_Full() { var data = new byte[Constants.PAGE_SIZE]; var buffer = new PageBuffer(data, 0, 0); // mark buffer as writable (debug propose) buffer.ShareCounter = Constants.BUFFER_WRITABLE; // create new base page var page = new BasePage(buffer, 1, PageType.Empty); var seg0 = page.Insert(100, out var index0); var seg1 = page.Insert(200, out var index1); var seg2 = page.Insert(8192 - 32 - (100 + 200 + 8) - 4, out var index2); // 7848 seg0.Fill(10); seg1.Fill(11); seg2.Fill(12); page.HighestIndex.Should().Be(2); page.ItemsCount.Should().Be(3); page.UsedBytes.Should().Be(8148); page.NextFreePosition.Should().Be(8180); // no next free position page.FreeBytes.Should().Be(0); // full used page.FragmentedBytes.Should().Be(0); // deleting 200b (end of page) page.Delete(index1); page.HighestIndex.Should().Be(2); page.ItemsCount.Should().Be(2); page.UsedBytes.Should().Be(8148 - 200); page.NextFreePosition.Should().Be(8180); page.FreeBytes.Should().Be(200); page.FragmentedBytes.Should().Be(200); page.Delete(index0); page.HighestIndex.Should().Be(2); page.ItemsCount.Should().Be(1); page.UsedBytes.Should().Be(8148 - 200 - 100); page.NextFreePosition.Should().Be(8180); page.FreeBytes.Should().Be(300); page.FragmentedBytes.Should().Be(300); var seg3 = page.Insert(250, out var index3); seg3.Fill(13); page.HighestIndex.Should().Be(2); page.ItemsCount.Should().Be(2); page.UsedBytes.Should().Be(8148 - 200 - 100 + 250); page.NextFreePosition.Should().Be(8180 - 50); page.FreeBytes.Should().Be(50); page.FragmentedBytes.Should().Be(0); var seg3f = page.Get(index3); seg3f.All(13).Should().BeTrue(); buffer.ShareCounter = 0; }
protected void EBtnAdd_Click(object sender, EventArgs e) { BasePage.ResponseRedirect("Source.aspx"); }
private void order_save(HttpContext context) { int payment_id = DTRequest.GetFormInt("payment_id"); int distribution_id = DTRequest.GetFormInt("distribution_id"); string accept_name = DTRequest.GetFormString("accept_name"); string post_code = DTRequest.GetFormString("post_code"); string telphone = DTRequest.GetFormString("telphone"); string mobile = DTRequest.GetFormString("mobile"); string address = DTRequest.GetFormString("address"); string message = DTRequest.GetFormString("message"); //检查配送方式 if (distribution_id == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择配送方式!\"}"); return; } Model.distribution disModel = new BLL.distribution().GetModel(distribution_id); if (disModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的配送方式不存在或已删除!\"}"); return; } //检查支付方式 if (payment_id == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择支付方式!\"}"); return; } Model.payment payModel = new BLL.payment().GetModel(payment_id); if (payModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的支付方式不存在或已删除!\"}"); return; } //检查收货人 if (string.IsNullOrEmpty(accept_name)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人姓名!\"}"); return; } //检查手机和电话 if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人联系电话或手机!\"}"); return; } //检查地址 if (string.IsNullOrEmpty(address)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入详细的收货地址!\"}"); return; } //检查用户是否登录 Model.users userModel = new BasePage().GetUserInfo(); if (userModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } //检查购物车商品 IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(userModel.group_id); if (iList == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,购物车为空,无法结算!\"}"); return; } //统计购物车 Model.cart_total cartModel = DTcms.Web.UI.ShopCart.GetTotal(userModel.group_id); //保存订单======================================================================= Model.orders model = new Model.orders(); model.order_no = Utils.GetOrderNumber(); //订单号 model.user_id = userModel.id; model.user_name = userModel.user_name; model.payment_id = payment_id; model.distribution_id = distribution_id; model.accept_name = accept_name; model.post_code = post_code; model.telphone = telphone; model.mobile = mobile; model.address = address; model.message = message; model.payable_amount = cartModel.payable_amount; model.real_amount = cartModel.real_amount; model.payable_freight = disModel.amount; //应付运费 model.real_freight = disModel.amount; //实付运费 //如果是先款后货的话 if (payModel.type == 1) { if (payModel.poundage_type == 1) //百分比 { model.payment_fee = model.real_amount * payModel.poundage_amount / 100; } else //固定金额 { model.payment_fee = payModel.poundage_amount; } } //订单总金额=实付商品金额+运费+支付手续费 model.order_amount = model.real_amount + model.real_freight + model.payment_fee; //购物积分,可为负数 model.point = cartModel.total_point; model.add_time = DateTime.Now; //商品详细列表 List<Model.order_goods> gls = new List<Model.order_goods>(); foreach (Model.cart_items item in iList) { gls.Add(new Model.order_goods { goods_id = item.id, goods_name = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point }); } model.order_goods = gls; int result = new BLL.orders().Add(model); if (result < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"订单保存过程中发生错误,请重新提交!\"}"); return; } //扣除积分 if (model.point < 0) { new BLL.point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no); } //清空购物车 DTcms.Web.UI.ShopCart.Clear("0"); //提交成功,返回URL context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("payment1", "confirm", DTEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_no) + "\", \"msgbox\":\"恭喜您,订单已成功提交!\"}"); return; }
private void user_avatar_crop(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } string fileName = DTRequest.GetFormString("hideFileName"); int x1 = DTRequest.GetFormInt("hideX1"); int y1 = DTRequest.GetFormInt("hideY1"); int w = DTRequest.GetFormInt("hideWidth"); int h = DTRequest.GetFormInt("hideHeight"); //检查是否图片 //检查参数 if (!Utils.FileExists(fileName) || w == 0 || h == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请先上传一张图片!\"}"); return; } //取得保存的新文件名 UpLoad upFiles = new UpLoad(); bool result = upFiles.cropSaveAs(fileName, fileName, 180, 180, w, h, x1, y1); if (!result) { context.Response.Write("{\"msg\": 0, \"msgbox\": \"图片裁剪过程中发生意外错误!\"}"); return; } //删除原用户头像 Utils.DeleteFile(model.avatar); model.avatar = fileName; //修改用户头像 new BLL.users().UpdateField(model.id, "avatar='" + model.avatar + "'"); context.Response.Write("{\"msg\": 1, \"msgbox\": \"" + model.avatar + "\"}"); return; }
private void user_invite_code(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } //检查是否开启邀请注册 if (userConfig.regstatus != 2) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,系统不允许通过邀请注册!\"}"); return; } BLL.user_code codeBll = new BLL.user_code(); //检查申请是否超过限制 if (userConfig.invitecodenum > 0) { int result = codeBll.GetCount("user_name='" + model.user_name + "' and type='" + DTEnums.CodeEnum.Register.ToString() + "' and datediff(d,add_time,getdate())=0"); if (result >= userConfig.invitecodenum) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您申请的邀请码数量已超过每天的限制!\"}"); return; } } //删除过期的邀请码 codeBll.Delete("type='" + DTEnums.CodeEnum.Register.ToString() + "' and status=1 or datediff(d,eff_time,getdate())>0"); //随机取得邀请码 string str_code = Utils.GetCheckCode(8); Model.user_code codeModel = new Model.user_code(); codeModel.user_id = model.id; codeModel.user_name = model.user_name; codeModel.type = DTEnums.CodeEnum.Register.ToString(); codeModel.str_code = str_code; if (userConfig.invitecodeexpired > 0) { codeModel.eff_time = DateTime.Now.AddDays(userConfig.invitecodeexpired); } codeBll.Add(codeModel); context.Response.Write("{\"msg\":1, \"msgbox\":\"恭喜您,申请邀请码已成功!\"}"); return; }
protected void Page_Load(object sender, EventArgs e) { currentPage = Page as BasePage; }
private void user_message_delete(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } string check_id = DTRequest.GetFormString("checkId"); if (check_id == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"删除失败,请检查传输参数!\"}"); return; } string[] arrId = check_id.Split(','); for (int i = 0; i < arrId.Length; i++) { new BLL.user_message().Delete(int.Parse(arrId[i]), model.user_name); } context.Response.Write("{\"msg\":1, \"msgbox\":\"删除短信息成功啦!\"}"); return; }
/// <summary> /// 更新文档 /// </summary> public void Update_GET() { object data; int archiveId = int.Parse(base.Request["archive.id"]); string tpls, nodesHtml, //栏目JSON extendFieldsHtml = ""; //属性Html Module module; int siteId = this.CurrentSite.SiteId; ArchiveDto archive = ServiceCall.Instance.ArchiveService.GetArchiveById(siteId, archiveId); int categoryId = archive.Category.ID; //============= 拼接模块的属性值 ==============// StringBuilder sb = new StringBuilder(50); string attrValue; IExtendField field; sb.Append("<div class=\"dataextend_item\">"); foreach (IExtendValue extValue in archive.ExtendValues) { field = extValue.Field; attrValue = (extValue.Value ?? field.DefaultValue).Replace("<br />", "\n"); this.AppendExtendFormHtml(sb, field, attrValue); } sb.Append("</div>"); extendFieldsHtml = sb.ToString(); //获取模板视图下拉项 StringBuilder sb2 = new StringBuilder(); //模板目录 DirectoryInfo dir = new DirectoryInfo( String.Format("{0}templates/{1}", AppDomain.CurrentDomain.BaseDirectory, base.CurrentSite.Tpl + "/" )); IDictionary <String, String> names = Cms.TemplateManager.Get(base.CurrentSite.Tpl).GetNameDictionary(); EachClass.EachTemplatePage(dir, dir, sb2, names, TemplatePageType.Custom, TemplatePageType.Archive ); tpls = sb2.ToString(); nodesHtml = Helper.GetCategoryIdSelector(this.SiteId, categoryId); string thumbnail = !String.IsNullOrEmpty(archive.Thumbnail) ? archive.Thumbnail : "/" + CmsVariables.FRAMEWORK_ARCHIVE_NoPhoto; object json = new { //IsSpecial = flags.ContainsKey(ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.IsSpecial)) // && flags[ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.IsSpecial)], //IsSystem = flags.ContainsKey(ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.IsSystem)) // && flags[ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.IsSystem)], //IsNotVisible = !(flags.ContainsKey(ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.Visible)) // && flags[ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.Visible)]), //AsPage = flags.ContainsKey(ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.AsPage)) // && flags[ArchiveFlag.GetInternalFlagKey(BuiltInArchiveFlags.AsPage)], IsSpecial = this.FlagAnd(archive.Flag, BuiltInArchiveFlags.IsSpecial), IsSystem = this.FlagAnd(archive.Flag, BuiltInArchiveFlags.IsSystem), IsVisible = this.FlagAnd(archive.Flag, BuiltInArchiveFlags.Visible), AsPage = this.FlagAnd(archive.Flag, BuiltInArchiveFlags.AsPage), Id = archive.Id, Title = archive.Title, SmallTitle = archive.SmallTitle, Alias = archive.Alias ?? String.Empty, Tags = archive.Tags, Source = archive.Source, Outline = archive.Outline, Content = archive.Content, TemplatePath = archive.IsSelfTemplate && !String.IsNullOrEmpty(archive.TemplatePath) ? archive.TemplatePath : String.Empty, Thumbnail = thumbnail, Location = archive.Location }; data = new { extendFieldsHtml = extendFieldsHtml, extend_cls = archive.ExtendValues.Count == 0 ? "hidden" : "", thumbPrefix = CmsVariables.Archive_ThumbPrefix, nodes = nodesHtml, url = Request.Url.PathAndQuery, tpls = tpls, json = JsonSerializer.Serialize(json) }; base.RenderTemplate( BasePage.CompressHtml(ResourceMap.GetPageContent(ManagementPage.Archive_Update)), data); }
protected void ibtnLogin_Click(object sender, ImageClickEventArgs e) { try { if (txtValidator.Value.Trim() == "") { Tz888.Common.MessageBox.Show(this, "验证码不能为空,请输入验证码!"); return; } if (txtValidator.Value.Trim().ToUpper() != Session["valationNo"].ToString().Trim().ToUpper()) { Tz888.Common.MessageBox.Show(this, "验证码错误,请重新输入验证码!"); txtValidator.Focus(); return; } else { Session["valationNo"] = null; } if (tbLoginName.Value.Trim() != "" && tbPassword.Value.Trim() != "") { //之前的,暂不用 dt = loginBll.Authenticate(tbLoginName.Value.Trim(), tbPassword.Value.Trim(), false); dt = bll.Authenticate(tbLoginName.Value.Trim(), tbPassword.Value.Trim(), Tz888.Common.Text.GetIp().Trim()); if (dt == null || dt.Rows.Count > 0) { //登录成功 //写登陆cookie开始 //HttpCookie loginedUser = new HttpCookie("loginedUser"); //loginedUser.Expires = DateTime.Now.AddDays(1); //loginedUser.Value = tbLoginName.Value.Trim(); //Response.Cookies.Add(loginedUser); //写登陆cookie结束 //写session BasePage bp = new BasePage(); bp.LoginName = tbLoginName.Value.Trim(); Response.Redirect("Default.aspx"); } else { Tz888.Common.MessageBox.Show(this, "用户未审核或用户名与密码不正确!"); tbLoginName.Focus(); return; } } else { if (tbLoginName.Value.Trim() == "") { Tz888.Common.MessageBox.Show(this, "登录用户名不能为空,请输入!"); tbLoginName.Focus(); return; } if (tbPassword.Value.Trim() == "") { Tz888.Common.MessageBox.Show(this, "登录密码不能为空,请输入!"); tbPassword.Focus(); return; } } } catch (Exception err) { throw err; } }
public static void DataInvoicesActionView(BasePage page, Invoice targetInvoice) { var invoiceItems = Global.DaoFactory.GetInvoiceItemDao().GetAll(); var invoiceItemsJson = JsonConvert.SerializeObject(invoiceItems.ConvertAll(item => new { id = item.ID, title = item.Title, stockKeepingUnit = item.StockKeepingUnit, description = item.Description, price = item.Price, quantity = item.Quantity, stockQuantity = item.StockQuantity, trackInventory = item.TrackInventory, invoiceTax1ID = item.InvoiceTax1ID, invoiceTax2ID = item.InvoiceTax2ID })); var invoiceTaxes = Global.DaoFactory.GetInvoiceTaxDao().GetAll(); var invoiceTaxesJson = JsonConvert.SerializeObject(invoiceTaxes.ConvertAll(item => new { id = item.ID, name = item.Name, rate = item.Rate, description = item.Description })); var invoiceSettings = Global.TenantSettings.InvoiceSetting ?? InvoiceSetting.DefaultSettings; var invoiceSettingsJson = JsonConvert.SerializeObject(new { autogenerated = invoiceSettings.Autogenerated, prefix = invoiceSettings.Prefix, number = invoiceSettings.Number, terms = invoiceSettings.Terms }); var presetContactsJson = string.Empty; var presetContactID = UrlParameters.ContactID; if (targetInvoice == null && presetContactID != 0) { var targetContact = Global.DaoFactory.GetContactDao().GetByID(presetContactID); if (targetContact != null) { presetContactsJson = JsonConvert.SerializeObject(new { id = targetContact.ID, displayName = targetContact.GetTitle().HtmlEncode().ReplaceSingleQuote(), smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(targetContact.ID, targetContact is Company), currencyAbbreviation = targetContact.Currency }); } } var currencyRates = Global.DaoFactory.GetCurrencyRateDao().GetAll(); var currencyRatesJson = JsonConvert.SerializeObject(currencyRates.ConvertAll(item => new { id = item.ID, fromCurrency = item.FromCurrency, toCurrency = item.ToCurrency, rate = item.Rate })); var apiServer = new Api.ApiServer(); const string apiUrlFormat = "{0}crm/contact/{1}/data.json"; var contactInfoData = string.Empty; var consigneeInfoData = string.Empty; if (targetInvoice != null) { if (targetInvoice.ContactID > 0) { contactInfoData = apiServer.GetApiResponse(String.Format(apiUrlFormat, SetupInfo.WebApiBaseUrl, targetInvoice.ContactID), "GET"); } if (targetInvoice.ConsigneeID > 0) { consigneeInfoData = apiServer.GetApiResponse(String.Format(apiUrlFormat, SetupInfo.WebApiBaseUrl, targetInvoice.ConsigneeID), "GET"); } } else if (presetContactID != 0) { contactInfoData = apiServer.GetApiResponse(String.Format(apiUrlFormat, SetupInfo.WebApiBaseUrl, presetContactID), "GET"); } var apiUrl = String.Format("{0}crm/invoice/{1}.json", SetupInfo.WebApiBaseUrl, targetInvoice != null ? targetInvoice.ID.ToString(CultureInfo.InvariantCulture) : "sample"); var invoiceData = apiServer.GetApiResponse(apiUrl, "GET"); var script = String.Format(@" var invoiceItems = '{0}'; var invoiceTaxes = '{1}'; var invoiceSettings = '{2}'; var invoicePresetContact = '{3}'; var currencyRates = '{4}'; var invoiceJsonData = '{5}'; var countryListExt = {6}; var currentCultureName = '{7}'; ", Global.EncodeTo64(invoiceItemsJson), Global.EncodeTo64(invoiceTaxesJson), Global.EncodeTo64(invoiceSettingsJson), Global.EncodeTo64(presetContactsJson), Global.EncodeTo64(currencyRatesJson), targetInvoice != null ? Global.EncodeTo64(targetInvoice.JsonData) : "", JsonConvert.SerializeObject(Global.GetCountryListExt()), new RegionInfo(CultureInfo.CurrentCulture.Name).EnglishName ); page.RegisterInlineScript(script, onReady: false); page.JsonPublisher(contactInfoData, "invoiceContactInfo"); page.JsonPublisher(consigneeInfoData, "invoiceConsigneeInfo"); page.JsonPublisher(invoiceData, "invoice"); }
void CreateHighlightedFeatures() { XmlDocument xmlDoc = BasePage.GetDemoXmlDocument(Page); int hfPosition = -1; if (xmlDoc.DocumentElement.Attributes["HighlightedFeaturesPosition"] == null || !Int32.TryParse(xmlDoc.DocumentElement.Attributes["HighlightedFeaturesPosition"].Value, out hfPosition) || hfPosition < 0) { return; } NavBarItem selectedItem = nbMenu.SelectedItem; NavBarGroup hfGroup = new NavBarGroup(HighlightedFeaturesName); BasePage owner = (BasePage)Page; List <NavBarItem> items = new List <NavBarItem>(); SiteMapNode hfNode = null; UnboundSiteMapProvider provider = null; if (owner.IsSiteMapCreated) { provider = owner.SiteMapProvider; if (FindSiteMapNodeByTitle(provider, HighlightedFeaturesName) == null) { hfNode = CreateHFSiteMapNode(provider, hfNode); } } for (int i = 0; i < nbMenu.Groups.Count; i++) { for (int j = 0; j < nbMenu.Groups[i].Items.Count; j++) { if (!owner.IsHighlighted(nbMenu.Groups[i].Items[j])) { continue; } NavBarItem clone = new NavBarItem(); clone.Text = nbMenu.Groups[i].Items[j].Text; clone.Name = nbMenu.Groups[i].Items[j].Name; clone.NavigateUrl = nbMenu.Groups[i].Items[j].NavigateUrl; if (GetUrl(clone.NavigateUrl).ToLower() == Request.AppRelativeCurrentExecutionFilePath.ToLower() && !string.IsNullOrEmpty(Request["Highlighted"])) { selectedItem = clone; } items.Add(clone); } } for (int i = 0; i < items.Count - 1; i++) { for (int j = i + 1; j < items.Count; j++) { if (owner.GetHighlightedIndex(items[j]) < owner.GetHighlightedIndex(items[i])) { NavBarItem item = items[j]; items[j] = items[i]; items[i] = item; } } } for (int i = 0; i < items.Count; i++) { items[i].NavigateUrl += (items[i].NavigateUrl.Contains("?") ? "&" : "?") + "Highlighted=True"; hfGroup.Items.Add(items[i]); if (hfNode != null) { SiteMapNode node = provider.CreateNode(items[i].NavigateUrl, items[i].Text); provider.AddSiteMapNode(node, hfNode); } } if (hfPosition < nbMenu.Groups.Count) { nbMenu.Groups.Insert(hfPosition, hfGroup); } if (selectedItem != null) { selectedItem.Selected = true; selectedItem.Group.Expanded = true; } owner.EnsureSiteMapIsBound(); }
private void user_password_edit(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } int user_id = model.id; string oldpassword = DTRequest.GetFormString("txtOldPassword"); string password = DTRequest.GetFormString("txtPassword"); //检查输入的旧密码 if (string.IsNullOrEmpty(oldpassword)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的旧登录密码!\"}"); return; } //检查输入的新密码 if (string.IsNullOrEmpty(password)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"请输入您的新登录密码!\"}"); return; } //旧密码是否正确 if (model.password != DESEncrypt.Encrypt(oldpassword)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您输入的旧密码不正确!\"}"); return; } //执行修改操作 model.password = DESEncrypt.Encrypt(password); new BLL.users().Update(model); context.Response.Write("{\"msg\":1, \"msgbox\":\"您的密码已修改成功,请记住新密码!\"}"); return; }
/// <summary> /// 帖子排行分页记录 陈志基 2016/08/10 /// </summary> /// <param name="p_pageIndex">当前页</param> /// <param name="p_pageSize">每页显示记录数</param> /// <param name="p_recordCount">返回总记录数</param> /// <param name="strWhere">查询条件</param> /// <returns>List</returns> public IList <BCW.Model.Reply> GetForumstats1(int p_pageIndex, int p_pageSize, string strWhere, int showtype, out int p_recordCount) { IList <BCW.Model.Reply> listForumstat = new List <BCW.Model.Reply>(); string strWhe = string.Empty; if (strWhere != "" || showtype > 1) { strWhe += " where "; } if (strWhere != "") { strWhe += strWhere; } if (strWhere != "" && showtype > 1) { strWhe += " and "; } if (showtype == 2) //本周 { #region 本周 string M_Str_mindate = string.Empty; switch (DateTime.Now.DayOfWeek) { case DayOfWeek.Monday: M_Str_mindate = DateTime.Now.AddDays(0).ToShortDateString() + ""; break; case DayOfWeek.Tuesday: M_Str_mindate = DateTime.Now.AddDays(-1).ToShortDateString() + ""; break; case DayOfWeek.Wednesday: M_Str_mindate = DateTime.Now.AddDays(-2).ToShortDateString() + ""; break; case DayOfWeek.Thursday: M_Str_mindate = DateTime.Now.AddDays(-3).ToShortDateString() + ""; break; case DayOfWeek.Friday: M_Str_mindate = DateTime.Now.AddDays(-4).ToShortDateString() + ""; break; case DayOfWeek.Saturday: M_Str_mindate = DateTime.Now.AddDays(-5).ToShortDateString() + ""; break; case DayOfWeek.Sunday: M_Str_mindate = DateTime.Now.AddDays(-6).ToShortDateString() + ""; break; } strWhe += " AddTime>='" + M_Str_mindate + "'"; #endregion } else if (showtype == 3) //本月 { #region 本月 strWhe += " Year(AddTime)=" + DateTime.Now.Year + " and Month(AddTime)=" + DateTime.Now.Month + ""; #endregion } else if (showtype == 4) //上月 { #region 月 DateTime ForDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToShortDateString()); int ForYear = ForDate.Year; int ForMonth = ForDate.Month; strWhe += " Year(AddTime) = " + (ForYear) + " AND Month(AddTime) = " + (ForMonth) + ""; #endregion } else if (showtype == 5) //上周 { #region 周 DateTime ForDate = DateTime.Parse(DateTime.Now.AddDays(-7).ToShortDateString()); string M_Str_mindate = string.Empty; string M_Str_Maxdate = string.Empty; switch (ForDate.DayOfWeek) { case DayOfWeek.Monday: M_Str_mindate = ForDate.AddDays(0).ToShortDateString() + ""; break; case DayOfWeek.Tuesday: M_Str_mindate = ForDate.AddDays(-1).ToShortDateString() + ""; break; case DayOfWeek.Wednesday: M_Str_mindate = ForDate.AddDays(-2).ToShortDateString() + ""; break; case DayOfWeek.Thursday: M_Str_mindate = ForDate.AddDays(-3).ToShortDateString() + ""; break; case DayOfWeek.Friday: M_Str_mindate = ForDate.AddDays(-4).ToShortDateString() + ""; break; case DayOfWeek.Saturday: M_Str_mindate = ForDate.AddDays(-5).ToShortDateString() + ""; break; case DayOfWeek.Sunday: M_Str_mindate = ForDate.AddDays(-6).ToShortDateString() + ""; break; } M_Str_Maxdate = DateTime.Parse(M_Str_mindate).AddDays(6).ToShortDateString(); strWhe += " AddTime between '" + M_Str_mindate + " 00:00:00' AND '" + M_Str_Maxdate + " 23:59:59'"; #endregion } strWhe += " and IsDel=0 "; #region 计算记录数 // 计算记录数 string countString = "SELECT COUNT(DISTINCT UsID) FROM tb_Reply " + strWhe + ""; p_recordCount = Convert.ToInt32(SqlHelper.GetSingle(countString)); if (p_recordCount > 100) { p_recordCount = 100; } if (p_recordCount > 0) { int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex); } else { return(listForumstat); } #endregion #region 取出相关记录数 // 取出相关记录 string queryString = "SELECT TOP 100 UsID,COUNT(UsID) FROM tb_Reply " + strWhe + " GROUP BY UsID ORDER BY COUNT(UsID) DESC"; using (SqlDataReader reader = SqlHelper.ExecuteReader(queryString)) { int stratIndex = (p_pageIndex - 1) * p_pageSize; int endIndex = p_pageIndex * p_pageSize; int k = 0; while (reader.Read()) { if (k >= stratIndex && k < endIndex) { BCW.Model.Reply objForumstat = new BCW.Model.Reply(); objForumstat.UsID = reader.GetInt32(0); //objForumstat.UsName = reader.GetString(1); objForumstat.Floor = reader.GetInt32(1);//用ReadNum代替返回值 listForumstat.Add(objForumstat); } if (k == endIndex) { break; } k++; } } #endregion return(listForumstat); }
private void order_cancel(HttpContext context) { //检查用户是否登录 Model.users userModel = new BasePage().GetUserInfo(); if (userModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } //检查订单是否存在 string order_no = DTRequest.GetQueryString("order_no"); Model.orders orderModel = new BLL.orders().GetModel(order_no); if (order_no == "" || orderModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,该订单号不存在啦!\"}"); return; } //检查是否自己的订单 if (userModel.id != orderModel.user_id) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,不能取消别人的订单状态!\"}"); return; } //检查订单状态 if (orderModel.status > 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,该订单不是生成状态,不能取消!\"}"); return; } bool result = new BLL.orders().UpdateField(order_no, "status=4"); if (!result) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,操作过程中发生不可遇知的错误!\"}"); return; } //如果是积分换购则返还积分 if (orderModel.point < 0) { new BLL.point_log().Add(orderModel.user_id, orderModel.user_name, -1 * orderModel.point, "取消订单,返还换购积分,订单号:" + orderModel.order_no); } context.Response.Write("{\"msg\":1, \"msgbox\":\"取消订单成功啦!\"}"); return; }
private void ListPage() { Master.Title = "闲聊管理"; int id = int.Parse(Utils.GetRequest("id", "all", 1, @"^[1-9]\d*$", "0")); int ptype = int.Parse(Utils.GetRequest("ptype", "all", 1, @"^[1-9]\d*$", "0")); int uid = int.Parse(Utils.GetRequest("uid", "all", 1, @"^[1-9]\d*$", "0")); if (sName.Length < ptype) { Utils.Error("不存在的类型", ""); } builder.Append(Out.Tab("<div class=\"title\">", "")); if (ptype > 0) { builder.Append("" + sName[ptype - 1] + "闲聊"); } else { builder.Append("单独闲聊"); } builder.Append(Out.Tab("</div>", "<br />")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string strWhere = ""; string[] pageValUrl = { "act", "ptype", "id", "uid" }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } //查询条件 if (uid > 0) { strWhere += "usid=" + uid + ""; } if (uid > 0 && id > 0) { strWhere += " and "; } //if (ptype > 0) strWhere += "Types=" + id + ""; // 开始读取列表 IList <BCW.Model.Speak> listSpeak = new BCW.BLL.Speak().GetSpeaks(pageIndex, pageSize, strWhere, out recordCount); if (listSpeak.Count > 0) { int k = 1; foreach (BCW.Model.Speak n in listSpeak) { if (k % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { if (k == 1) { builder.Append(Out.Tab("<div>", "")); } else { builder.Append(Out.Tab("<div>", "<br />")); } } builder.AppendFormat("[{0}]<a href=\"" + Utils.getUrl("uinfo.aspx?uid={1}&backurl=" + Utils.PostPage(1) + "") + "\">{2}</a>说:{3}", BCW.User.AppCase.CaseAction(n.Types), n.UsId, n.UsName, Out.UBB(n.Notes)); if (n.ToId > 0) { builder.Append("→<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.ToId + "&backurl=" + Utils.PostPage(1) + "") + "\">" + n.ToName + "</a>"); } builder.Append("(" + DT.FormatDate(n.AddTime, 5) + ")"); builder.Append("<a href=\"" + Utils.getUrl("speak.aspx?act=del&ptype=" + n.Types + "&uid=" + n.UsId + "&backurl=" + Utils.PostPage(1) + "") + "\">[删]</a>"); k++; builder.Append(Out.Tab("</div>", "")); } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } else { builder.Append(Out.Div("div", "没有相关记录..")); } string strText = "输入用户ID:/,,,"; string strName = "uid,ptype,id,act"; string strType = "num,hidden,hidden,hidden"; string strValu = "'" + ptype + "'" + id + "'list"; string strEmpt = "true,false,false,false"; string strIdea = "/"; string strOthe = "搜闲聊,speak.aspx,post,1,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("speak.aspx?act=clear&ptype=" + ptype + "&id=" + id + "&backurl=" + Utils.PostPage(1) + "") + "\">清空记录</a><br />"); builder.Append("<a href=\"" + Utils.getUrl("speak.aspx") + "\">返回上一级</a><br />"); builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>")); builder.Append(Out.Tab("</div>", "<br />")); }
private void user_amount_recharge(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } decimal amount = DTRequest.GetFormDecimal("order_amount", 0); int payment_id = DTRequest.GetFormInt("payment_id"); if (amount == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入正确的充值金额!\"}"); return; } if (payment_id == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择正确的支付方式!\"}"); return; } if (!new BLL.payment().Exists(payment_id)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的支付方式不存在或已删除!\"}"); return; } //生成订单号 string order_no = Utils.GetOrderNumber(); //订单号 new BLL.amount_log().Add(model.id, model.user_name, DTEnums.AmountTypeEnum.Recharge.ToString(), order_no, payment_id, amount, "账户充值(" + new BLL.payment().GetModel(payment_id).title + ")", 0); //保存成功后返回订单号 context.Response.Write("{\"msg\":1, \"msgbox\":\"订单保存成功!\", \"url\":\"" + new Web.UI.BasePage().linkurl("payment1", "confirm", DTEnums.AmountTypeEnum.Recharge.ToString(), order_no) + "\"}"); return; }
private void ReloadPage() { Master.Title = "闲聊管理"; int ptype = int.Parse(Utils.GetRequest("ptype", "all", 1, @"^[1-2]$", "1")); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("闲聊管理"); builder.Append(Out.Tab("</div>", "")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string[] pageValUrl = { }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } if (pageIndex == 1) { builder.Append(Out.Tab("<div>", "<br />")); builder.Append("0.<a href=\"" + Utils.getUrl("speak.aspx?act=list&ptype=0&id=0") + "\">单独闲聊</a>"); builder.Append(Out.Tab("</div>", "")); } //总记录数 recordCount = sName.Length; int stratIndex = (pageIndex - 1) * pageSize; int endIndex = pageIndex * pageSize; int k = 0; for (int i = 0; i < sName.Length; i++) { if (k >= stratIndex && k < endIndex) { if ((k + 1) % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { builder.Append(Out.Tab("<div>", "<br />")); } builder.Append("" + (i + 1) + ".<a href=\"" + Utils.getUrl("speak.aspx?act=list&ptype=" + (i + 1) + "&id=" + (Convert.ToInt32(sUrl[i])) + "") + "\">" + sName[i].ToString() + "</a>"); builder.Append(Out.Tab("</div>", "")); } if (k == endIndex) { break; } k++; } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); builder.Append("<a href=\"" + Utils.getUrl("speak.aspx?act=clear&backurl=" + Utils.PostPage(1) + "") + "\">清空记录</a><br />"); builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>")); builder.Append(Out.Tab("</div>", "<br />")); }
private void user_info_edit(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } string email = DTRequest.GetFormString("txtEmail"); string nick_name = DTRequest.GetFormString("txtNickName"); string sex = DTRequest.GetFormString("rblSex"); string birthday = DTRequest.GetFormString("txtBirthday"); string telphone = DTRequest.GetFormString("txtTelphone"); string mobile = DTRequest.GetFormString("txtMobile"); string qq = DTRequest.GetFormString("txtQQ"); string address = context.Request.Form["txtAddress"]; string safe_question = context.Request.Form["txtSafeQuestion"]; string safe_answer = context.Request.Form["txtSafeAnswer"]; //检查邮箱 if (nick_name == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入您的姓名昵称!\"}"); return; } //检查邮箱 if (email == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入您邮箱帐号!\"}"); return; } //开始写入数据库 model.email = email; model.nick_name = nick_name; model.sex = sex; DateTime _birthday; if (DateTime.TryParse(birthday, out _birthday)) { model.birthday = _birthday; } model.telphone = telphone; model.mobile = mobile; model.qq = qq; model.address = address; model.safe_question = safe_question; model.safe_answer = safe_answer; new BLL.users().Update(model); context.Response.Write("{\"msg\":1, \"msgbox\":\"您的账户资料已修改成功啦!\"}"); return; }
public void ProcessRequest(HttpContext context) { int id = DTRequest.GetQueryInt("id"); //获得下载ID if (id < 1) { context.Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,参数传值不正确哦!")); return; } //检查下载记录是否存在 BLL.article_attach bll = new BLL.article_attach(); if (!bll.Exists(id)) { context.Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要下载的文件不存在或已经被删除啦!")); return; } Model.article_attach model = bll.GetModel(id); //检查积分是否足够 if (model.point > 0) { //检查用户是否登录 Model.users userModel = BasePage.GetUserInfo(); if (userModel == null) { //自动跳转URL HttpContext.Current.Response.Redirect(new Web.UI.BasePage().linkurl("login")); } //防止重复扣积分 string cookie = Utils.GetCookie(DTKeys.COOKIE_DOWNLOAD_KEY, "attach_" + userModel.id.ToString()); if (cookie != model.id.ToString()) { //检查积分 if (model.point > userModel.point) { context.Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您的积分不足支付本次下载!")); return; } //扣取积分 new BLL.user_point_log().Add(userModel.id, userModel.user_name, model.point * -1, "下载附件:“" + model.file_name + "”,扣减积分", false); //写入Cookie Utils.WriteCookie(DTKeys.COOKIE_DOWNLOAD_KEY, "attach_" + userModel.id.ToString(), model.id.ToString(), 8640); } } //下载次数+1 bll.UpdateField(id, "down_num=down_num+1"); //检查文件本地还是远程 if (model.file_path.ToLower().StartsWith("http://")) { context.Response.Redirect(model.file_path); return; } else { //取得文件物理路径 string fullFileName = Utils.GetMapPath(model.file_path); if (!File.Exists(fullFileName)) { context.Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要下载的文件不存在或已经被删除啦!")); return; } FileInfo file = new FileInfo(fullFileName); //路径 context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码 context.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(model.file_name)); //解决中文文件名乱码 context.Response.AddHeader("Content-length", file.Length.ToString()); context.Response.ContentType = "application/pdf"; context.Response.WriteFile(file.FullName); context.Response.End(); } }
private void user_message_add(HttpContext context) { //检查用户是否登录 Model.users model = new BasePage().GetUserInfo(); if (model == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } string code = context.Request.Form["txtCode"]; string send_save = DTRequest.GetFormString("sendSave"); string user_name = DTRequest.GetFormString("txtUserName"); string title = DTRequest.GetFormString("txtTitle"); string content = DTRequest.GetFormString("txtContent"); //校检验证码 string result = verify_code(context, code); if (result != "success") { context.Response.Write(result); return; } //检查用户名 if (user_name == "" || !new BLL.users().Exists(user_name)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,该用户名不存在或已经被删除啦!\"}"); return; } //检查标题 if (title == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入短消息标题!\"}"); return; } //检查内容 if (content == "") { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入短消息内容!\"}"); return; } //保存数据 Model.user_message modelMessage = new Model.user_message(); modelMessage.type = 2; modelMessage.post_user_name = model.user_name; modelMessage.accept_user_name = user_name; modelMessage.title = title; modelMessage.content = Utils.ToHtml(content); new BLL.user_message().Add(modelMessage); if (send_save == "true") //保存到收件箱 { modelMessage.type = 3; new BLL.user_message().Add(modelMessage); } context.Response.Write("{\"msg\":1, \"msgbox\":\"发布短信息成功啦!\"}"); return; }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); BLL.orders objorders = new BLL.orders(); Model.orders modelorders = objorders.GetModel(order_no); if (modelorders == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,订单详情获取出错,请重试!"))); return; } decimal order_amount = modelorders.order_amount; string subject = DTRequest.GetFormString("pay_subject"); if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } //检查是否已登录 Model.users userModel = BasePage.GetUserInfo(); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "login")); //尚未登录 return; } if (order_no.StartsWith("B")) //B开头为商品订单 { BLL.orders bll = new BLL.orders(); Model.orders model = bll.GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!"))); return; } if (model.payment_status == 1) { //执行扣取账户金额 int result = new BLL.user_amount_log().Add(userModel.id, userModel.user_name, DTEnums.AmountTypeEnum.BuyGoods.ToString(), order_no, model.payment_id, -1 * order_amount, subject, 1); if (result > 0) { //更改订单状态 bool result1 = bll.UpdateField(order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'"); if (!result1) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; } //扣除积分 if (model.point < 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false); } } else { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; } } //支付成功 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "succeed", order_no)); return; } Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!"))); return; }
protected void Page_Load(object sender, EventArgs e) { UserInfo userinfoobj = new UserInfo(LoginMemberId); lblRoleName.Text = "("+userinfoobj.RoleName+")"; lblSubRoleName.Text = userinfoobj.SubRoleName; UserInfo obj = UserInfo.GetCurrentUserInfo(); litLoginName.Text = obj.Login; //lblRoleName.Text = obj.RoleName; //lblSubRoleName.Text = obj.SubRoleName; if (obj.LastLoginDate != null && obj.LastLoginDate != DateTime.MinValue) { //29 October, 2012//11:00am litLastLoginDate.Text = String.Format("Last Login on <b>{0}</b>at <b>{1}</b>", obj.LastLoginDate.ToString("dd MMMM, yyyy"), obj.LastLoginDate.ToString("hh:mm tt")); litLastLoginNotAvailable.Visible = false; litLastLoginDate.Visible = true; } else { litLastLoginNotAvailable.Visible = true; litLastLoginDate.Visible = false; } if (!IsPostBack) { lblcompanyname.Text = OrganizationInfo.GetOrgLegalNameByOrgId(UserOrganizationId); int stateid = OrganizationInfo.getStateId(obj.OrganizationId); try { DataSet ds1 = OrganizationInfo.GetStateCodeByStateId(stateid); litRole.Text = ds1.Tables[0].Rows[0]["StateName"].ToString(); } catch { } DataTable dt = OrganizationInfo.GetLogoPath(obj.OrganizationId); if (dt != null && dt.Rows.Count > 0) { string str = ConfigurationManager.AppSettings["LogoUploadLocation"] + dt.Rows[0]["vchLogoPath"].ToString(); if (string.IsNullOrEmpty(dt.Rows[0]["vchLogoPath"].ToString())) { imgLogo.Visible = false; imgLogoDefault.Visible = true; } else { imgLogo.Visible = true; imgLogoDefault.Visible = false; str = str.Replace("//", "/"); imgLogo.ImageUrl = str; } // litRole.Text = dt.Rows[0]["StateName"].ToString();// +" " + dt.Rows[0]["RoleName"].ToString(); } else { imgLogo.Visible = false; imgLogoDefault.Visible = true; } DataSet ds = Notifications.getAllNotifications(UserInfo.GetCurrentUserInfo().UserId, UserOrganizationId, false, true, 100000, 1); int count = ds.Tables[0].Rows.Count; if (count == 0) lblnotficationcount.Text = ""; else lblnotficationcount.Text = count.ToString(); BasePage objBase = new BasePage(); ds = UserInfo.GetAllActiveLanguages(); DataRow dr = ds.Tables[0].Select("LanguageId =" + objBase.LanguageId)[0]; //litLangauge.Text = Convert.ToString(dr["CountryName"]); img.Src = "/images/" + Convert.ToString(dr["Flag"]); lvmessagesmain.DataSource = Notifications.getAllNotifications(UserInfo.GetCurrentUserInfo().UserId, UserOrganizationId, false, true, 10, 1); lvmessagesmain.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Master.Title = "积分系统设置"; builder.Append(Out.Tab("", "")); string ac = Utils.GetRequest("ac", "all", 1, "", ""); ub xml = new ub(); string xmlPath = "/Controls/cent.xml"; Application.Remove(xmlPath); //清缓存 xml.ReloadSub(xmlPath); //加载配置 Master.Title = "积分配置中心"; string[] sNames = BCW.User.Cent.sNames; int ptype = int.Parse(Utils.GetRequest("ptype", "all", 1, @"^[0-9]\d*$", "-1")); if (ptype != -1 && ptype <= sNames.Length) { if (Utils.ToSChinese(ac) == "确定修改") { int Gold = int.Parse(Utils.GetRequest("Gold" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "" + ub.Get("SiteBz") + "填写出错")); int Money = int.Parse(Utils.GetRequest("Money" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "" + ub.Get("SiteBz2") + "填写出错")); int Score = int.Parse(Utils.GetRequest("Score" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "积分填写出错")); int Tl = int.Parse(Utils.GetRequest("Tl" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "体力填写出错")); int Ml = int.Parse(Utils.GetRequest("Ml" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "魅力填写出错")); int Zh = int.Parse(Utils.GetRequest("Zh" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "智慧填写出错")); int Ww = int.Parse(Utils.GetRequest("Ww" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "威望填写出错")); int Xe = int.Parse(Utils.GetRequest("Xe" + ptype + "", "post", 2, @"^-?[0-9]\d*$", "邪恶填写出错")); if (sNames[ptype].ToString().Contains("+")) { int Num = int.Parse(Utils.GetRequest("Num" + ptype + "", "post", 2, @"^[0-9]\d*$", "每天上限次数填写出错")); xml.dss["CentNum" + ptype + ""] = Num; } xml.dss["CentGold" + ptype + ""] = Gold; xml.dss["CentMoney" + ptype + ""] = Money; xml.dss["CentScore" + ptype + ""] = Score; xml.dss["CentTl" + ptype + ""] = Tl; xml.dss["CentMl" + ptype + ""] = Ml; xml.dss["CentZh" + ptype + ""] = Zh; xml.dss["CentWw" + ptype + ""] = Ww; xml.dss["CentXe" + ptype + ""] = Xe; System.IO.File.WriteAllText(Server.MapPath(xmlPath), xml.Post(xml.dss), System.Text.Encoding.UTF8); Utils.Success("积分配置", "配置成功,正在返回..", Utils.getUrl("centset.aspx?ptype=" + ptype + ""), "1"); } else { builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("" + sNames[ptype] + "配置"); builder.Append(Out.Tab("</div>", "")); string sText = string.Empty; string sName = string.Empty; string sType = string.Empty; string sValu = string.Empty; string sEmpt = string.Empty; string mText = "罚"; if (sNames[ptype].ToString().Contains("+")) { sText = "每天上限(次):,"; sName = "Num" + ptype + ","; sType = "snum,"; sValu = "" + xml.dss["CentNum" + ptype + ""] + "'"; sEmpt = "false,"; mText = "奖"; } if (sNames[ptype].ToString().Contains("#")) { mText = "奖"; } string strText = "" + mText + "" + ub.Get("SiteBz") + ":," + mText + "" + ub.Get("SiteBz2") + ":," + mText + "积分:," + mText + "体力:," + mText + "魅力:," + mText + "智慧:," + mText + "威望:," + mText + "邪恶:," + sText + ""; string strName = "Gold" + ptype + ",Money" + ptype + ",Score" + ptype + ",Tl" + ptype + ",Ml" + ptype + ",Zh" + ptype + ",Ww" + ptype + ",Xe" + ptype + "," + sName + "ptype"; string strType = "stext,stext,stext,stext,stext,stext,stext,stext," + sType + "hidden"; string strValu = "" + xml.dss["CentGold" + ptype + ""] + "'" + xml.dss["CentMoney" + ptype + ""] + "'" + xml.dss["CentScore" + ptype + ""] + "'" + xml.dss["CentTl" + ptype + ""] + "'" + xml.dss["CentMl" + ptype + ""] + "'" + xml.dss["CentZh" + ptype + ""] + "'" + xml.dss["CentWw" + ptype + ""] + "'" + xml.dss["CentXe" + ptype + ""] + "'" + sValu + "" + ptype + ""; string strEmpt = "false,false,false,false,false,false,false," + sEmpt + "false"; string strIdea = "/"; string strOthe = "确定修改,centset.aspx,post,1,red"; builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe)); builder.Append(Out.Tab("<div>", "<br />")); builder.Append("温馨提示:<br />1.支持负数,负值将扣取相应的属性值.<br />2,注意邪恶值为贬义,奖为负数,罚为正数.<br />3.不奖罚积分请填写0."); if (mText == "奖") { builder.Append("<br />4.每天上限次数填写0则为每天不限次数奖励."); } builder.Append(Out.Tab("</div>", "")); } } else { builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("积分配置中心"); builder.Append(Out.Tab("</div>", "")); int pageIndex; int recordCount; int pageSize = Convert.ToInt32(ub.Get("SiteListNo")); string[] pageValUrl = { }; pageIndex = Utils.ParseInt(Request.QueryString["page"]); if (pageIndex == 0) { pageIndex = 1; } //总记录数 recordCount = sNames.Length; int stratIndex = (pageIndex - 1) * pageSize; int endIndex = pageIndex * pageSize; int k = 0; for (int i = 0; i < sNames.Length; i++) { if (k >= stratIndex && k < endIndex) { if ((k + 1) % 2 == 0) { builder.Append(Out.Tab("<div class=\"text\">", "<br />")); } else { builder.Append(Out.Tab("<div>", "<br />")); } builder.Append("" + (i + 1) + ".<a href=\"" + Utils.getUrl("centset.aspx?ptype=" + i + "") + "\">" + sNames[i].ToString() + "</a>"); builder.Append(Out.Tab("</div>", "")); } if (k == endIndex) { break; } k++; } // 分页 builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0)); } builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr())); builder.Append(Out.Tab("<div>", "")); if (ptype != -1) { builder.Append("<a href=\"" + Utils.getUrl("centset.aspx") + "\">积分配置</a><br />"); } builder.Append("<a href=\"" + Utils.getUrl("default.aspx") + "\">配置中心</a><br />"); builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("../default.aspx") + "\">返回管理中心</a>")); builder.Append(Out.Tab("</div>", "<br />")); }