/// <summary> /// 批量上传图片 /// </summary> public string UploadPhotos() { var Photos = ""; try { if (Request.Files.Count > 0) { foreach (string str in Request.Files) { string path = ""; var file = Request.Files[str]; path = Utils.CreateSaveFilePath("/Upload/photos/", Utils.PathFormat.Year_Month); string fileName = DataSecurity.MakeFileRndName() + Utils.GetFileExtName(file.FileName); Photos += path + fileName + ","; file.SaveAs(HttpContext.Current.Server.MapPath(path + fileName)); } Photos = Utils.Strquotes(Photos); } } catch (Exception ex) { UtilLog.WriteExceptionLog("Upload Error", ex); throw; } return(Photos); }
//提交注册 protected void BtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { M_UserInfo info = new M_UserInfo(); info.UserName = this.TxtUserName.Text; info.UserPwd = this.TxtPassword.Text; info.Question = this.TxtQuestion.Text; info.Answer = this.TxtAnswer.Text; info.Email = this.TxtEmail.Text; info.CheckNum = DataSecurity.RandomNum(10); info.UserFace = ""; info.FaceHeight = 16; info.FaceWidth = 16; info.GroupID = 0; info.LastLoginIP = HttpContext.Current.Request.UserHostAddress; info.LastLockTime = DateTime.Now; info.LastLoginTimes = DateTime.Now; info.LastPwdChangeTime = DateTime.Now; info.LoginTimes = 1; info.PrivacySetting = 0; info.RegTime = DateTime.Now; info.Sign = ""; info.Status = 4; info.UserPwd = StringHelper.MD5(info.UserPwd); info.Answer = StringHelper.MD5(info.Answer); buser.Add(info); buser.SetLoginState(info); base.Response.Redirect("Default.aspx"); } }
//B_Zone_SheetStyle bzss = new B_Zone_SheetStyle(); protected void Page_Load(object sender, EventArgs e) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.page, "AddPageStyle")) { function.WriteErrMsg("没有权限进行此项操作"); } if (!IsPostBack) { string menu = DataSecurity.FilterBadChar(Request.QueryString["menu"]); int sid = Convert.ToInt32(Request.QueryString["sid"]); if (menu == "edit") { //M_Zone_SheetStyle mzs = bzss.Select(sid); //this.Alias.Text = mzs.Alias; //this.Lname.Text = mzs.Lname; //this.ShowImg.Text = mzs.Img; //this.Price.Text = mzs.Price.ToString(); //this.lblid.Value = mzs.ID.ToString(); //this.Ltype.SelectedValue = mzs.Groups.ToString(); //this.Button1.Text = "修改"; //Label1_Hid.Value = "修改样式"; } else { Label1_Hid.Value = "添加样式"; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='PageManage.aspx'>企业黄页</a></li> <li><a href='SheetStyleManage.aspx'>黄页标签管理</a></li><li>" + Label1_Hid.Value + "</li>"); } }
/// <summary> /// 根据日志ID删除日志信息,但保留最近两天之内的数据 /// </summary> /// <param name="id">日志ID</param> /// <returns>TRUE/FALSE</returns> public bool Delete(string id) { string strWhere = " and LogID in (" + DataSecurity.ToValidId(id) + ") AND [Timestamp] < DATEADD(dd,-2,GETDATE())"; Dictionary <string, object> dict = new Dictionary <string, object>(); return(Delete(strWhere, dict)); }
public static bool AddFieldPermissions(int roleId, OperateCode operateCode, string modelIds, string fieldNames) { if (!DataValidator.IsValidId(modelIds)) { return(false); } string[] strArray = modelIds.Split(split, StringSplitOptions.RemoveEmptyEntries); string[] strArray2 = fieldNames.Split(split, StringSplitOptions.RemoveEmptyEntries); int length = strArray.Length; if (strArray.Length != strArray2.Length) { return(false); } if (strArray.Length == 0) { length = 1; strArray[0] = modelIds; strArray2[0] = DataSecurity.FilterBadChar(fieldNames); } else { length = strArray.Length; } for (int i = 0; i < length; i++) { if (!AddFieldPermissionToRoles(roleId, DataConverter.CLng(strArray[i]), DataSecurity.FilterBadChar(strArray2[i]), operateCode)) { return(false); } } return(true); }
protected void Page_Load(object sender, EventArgs e) { this.m_Path = base.BasePath; this.m_Path = this.Page.Request.Url.Scheme + "://" + this.Page.Request.Url.Authority + this.m_Path; if (!string.IsNullOrEmpty(PEContext.Current.User.UserName)) { UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName); this.TxtUserName.Text = usersByUserName.UserName; this.TxtEmail.Text = usersByUserName.Email; this.TxtUserName.Enabled = false; this.TxtEmail.Enabled = false; } if (!base.IsPostBack) { int num = BasePage.RequestInt32("ID"); int commentId = BasePage.RequestInt32("CommentID"); string str = BasePage.RequestString("Title"); if (num == 0) { DynamicPage.WriteErrMsg("<li>没有找到隶属信息评论,请返回。</li>"); } else { CommentInfo extendCommentInfo = Comment.GetExtendCommentInfo(commentId); if (!base.User.Identity.IsAuthenticated) { this.ChkIsPrivate.Enabled = false; } this.LblTitle.Text = str; if (!string.IsNullOrEmpty(extendCommentInfo.UserFace)) { this.ImgUserFace.ImageUrl = DataSecurity.UrlEncode(extendCommentInfo.UserFace); this.ImgUserFace.Width = extendCommentInfo.FaceWidth; this.ImgUserFace.Height = extendCommentInfo.FaceHeight; } else { this.ImgUserFace.ImageUrl = this.m_Path + "Images/Comment/01.gif"; this.ImgUserFace.Width = Unit.Parse("80"); this.ImgUserFace.Height = Unit.Parse("90"); } this.LblUserName.Text = extendCommentInfo.UserName; this.LblPassedItems.Text = extendCommentInfo.PassedItems.ToString(); this.LblUserExp.Text = extendCommentInfo.UserExp.ToString(); this.LblUserRegTime.Text = extendCommentInfo.UserRegTime.ToString("yyyy-MM-dd"); if (PEContext.Current.User.Identity.IsAuthenticated) { this.LblMessage.Text = "<a href='" + this.m_Path + "User/Message/Message.aspx?inceptUser="******"'><img alt='发送短信' src='" + this.m_Path + "Images/Comment/message.gif' border='0' /></a>"; } this.LblEmail.Text = "<a href='mailto:" + extendCommentInfo.Email + "'><img alt='邮箱' src='" + this.m_Path + "Images/Comment/email.gif' border='0' /></a>"; this.LblContent.Text = extendCommentInfo.Content; this.LblUpdateDateTime.Text = extendCommentInfo.UpdateDateTime.ToString("yyyy-MM-dd"); this.TxtCommentRestore.Text = extendCommentInfo.Content; } if (!SiteConfig.SiteOption.EnablePointMoneyExp) { this.UserExp.Style.Add("display", "none"); } } }
public static IList <DownloadErrorInfo> GetDownloadErrorList(int startRowIndexId, int maxiNumRows, string searchType, string keyword) { string str = DataSecurity.FilterBadChar(searchType); string str2 = DataSecurity.FilterBadChar(keyword); return(dal.GetDownloadErrorList(startRowIndexId, maxiNumRows, str, str2)); }
/// <summary> /// Configures a Microsoft SQL Server Storage implementation of <see cref="IWebHookStore"/> /// which provides a persistent store for registered WebHooks used by the custom WebHooks module. /// </summary> /// <param name="config">The current <see cref="HttpConfiguration"/>config.</param> /// <param name="encryptData">Indicates whether the data should be encrypted using <see cref="IDataProtector"/> while persisted.</param> public static void InitializeCustomWebHooksSqlStorage(this HttpConfiguration config, bool encryptData) { if (config == null) { throw new ArgumentNullException(nameof(config)); } WebHooksConfig.Initialize(config); ILogger logger = config.DependencyResolver.GetLogger(); SettingsDictionary settings = config.DependencyResolver.GetSettings(); // We explicitly set the DB initializer to null to avoid that an existing DB is initialized wrongly. Database.SetInitializer <WebHookStoreContext>(null); IWebHookStore store; if (encryptData) { IDataProtector protector = DataSecurity.GetDataProtector(); store = new SqlWebHookStore(settings, protector, logger); } else { store = new SqlWebHookStore(settings, logger); } CustomServices.SetStore(store); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Response.Redirect("Maintenance.aspx"); if (Request.QueryString.Count > 0 && Request.QueryString["email"] != null && Request.QueryString["pwd"] != null) { Session.Clear(); string uname = DataSecurity.Decrypt(Request.QueryString["email"].ToString()); string pwd = "ABC"; //DataSecurity.Decrypt(Request.QueryString["pwd"].ToString()); userlogin(uname, pwd); } if (GlobalVarables.isAuthenticated(Session)) { if (Request.QueryString.Count > 0 && Request.QueryString["From"] != null && Request.QueryString["From"].ToString() == "Cart") { Response.Redirect("~/MemberPanel/Repurchase_1.aspx"); } else { Response.Redirect("~/MemberPanel/DashBoard.aspx"); //Response.Redirect("~/MemberPanel/PromotrackerNov.aspx"); //Response.Redirect("~/MemberPanel/PromotionFeb.aspx"); //Response.Redirect("~/MemberPanel/AprilPromoTracker.aspx"); //Response.Redirect("~/MemberPanel/AnualBonanza.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { this.surveyId = DataConverter.CLng(base.Request.QueryString["SurveyID"]); SurveyInfo surveyById = SurveyManager.GetSurveyById(this.surveyId); this.SmpNavigator.AdditionalNode = "<b>[</b><font color=red>" + DataSecurity.HtmlEncode(surveyById.SurveyName) + "</font><b>]</b>题目列表"; this.isOpen = surveyById.IsOpen; if (this.isOpen == 1) { this.EgvQuestion.Columns[3].Visible = false; this.BtnAddQuestion.Visible = false; this.BtnSetOrderId.Visible = false; this.BtnDel.Visible = false; this.EgvQuestion.AutoGenerateCheckBoxColumn = false; } if (!base.IsPostBack) { int questionId = DataConverter.CLng(base.Request.QueryString["QuestionId"]); string str = base.Request.QueryString["Action"]; if (str == "Delete") { SurveyField.Delete(this.surveyId, questionId); } } }
private static bool CreateIncludeFile(IncludeFileInfo includeFileInfo) { if (includeFileInfo.IsNull) { return(false); } string includeFilePath = SiteConfig.SiteOption.IncludeFilePath; includeFilePath = "~/" + includeFilePath + "/" + includeFileInfo.FileName; includeFilePath = HttpContext.Current.Request.MapPath(includeFilePath); TemplateInfo templateInfo = new TemplateInfo(); templateInfo.QueryList = new NameValueCollection(); templateInfo.PageName = ""; templateInfo.TemplateContent = includeFileInfo.Template; templateInfo.RootPath = HttpContext.Current.Request.PhysicalApplicationPath; templateInfo.CurrentPage = 1; string templateContent = TemplateTransform.GetHtml(templateInfo).TemplateContent; if (includeFileInfo.IncludeType == IncludeType.JSWriteHtml) { templateContent = "document.write(\"" + DataSecurity.ConvertToJavaScript(templateContent) + "\")"; } FileSystemObject.WriteFile(includeFilePath, templateContent); return(true); }
/// <summary> /// Configures a Microsoft Azure Table Storage implementation of <see cref="IWebHookStore"/> /// which provides a persistent store for registered WebHooks used by the custom WebHooks module. /// </summary> /// <param name="config">The current <see cref="HttpConfiguration"/>config.</param> /// <param name="encryptData">Indicates whether the data should be encrypted using <see cref="IDataProtector"/> while persisted.</param> public static void InitializeCustomWebHooksAzureStorage(this HttpConfiguration config, bool encryptData) { if (config == null) { throw new ArgumentNullException(nameof(config)); } WebHooksConfig.Initialize(config); ILogger logger = config.DependencyResolver.GetLogger(); SettingsDictionary settings = config.DependencyResolver.GetSettings(); IStorageManager storageManager = StorageManager.GetInstance(logger); IWebHookStore store; if (encryptData) { IDataProtector protector = DataSecurity.GetDataProtector(); store = new AzureWebHookStore(storageManager, settings, protector, logger); } else { store = new AzureWebHookStore(storageManager, settings, logger); } CustomServices.SetStore(store); }
protected void repFileReName_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Del") { string LabelName = e.CommandArgument.ToString(); bll.DelLabelXML(LabelName); Response.Redirect("LabelManage.aspx"); } if (e.CommandName == "Copy") { string LabelName = e.CommandArgument.ToString(); M_Label newlbl = bll.GetLabelXML(LabelName); newlbl.LableName = newlbl.LableName + DataSecurity.RandomNum(4); newlbl.LabelID = 0; bll.AddLabelXML(newlbl); Response.Redirect("LabelManage.aspx"); } if (e.CommandName == "Download") { string LabelName = e.CommandArgument.ToString(); M_Label newlbl = bll.GetLabelXML(LabelName); XmlDocument doc = new XmlDocument(); XmlNode nodelist = doc.SelectSingleNode("//NewDataSet/Table[LabelID='" + newlbl.LabelID.ToString() + "']"); string fileName = newlbl.LableName + ".lable";//客户端保存的文件名 string path = newlbl.LabelCate + "/" + newlbl.LableName + ".label"; SafeSC.DownFile(bll.dir + path, HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8)); } }
public static IList <ServiceInfo> GetList(int startRowIndexId, int maxNumberRows, string searchType, string field, string keyword) { if (!string.IsNullOrEmpty(keyword)) { if (!(searchType == "10")) { keyword = DataSecurity.FilterBadChar(keyword); } else { string str = field; if (str != null) { if (!(str == "ClientID")) { if (str == "ServiceTime") { keyword = DataConverter.CDate(keyword).ToString("yyyy-MM-dd"); } } else if (DataConverter.CLng(keyword) == 0) { return(new List <ServiceInfo>()); } } } } return(dal.GetList(startRowIndexId, maxNumberRows, searchType, field, keyword)); }
private void ModifyCart() { ShoppingCartInfo shoppingcartinfo = new ShoppingCartInfo(); shoppingcartinfo.UserName = this.m_UserName; shoppingcartinfo.UpdateTime = DateTime.Now; shoppingcartinfo.CartId = this.cartId; string[] strArray = this.GetParameterList("ChkProductId", "HdfProductId", "TxtProductAmount", "HdfTableName", "HdfProperty").Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries); this.m_ProductCount = strArray.Length; string[] strArray2 = this.GetPresentParameterList("ChkPresentId", "HdnPresentId", "LitPresentNum").Split(new string[] { "$$$" }, StringSplitOptions.RemoveEmptyEntries); ShoppingCart.Delete(this.cartId); for (int i = 0; i < strArray.Length; i++) { string[] strArray3 = strArray[i].Split(new char[] { ',' }); shoppingcartinfo.IsPresent = false; shoppingcartinfo.ProductId = DataConverter.CLng(strArray3[0]); shoppingcartinfo.TableName = DataSecurity.FilterBadChar(strArray3[1]); shoppingcartinfo.Quantity = DataConverter.CLng(strArray3[2], 1); shoppingcartinfo.Property = DataSecurity.FilterBadChar(strArray3[3]); ShoppingCart.Add(shoppingcartinfo); } if (strArray2.Length != 0) { for (int j = 0; j < strArray2.Length; j++) { string[] strArray4 = strArray2[j].Split(new char[] { ',' }); shoppingcartinfo.IsPresent = true; shoppingcartinfo.ProductId = DataConverter.CLng(strArray4[0]); shoppingcartinfo.Quantity = DataConverter.CLng(strArray4[1]); ShoppingCart.Add(shoppingcartinfo); } } this.RptShoppingCart_DataBind(); }
private void ShowSurveyInfo(int surveyId) { if (surveyId != 0) { SurveyInfo surveyById = SurveyManager.GetSurveyById(surveyId); this.ViewState["Info"] = surveyById; if (surveyById != null) { this.TxtSurveyName.Text = surveyById.SurveyName; this.TxtDescription.Text = surveyById.Description; this.TxtIPRepeat.Text = surveyById.IPRepeat.ToString(); if (surveyById.NeedLogin == 1) { this.RadNeedLogin1.Checked = true; this.RadNeedLogin0.Checked = false; this.TxtPresentPoint.Text = surveyById.PresentPoint.ToString(); } this.TxtSetPassword.Attributes.Add("value", surveyById.SetPassword); this.RadlLockIPType.SelectedValue = surveyById.LockIPType.ToString(); string[] field = surveyById.SetIPLock.Split(new string[] { "|||" }, StringSplitOptions.None); this.IPLockWrite.Value = DataSecurity.GetArrayValue(0, field); this.IPLockBlack.Value = DataSecurity.GetArrayValue(1, field); this.DateEnd.Text = surveyById.EndTime.ToString("yyyy-MM-dd"); this.FscTemplate.Text = surveyById.Template; this.TxtLockUrl.Text = surveyById.LockUrl; } else { AdminPage.WriteErrMsg("找不到该问卷!", "SurveyManage.aspx"); } } }
protected void AddToCart() { ShopConfig shopConfig = SiteConfig.ShopConfig; if ((shopConfig.OrderProductNumber != 0) && (shopConfig.OrderProductNumber <= ShoppingCart.GetInfoByCart(this.cartId, false).Count)) { DynamicPage.WriteErrMsg("<li>超出系统所设置的购物车商品种类数量:" + shopConfig.OrderProductNumber + "</li>", "ShoppingCart.aspx"); } ShoppingCartInfo shoppingcartinfo = new ShoppingCartInfo(); int productId = 0; string tableName = string.Empty; CommonModelInfo commonModelInfoById = ContentManage.GetCommonModelInfoById(BasePage.RequestInt32("ID")); if (commonModelInfoById.IsNull) { DynamicPage.WriteErrMsg("<li>找不到指定的商品</li>"); } else { productId = commonModelInfoById.ItemId; tableName = commonModelInfoById.TableName; } int num3 = Order.CountBuyNum(PEContext.Current.User.UserName, productId); ProductInfo productById = Product.GetProductById(productId); int minimum = DataConverter.CLng(this.Page.Request.QueryString["Num"]); if ((productById.Minimum > minimum) && (productById.Minimum > 0)) { minimum = productById.Minimum; } else if (minimum == 0) { minimum = 1; } if ((productById.LimitNum > 0) && ((num3 + minimum) > productById.LimitNum)) { DynamicPage.WriteErrMsg(string.Concat(new object[] { "您订购了", num3, productById.Unit, productById.ProductName, ",曾经购买了", num3, productById.Unit, ",而此商品每人限购数量为", productById.LimitNum, productById.Unit, ",请重新调整您的购物车!" }), "ShoppingCart.aspx"); } string property = DataSecurity.FilterBadChar(BasePage.RequestString("Property")); if (!this.ProductExist(this.cartId, productId, tableName, property)) { if (Product.IsEnableSale(productId, tableName, property, this.cartId)) { shoppingcartinfo.Quantity = minimum; shoppingcartinfo.ProductId = productId; shoppingcartinfo.TableName = tableName; shoppingcartinfo.Property = property; shoppingcartinfo.UserName = this.m_UserName; shoppingcartinfo.UpdateTime = DateTime.Now; shoppingcartinfo.IsPresent = false; shoppingcartinfo.CartId = this.cartId; ShoppingCart.Add(shoppingcartinfo); } else { DynamicPage.WriteErrMsg(Product.ErrMsgOfEnableSale); } } }
private static string GetAnswer(IList <SurveyFieldInfo> surveyFieldInfoList, int i, DataTable dataTable) { switch (surveyFieldInfoList[i].QuestionType) { case 2: case 4: return(DataSecurity.GetArrayValue(DataConverter.CLng(dataTable.Rows[0][i], -1), surveyFieldInfoList[i].Settings)); case 3: case 5: { StringBuilder sb = new StringBuilder(); foreach (string str2 in dataTable.Rows[0][i].ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { string arrayValue = DataSecurity.GetArrayValue(DataConverter.CLng(str2, -1), surveyFieldInfoList[i].Settings); StringHelper.AppendString(sb, arrayValue, " "); } return(sb.ToString()); } case 7: if (DataConverter.CLng(dataTable.Rows[0][i]) != 0) { return("是"); } return("否"); } return(dataTable.Rows[0][i].ToString()); }
public static bool Delete(MessageDelType deleteType, string deleteValue) { switch (deleteType) { case MessageDelType.Id: if (DataValidator.IsValidId(deleteValue)) { break; } return(false); case MessageDelType.Sender: { string[] strArray = deleteValue.Split(new char[] { ',' }); StringBuilder sb = new StringBuilder(); for (int i = 0; i < strArray.Length; i++) { StringHelper.AppendString(sb, "'" + DataSecurity.FilterBadChar(strArray[i]) + "'"); } deleteValue = sb.ToString(); break; } case MessageDelType.Date: deleteValue = DataConverter.CLng(deleteValue).ToString(CultureInfo.CurrentCulture); break; } return(dal.Delete(deleteType, deleteValue)); }
public static IList <StatIPInfo> GetList(int startRowIndexId, int maxiNumRows, string searchIP, string searchAddress) { double num = DataValidator.IsIP(searchIP) ? StringHelper.EncodeIP(searchIP) : 0.0; string str = string.IsNullOrEmpty(searchAddress) ? string.Empty : DataSecurity.FilterBadChar(searchAddress.Trim()); return(dal.GetList(startRowIndexId, maxiNumRows, num, str)); }
public virtual async Task <CuentaModel> CrearNewCtrña(string idUsuario) { ApplicationUser user = await this.GetIdentityUser(idUsuario); if (user != null) { CuentaModel nLoginModel = await this.ToLoginModel(user); nLoginModel.NuevaContraseña = DataSecurity.GenerateRandomPassword(); IdentityResult res = await this.UserManager.ChangePasswordHashedCurrentAsync(idUsuario, user.PasswordHash, nLoginModel.NuevaContraseña); if (res.Succeeded) { user = await this.GetIdentityUser(idUsuario); user.ReqCambioContraseña = true; res = await this.UserManager.UpdateAsync(user); if (!res.Succeeded) { throw this.CraftException(res.Errors); } } else { throw this.CraftException(res.Errors); } return(nLoginModel); } return(null); }
public static IList <PaymentLogInfo> GetList(int startRowIndexId, int maxNumberRows, string searchType, string field, string keyword) { string str = searchType; if (str != null) { if (!(str == "6")) { if (str == "10") { if (field == "PayTime") { keyword = DataConverter.CDate(keyword).ToString(); } else { keyword = DataSecurity.FilterBadChar(keyword); } } } else if (string.IsNullOrEmpty(field)) { return(new List <PaymentLogInfo>()); } } return(dal.GetList(startRowIndexId, maxNumberRows, searchType, field, keyword)); }
protected override void Render(HtmlTextWriter writer) { string producerName = BasePage.RequestStringToLower("producername"); if (!Producer.ProducerNameExists(producerName)) { WriteErrMsg("您要查看的厂商不存在!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx"); } string templatePath = this.GetTemplatePath(); NameValueCollection values = new NameValueCollection(); values.Add("producername", DataSecurity.FilterBadChar(producerName)); if (!string.IsNullOrEmpty(templatePath)) { TemplateInfo templateInfo = new TemplateInfo(); templateInfo.QueryList = values; templateInfo.PageName = RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString); templateInfo.TemplateContent = Template.GetTemplateContent(templatePath); templateInfo.RootPath = HttpContext.Current.Request.PhysicalApplicationPath; templateInfo.CurrentPage = DataConverter.CLng(base.Request.QueryString["page"], 1); templateInfo.PageType = 1; templateInfo = TemplateTransform.GetHtml(templateInfo); writer.Write(templateInfo.TemplateContent); } else { WriteErrMsg("您查看的厂商未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx"); } }
protected void BtnUpload_Click(object sender, EventArgs e) { if (!this.FupFile.HasFile) { this.ReturnManage("请指定一个上传文件"); } else { int ftype = DataConverter.CLng(this.HdnType.Value); if (ftype == 1) { this.m_FileExtArr = "gif|jpg|png"; } else { this.m_FileExtArr = "swf"; } string str2 = Path.GetExtension(this.FupFile.FileName).ToLower(); if (!this.CheckFilePostfix(str2.Replace(".", ""))) { this.ReturnManage("上传的文件不是符合扩展名" + this.m_FileExtArr + "的文件"); } else { string str3 = DataSecurity.MakeFileRndName(); string foldername = base.Request.PhysicalApplicationPath + this.FileSavePath().Replace("/", "\\"); string filename = FileSystemObject.CreateFileFolder(foldername, HttpContext.Current) + str3 + str2; this.FupFile.SaveAs(filename); string thumbnailPath = this.m_ShowPath + str3 + str2; this.GetScriptByModuleName(thumbnailPath); this.ReturnManage("文件上传成功"); } } }
protected void BtnUpload_Click(object sender, EventArgs e) { int sizes = 0; if (!FupFile.HasFile) { ReturnManage("请指定一个上传文件"); return; } //if (!SafeSC.IsImage(FupFile.FileName)) { function.WriteErrMsg("只能上传图片文件"); } string ext = Path.GetExtension(FupFile.FileName).ToLower(); m_MaxFileSize = DataConverter.CLng(SiteConfig.SiteOption.UploadPicMaxSize); if (((int)FupFile.FileContent.Length) > (m_MaxFileSize * 0x400)) { ReturnManage("上传的文件超过限制的" + m_MaxFileSize + "KB大小"); return; } string ranFName = DataSecurity.MakeFileRndName() + ext;//文件名 string foldername = base.Request.PhysicalApplicationPath.TrimEnd('\\') + (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + FileSavePath()).Replace("/", "\\"); string fileName = FileSystemObject.CreateFileFolder(foldername, HttpContext.Current); string savePath = SafeSC.SaveFile(function.PToV(fileName), FupFile, ranFName); if (WaterModuleConfig.WaterConfig.IsUsed && SafeSC.IsImage(FupFile.FileName) && RadioButtonList1.SelectedValue == "1") { savePath = ImgHelper.AddWater(savePath); } sizes = (int)FupFile.FileContent.Length; GetScriptByModuleName(savePath.Replace(SiteConfig.SiteOption.UploadDir, ""), sizes); ReturnManage("文件上传成功"); }
public ActionResult Registrar() { if (this.DataService == null) { this.DataService = new CuentaDataService(this.GetIdentityUser(this.User.Identity.Name).Result, this.UserManager, this.RoleManager); } var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(this.DbContext)); try { RegisterViewModel model = new RegisterViewModel(); model.Password = DataSecurity.GenerateRandomPassword(); model.Roles = ViewBag.RolesList = roleManager.Roles.ToList(); return(View(model)); } catch (Exception) { throw; } return(View()); }
/// <summary> /// 会员登录 /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <returns></returns> public UserStatusEnum Login(string userName, string password) { UserStatusEnum result = UserStatusEnum.NoExist; string encryptedValue = StringHelper.MD5(password); if (password.Length == 32) { encryptedValue = password; } var entity = _repository.Get(p => p.UserName == userName && p.UserPassword == encryptedValue); if (entity == null || entity.UserID <= 0) { return(result); } switch ((UserStatusEnum)entity.UserStatus) { case UserStatusEnum.None: entity.LoginTimes++; entity.LoginTime = new DateTime?(DateTime.Now); entity.LoginIP = Utility.GetClientIP(); entity.LastPassword = DataSecurity.MakeRandomString(10); _repository.Update(entity); result = UserStatusEnum.None; break; default: result = (UserStatusEnum)entity.UserStatus; break; } return(result); }
public static UserStatus ValidateUser(UserInfo userInfo) { UserInfo usersByUserName = GetUsersByUserName(userInfo.UserName); if (usersByUserName.IsNull) { return((UserStatus)1); } string str = StringHelper.MD5(userInfo.UserPassword); if (!StringHelper.ValidateMD5(usersByUserName.UserPassword, str)) { return((UserStatus)0x65);//新加了as UserStatus } usersByUserName.UserPassword = str; userInfo.UserName = usersByUserName.UserName; userInfo.GroupName = usersByUserName.GroupName; userInfo.GroupId = usersByUserName.GroupId; string str2 = DataSecurity.MakeRandomString(10); userInfo.LastPassword = str2; usersByUserName.LogOnTimes++; usersByUserName.LastLogOnTime = new DateTime?(DateTime.Now); usersByUserName.LastLogOnIP = PEContext.Current.UserHostAddress; usersByUserName.LastPassword = str2; Update(usersByUserName); if (usersByUserName.Status > UserStatus.None) { return(usersByUserName.Status); } return(UserStatus.None); }
public override void OnInitTemplateInfo(EventArgs e) { string sourceName = BasePage.RequestString("copyfrom"); if (!Source.ExistsPassedSource(sourceName)) { TemplatePage.WriteErrMsg("指定的来源不存在!"); } string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath)); NameValueCollection values = new NameValueCollection(); values.Add("copyfrom", DataSecurity.FilterBadChar(sourceName)); if (!string.IsNullOrEmpty(dynamicConfigTemplatePath)) { TemplateInfo info = new TemplateInfo(); info.QueryList = values; 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.PageType = 1; base.TemplateInfo = info; } else { TemplatePage.WriteErrMsg("您查看的来源未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx"); } }
public static IList <ProductDetailInfo> GetProductsList(int startRowIndexId, int maxNumberRows, string searchType, string keyword, int nodeId, int listType, int status) { string nodeIds = string.Empty; GetSearchNodeIds(nodeId, ref nodeIds); return(dal.GetProductsList(startRowIndexId, maxNumberRows, DataSecurity.FilterBadChar(searchType), DataSecurity.FilterBadChar(keyword), nodeIds, listType, status)); }