public static string GetToken_Message(string appid, string secret) { string url = string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", appid, secret); string input = new WebUtils().DoGet(url, null); if (input.Contains("access_token")) { input = new JavaScriptSerializer().Deserialize<Token>(input).access_token; } return input; }
public BuildConnector(String url, Boolean getLastBuild) { String buildUrl; if (getLastBuild) { WebUtils webUtils = new WebUtils(); buildUrl = webUtils.uniteUrl(url, lastBuild); } else { buildUrl = url; } initBuild(buildUrl); }
public static void SendMessage(string accessTocken, TemplateMessage templateMessage) { StringBuilder builder = new StringBuilder("{"); builder.AppendFormat("\"touser\":\"{0}\",", templateMessage.Touser); builder.AppendFormat("\"template_id\":\"{0}\",", templateMessage.TemplateId); builder.AppendFormat("\"url\":\"{0}\",", templateMessage.Url); builder.AppendFormat("\"topcolor\":\"{0}\",", templateMessage.Topcolor); builder.Append("\"data\":{"); foreach (TemplateMessage.MessagePart part in templateMessage.Data) { builder.AppendFormat("\"{0}\":{{\"value\":\"{1}\",\"color\":\"{2}\"}},", part.Name, part.Value, part.Color); } builder.Remove(builder.Length - 1, 1); builder.Append("}}"); WebUtils utils = new WebUtils(); string url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessTocken; string str2 = utils.DoPost(url, builder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read)) { return; } if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite)) { IsAllowEdit = false; ConfirmPayrollSelectAllPanel.Visible = false; } binding = new Binding(dbConn, db); // Start 0000069, KuangWei, 2014-08-27 //binding.add(new DropDownVLBinder(EPayrollGroup.db, PayGroupID, EPayrollGroup.VLPayrollGroup)); initPayrollGroup(); // End 0000069, KuangWei, 2014-08-27 binding.add(CurrentPayPeriodID); // Start 0000069, KuangWei, 2014-08-27 //DBFilter payPeriodFilter = new DBFilter(); //if (!int.TryParse(PayGroupID.SelectedValue, out CurID)) // if (!int.TryParse(DecryptedRequest["PayGroupID"], out CurID)) // CurID = -1; //payPeriodFilter.add(new Match("PayGroupID", CurID)); //payPeriodFilter.add("PayPeriodFr", false); //DBFilter empPayrollFilter = new DBFilter(); //empPayrollFilter.add(new Match("EmpPayStatus", "C")); //empPayrollFilter.add(new IN("EmpPayrollID", "Select Distinct EmpPayrollID from " + ECostAllocation.db.dbclass.tableName, new DBFilter())); //payPeriodFilter.add(new IN("PayPeriodID", "Select Distinct PayPeriodID from " + EEmpPayroll.db.dbclass.tableName, empPayrollFilter)); //binding.add(new DropDownVLBinder(EPayrollPeriod.db, PayPeriodID, EPayrollPeriod.VLPayrollPeriod, payPeriodFilter)); // End 0000069, KuangWei, 2014-08-27 binding.init(Request, Session); sbinding = new SearchBinding(dbConn, EEmpPersonalInfo.db); if (!int.TryParse(PayPeriodID.SelectedValue, out CurPayPeriodID)) { if (!int.TryParse(DecryptedRequest["PayPeriodID"], out CurPayPeriodID)) { EPayrollGroup obj = new EPayrollGroup(); obj.PayGroupID = CurID; if (EPayrollGroup.db.select(dbConn, obj)) { CurPayPeriodID = obj.CurrentPayPeriodID; } else { CurPayPeriodID = -1; } } } info = ListFooter.ListInfo; HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls); }
void btnSearchUrls_Click(object sender, EventArgs e) { string pageUrl = SiteRoot + "/Admin/UrlManager.aspx?s=" + Server.UrlEncode(txtSearch.Text); WebUtils.SetupRedirect(this, pageUrl); }
public static JsonResponse Save(bool enableCompression, bool enableOptimization, bool compressWebResource, bool enableOpenSearch, bool requireSslForMetaWeblogApi, string wwwSubdomain, /*bool enableTrackBackSend, * bool enableTrackBackReceive, * bool enablePingBackSend, * bool enablePingBackReceive,*/ bool enableErrorLogging, bool allowRemoteFileDownloads, int remoteTimeout, int remoteMaxFileSize, string galleryFeedUrl, string enablePasswordReset, string enableSelfRegistration, string selfRegistrationInitialRole) { var response = new JsonResponse { Success = false }; var settings = BlogSettings.Instance; if (!WebUtils.CheckRightsForAdminSettingsPage(true)) { response.Message = "Not authorized"; return(response); } try { // Validate values before setting any of them to the BlogSettings instance. // Because it's a singleton, we don't want partial data being stored to // it if there's any exceptions thrown prior to saving. if (remoteTimeout < 0) { throw new ArgumentOutOfRangeException("RemoteFileDownloadTimeout must be greater than or equal to 0 milliseconds."); } else if (remoteMaxFileSize < 0) { throw new ArgumentOutOfRangeException("RemoteMaxFileSize must be greater than or equal to 0 bytes."); } settings.EnableHttpCompression = enableCompression; settings.EnableOptimization = enableOptimization; settings.CompressWebResource = compressWebResource; settings.EnableOpenSearch = enableOpenSearch; settings.RequireSslMetaWeblogApi = requireSslForMetaWeblogApi; settings.HandleWwwSubdomain = wwwSubdomain; settings.EnableErrorLogging = enableErrorLogging; settings.GalleryFeedUrl = galleryFeedUrl; settings.AllowServerToDownloadRemoteFiles = allowRemoteFileDownloads; settings.RemoteFileDownloadTimeout = remoteTimeout; settings.RemoteMaxFileSize = remoteMaxFileSize; settings.EnablePasswordReset = bool.Parse(enablePasswordReset); settings.EnableSelfRegistration = bool.Parse(enableSelfRegistration); settings.SelfRegistrationInitialRole = selfRegistrationInitialRole; settings.Save(); } catch (Exception ex) { Utils.Log(string.Format("admin.Settings.Advanced.Save(): {0}", ex.Message)); response.Message = string.Format("Could not save settings: {0}", ex.Message); return(response); } response.Success = true; response.Message = "Settings saved"; return(response); }
protected void Page_Load(object sender, EventArgs e) { template_path = WebUtils.GetWebPath(); Session.RemoveAll(); Response.Redirect(string.Format(SiteNavigation.link_adminPage_rewrite, Constant.DB.langVn)); }
private void IncluirPreCadastro() { EntEmpresaCadastro Empresa = new EntEmpresaCadastro(); EntTurmaEmpresa TurmaEmpresa = new EntTurmaEmpresa(); EntProgramaEmpresa UsuarioResponsavel = new EntProgramaEmpresa(); EntTurma Turma = new EntTurma(); string Senha; try { Empresa.RazaoSocial = TxtNome.Text.Trim(); Empresa.NomeFantasia = TxtNome.Text.Trim(); Empresa.CPF_CNPJ = TxtCnpjCpf.Text.Trim(); Empresa.PessoaJuridica = PessoaJuridica; Empresa.Ativo = true; Empresa.Estado.IdEstado = StringUtils.ToInt(ddlEstado.SelectedValue.ToString()); Empresa.AberturaEmpresa = new DateTime(1753, 1, 1); Empresa = new BllEmpresaCadastro().Inserir(Empresa); if (Empresa.IdEmpresaCadastro > 0) { Turma = new BllTurma().ObterPorId(StringUtils.ToInt(this.HddnFldTurma.Value.ToString())); TurmaEmpresa.Ativo = true; TurmaEmpresa.Turma = Turma; TurmaEmpresa.EmpresaCadastro = Empresa; TurmaEmpresa.Status = 0; TurmaEmpresa.ParticipaPrograma = true; new BllTurmaEmpresa().Inserir(TurmaEmpresa); UsuarioResponsavel.NomeResponsavel = TxtNome.Text; UsuarioResponsavel.Programa.IdPrograma = Turma.Programa.IdPrograma; UsuarioResponsavel.EmpresaCadastro = Empresa; UsuarioResponsavel.EmailResponsavel = TxtEmail.Text.Trim(); Senha = StringUtils.Random(4); UsuarioResponsavel.Senha = StringUtils.EncryptPassword(Senha); UsuarioResponsavel = new BllProgramaEmpresa().Inserir(UsuarioResponsavel); // Enviar email alertando para confirmar a alteração da senha. StringBuilder sMensagem = new StringBuilder(); String titulo = ""; sMensagem.AppendLine("Esta é uma Mensagem automática, não responda este e-mail."); sMensagem.AppendLine(); if (objPrograma.IdPrograma == EntPrograma.PROGRAMA_FGA) { sMensagem.AppendLine("Você foi convidado a participar da turma " + Turma.Turma + " do Programa FGA"); } else if (objPrograma.IdPrograma == EntPrograma.PROGRAMA_PEG) { sMensagem.AppendLine("Você foi convidado a participar da turma " + Turma.Turma + " do Programa PEG"); } sMensagem.AppendLine("acesse o link " + Request.Url.Scheme + System.Uri.SchemeDelimiter + Request.Url.Host + (Request.Url.IsDefaultPort ? "" : ":" + Request.Url.Port) + "/Paginas/Login.aspx "); sMensagem.AppendLine("informe o seu CPF/CNPJ e sua senha temporaria que é " + Senha); sMensagem.AppendLine("para terminar o seu cadastro e completar a sua inscrição."); sMensagem.AppendLine(); if (objPrograma.IdPrograma == EntPrograma.PROGRAMA_FGA) { sMensagem.AppendLine("Administração FGA."); titulo = "Pré-Cadastro FGA"; } else if (objPrograma.IdPrograma == EntPrograma.PROGRAMA_PEG) { sMensagem.AppendLine("Administração PEG."); titulo = "Pré-Cadastro PEG"; } WebUtils.EnviaEmail(TxtEmail.Text.Trim(), titulo, sMensagem); MessageBox(this.Page, "O convite de participação da Turma foi enviada para o responsável pela empresa: " + TxtEmail.Text.Trim() + "\\nSe o e-mail estiver incorreto, contate o Gestor do Programa no seu Estado."); this.Clear(); this.Close(); AtualizaGridEmpresasDelegate(); } } catch (Exception) { throw; } }
public bool DeliverNotify(DeliverInfo deliver, string token) { PayDictionary parameters = new PayDictionary(); parameters.Add("appid", this._payAccount.AppId); parameters.Add("openid", deliver.OpenId); parameters.Add("transid", deliver.TransId); parameters.Add("out_trade_no", deliver.OutTradeNo); parameters.Add("deliver_timestamp", Utils.GetTimeSeconds(deliver.TimeStamp)); parameters.Add("deliver_status", deliver.Status ? 1 : 0); parameters.Add("deliver_msg", deliver.Message); deliver.AppId = this._payAccount.AppId; deliver.AppSignature = SignHelper.SignPay(parameters, ""); parameters.Add("app_signature", deliver.AppSignature); parameters.Add("sign_method", deliver.SignMethod); string data = JsonConvert.SerializeObject(parameters); string url = string.Format("{0}?access_token={1}", Deliver_Notify_Url, token); string str3 = new WebUtils().DoPost(url, data); if (!(!string.IsNullOrEmpty(str3) && str3.Contains("ok"))) { return false; } return true; }
public DataView loadNotTrialRunData(ListInfo info, DBManager db, Repeater repeater) { DBFilter filter = sNotTrialRunEmpBinding.createFilter(); //if (info != null && info.orderby != null && !info.orderby.Equals("")) // filter.add(info.orderby, info.order); string select = "e.* "; string from = "from [" + db.dbclass.tableName + "] e, [EmpPositionInfo] ep, [PayrollPeriod] pp "; filter.add(new MatchField("e.EmpID", "ep.EmpID")); filter.add(new MatchField("ep.PayGroupID", "pp.PayGroupID")); filter.add(new MatchField("ep.EmpPosEffFr", "<=", "pp.PayPeriodTo")); filter.add(new MatchField("e.EmpDateOfJoin", "<=", "pp.PayPeriodTo")); filter.add(new Match("pp.PayPeriodID", CurPayPeriodID)); OR orFilter = new OR(); orFilter.add(new MatchField("ep.EmpPosEffTo", ">=", "pp.PayPeriodFr")); orFilter.add(new NullTerm("ep.EmpPosEffTo")); filter.add(orFilter); filter.add(new IN("Not e.empid", "Select et.empid from [EmpTermination] et where et.EmpTermLastDate<pp.PayPeriodFr", new DBFilter())); filter.add(new IN("Not e.empid", "Select ep.empid from [EmpPayroll] ep where pp.PayPeriodID=ep.PayPeriodID and ep.EmpPayIsRP='Y'", new DBFilter())); // Start 0000185, KuangWei, 2015-04-21 DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime()); empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID")); filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter)); DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info); table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info); // End 0000185, KuangWei, 2015-04-21 if (table.Rows.Count > 0) // Start 0000096, KuangWei, 2014-09-18 { panelNotTrialRunEmployeeList.Visible = true; //& panelProcessEndOption.Visible; notTrialRunCount = table.Rows.Count; //string msg = notTrialRunCount + " of employees have not been run!!! Are you sure to end this payroll process?"; string msg = "Certain number of employees have not been run!!! Are you sure to end this payroll process?"; btnProcessEnd.OnClientClick = HROne.Translation.PromptMessage.CreateConfirmDialogJavascript(HROne.Common.WebUtility.GetLocalizedString(msg)); } // End 0000096, KuangWei, 2014-09-18 else { panelNotTrialRunEmployeeList.Visible = false; } NotTrialRunEmpView = new DataView(table); NotTrialRun_ListFooter.Refresh(); if (repeater != null) { repeater.DataSource = NotTrialRunEmpView; repeater.DataBind(); } return(NotTrialRunEmpView); }
public bool UpdateFeedback(string feedbackid, string openid, string token) { string url = string.Format("{0}?access_token={1}&openid={2}&feedbackid={3}", new object[] { Update_Feedback_Url, token, openid, feedbackid }); string str2 = new WebUtils().DoGet(url); if (!(!string.IsNullOrEmpty(str2) && str2.Contains("ok"))) { return false; } return true; }
public LogConnector(String url) { WebUtils webUtils = new WebUtils(); this.log = webUtils.getResponse(url, urlEnding); }
public BuildConnector(String jobUrl, int buildNumber) { WebUtils webUtils = new WebUtils(); String buildUrl = webUtils.uniteUrl(jobUrl, buildNumber.ToString()); initBuild(buildUrl); }
private void initBuild(String buildUrl) { WebUtils webUtils = new WebUtils(); String response = webUtils.getResponse(buildUrl, urlEnding); initXml(response); }
public ViewConnector(String url) { WebUtils webUtils = new WebUtils(); String response = webUtils.getResponse(url, urlEnding); initXml(response); }
public string ProcessRawUrl(HttpListenerRequest request) { return(WebUtils.MergeStrings(WebUtils.ReadPage(request.RawUrl))); }
public List <string> GetAgentsLocations(string requestor, List <string> userIDs) { Dictionary <string, object> sendData = new Dictionary <string, object>(); //sendData["SCOPEID"] = scopeID.ToString(); sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); sendData["METHOD"] = "getagents"; sendData["uuids"] = userIDs; List <string> rinfos = new List <string>(); List <string> urls = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("PresenceServerURI"); foreach (string url in urls) { string reply = string.Empty; string reqString = WebUtils.BuildQueryString(sendData); //MainConsole.Instance.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); try { reply = SynchronousRestFormsRequester.MakeRequest("POST", url, reqString); if (reply == null || (reply != null && reply == string.Empty)) { return(null); } } catch (Exception) { } Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { if (replyData.ContainsKey("result") && (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) { return(new List <string>()); } Dictionary <string, object> .ValueCollection pinfosList = replyData.Values; #if (!ISWIN) foreach (object presence in pinfosList) { if (presence is Dictionary <string, object> ) { string regionUUID = ((Dictionary <string, object>)presence)["RegionID"].ToString(); rinfos.Add(GetRegionService(UUID.Parse(regionUUID))); } } #else rinfos.AddRange(pinfosList.OfType <Dictionary <string, object> >().Select(presence => (presence)["RegionID"].ToString()).Select(regionUUID => GetRegionService(UUID.Parse(regionUUID)))); #endif } } return(rinfos); }
public JobConnector(String jobUrl) { WebUtils webUtils = new WebUtils(); String response = webUtils.getResponse(jobUrl, urlEnding); initXml(response); }
protected void Page_Load(object sender, EventArgs e) { PasswordReminderButton.Visible = (ConfigurationManager.AppSettings.GetBoolValue("PasswordResetEnabled")); if (!Page.IsPostBack) { if (!CurrentUser.IsNull && WebUtils.GetRequestParam("action") == "logout") { SessionEndModule.EndSession(); LoginManager.Logout(CurrentUser); SessionInfo.Current.Reset(); const string url = "~/login.aspx?message=LoggedOut"; Response.Redirect(url, false); return; } // Get message key from querystring string message = WebUtils.GetRequestParam("message", string.Empty); switch (message) { case "AccountReactivated": MessageLabel1.SetSuccessMessage("Your account has been reactivated successfully"); break; case "PasswordChanged": MessageLabel1.SetSuccessMessage("Your new password has been activated"); break; case "LoggedOut": MessageLabel1.SetSuccessMessage("You have been logged out"); break; case "EmailConfirmed": MessageLabel1.SetSuccessMessage("Your email address has been confirmed. Please login below."); break; case "AccessDenied": MessageLabel1.SetErrorMessage("Access to the requested page is denied due to insufficient user credentials."); break; case "NoUserOnLoad": case "NoUserOnPostback": break; } string cookieEmail = CookieManager.GetValue("EmailAddress"); RememberMeCheckBox.Checked = (cookieEmail != string.Empty); DropDownList dd = SiteUtils.FindControlRecursive(Page, "UserDropDownList") as DropDownList; if (dd != null) { ListItem li = dd.Items.FindByValue(cookieEmail); if (li != null) { dd.SelectedIndex = -1; li.Selected = true; } } else { EmailTextBox.Text = cookieEmail; } } }
public static IEnumerable LoadPages(string type) { WebUtils.CheckRightsForAdminPagesPages(false); return(JsonPages.GetPages(type)); }
void btnPurgeSendLog_Click(object sender, EventArgs e) { LetterSendLog.DeleteByLetter(letterGuid); WebUtils.SetupRedirect(this, Request.RawUrl); }
public DBFilter GetEmpInfoFilter(DateTime FromDate, DateTime ToDate) { FromDate = FromDate.Date; ToDate = ToDate.Date; DBFilter filter = binding.createFilter(); DateTime dtPeriodFr, dtPeriodTo; if (DateTime.TryParse(JoinDateFrom.Value, out dtPeriodFr)) { filter.add(new Match("ee.EmpDateOfJoin", ">=", dtPeriodFr)); } if (DateTime.TryParse(JoinDateTo.Value, out dtPeriodTo)) { filter.add(new Match("ee.EmpDateOfJoin", "<=", dtPeriodTo)); } //if (EmpStatus.SelectedValue.Equals("A") || EmpStatus.SelectedValue.Equals("T") || EmpStatus.SelectedValue.Equals("TERMINATED")) // filter.add(new Match("EmpDateOfJoin", "<=", ToDate.Date)); filter.add(WebUtils.AddRankFilter(Session, "ee.EmpID", true)); DateTime dtLastDateFr, dtLastDateTo; DBFilter empTerminationFilter = new DBFilter(); if (DateTime.TryParse(LastDateFrom.Value, out dtLastDateFr)) { empTerminationFilter.add(new Match("searchet.EmpTermLastDate", ">=", dtLastDateFr)); } if (DateTime.TryParse(LastDateTo.Value, out dtLastDateTo)) { empTerminationFilter.add(new Match("searchet.EmpTermLastDate", "<=", dtLastDateTo)); } if (EmpStatus.SelectedValue.Equals("TERMINATED")) { empTerminationFilter.add(new Match("searchet.EmpTermLastDate", "<", FromDate.Date)); } if (empTerminationFilter.terms().Count > 0 || EmpStatus.SelectedValue.Equals("T")) { empTerminationFilter.add(new MatchField("ee.EmpID", "searchet.EmpID")); filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchet ", empTerminationFilter)); } if (EmpStatus.SelectedValue.Equals("AT")) { DBFilter notExistsEmpTerminationFilter = new DBFilter(); notExistsEmpTerminationFilter.add(new Match("searchnoet.EmpTermLastDate", "<", FromDate.Date)); notExistsEmpTerminationFilter.add(new MatchField("ee.EmpID", "searchnoet.EmpID")); filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchnoet ", notExistsEmpTerminationFilter, true)); } if (EmpStatus.SelectedValue.Equals("A")) { DBFilter notExistsEmpTerminationFilter = new DBFilter(); notExistsEmpTerminationFilter.add(new MatchField("ee.EmpID", "searchnoet.EmpID")); filter.add(new Exists(EEmpTermination.db.dbclass.tableName + " searchnoet ", notExistsEmpTerminationFilter, true)); } DBFilter empPosFilter = new DBFilter(); //{ // OR orPositionTerm = null; // foreach (ListItem item in PositionList.Items) // if (item.Selected) // { // if (orPositionTerm == null) // orPositionTerm = new OR(); // orPositionTerm.add(new Match("searchepi.PositionID", item.Value)); // } // if (orPositionTerm != null) // empPosFilter.add(orPositionTerm); //} DBTerm positionDBTerm = CreateDBTermsFromListControl("searchepi.PositionID", EPosition.db.dbclass.tableName + " pos", "pos.PositionID", PositionList.ListControl); if (positionDBTerm != null) { empPosFilter.add(positionDBTerm); } DBTerm rankDBTerms = CreateDBTermsFromListControl("searchepi.RankID", ERank.db.dbclass.tableName + " rank", "rank.RankID", RankList.ListControl); if (rankDBTerms != null) { empPosFilter.add(rankDBTerms); } DBTerm employmentTypeDBTerms = CreateDBTermsFromListControl("searchepi.EmploymentTypeID", EEmploymentType.db.dbclass.tableName + " empType", "empType.EmploymentTypeID", EmploymentTypeList.ListControl); if (employmentTypeDBTerms != null) { empPosFilter.add(employmentTypeDBTerms); } DBTerm staffTypeDBTerms = CreateDBTermsFromListControl("searchepi.StaffTypeID", EStaffType.db.dbclass.tableName + " staffType", "staffType.StaffTypeID", StaffTypeList.ListControl); if (staffTypeDBTerms != null) { empPosFilter.add(staffTypeDBTerms); } DBTerm payrollGroupDBTerms = CreateDBTermsFromListControl("searchepi.PayGroupID", EPayrollGroup.db.dbclass.tableName + " payGroup", "payGroup.PayGroupID", PayrollGroupList.ListControl); if (payrollGroupDBTerms != null) { empPosFilter.add(payrollGroupDBTerms); } DBTerm companyAndHierarchyTerm = HierarchyCheckBoxList1.GetFilters("searchepi", "EmpPosID"); if (companyAndHierarchyTerm != null) { empPosFilter.add(companyAndHierarchyTerm); } if (empPosFilter.terms().Count > 0) { empPosFilter.add(new MatchField("ee.EmpID", "searchepi.EmpID")); EEmpPositionInfo.DBFilterAddDateRange(empPosFilter, "searchepi", FromDate, ToDate); OR orEmpPosTerm = new OR(); orEmpPosTerm.add(new Exists(EEmpPositionInfo.db.dbclass.tableName + " searchepi ", empPosFilter)); filter.add(orEmpPosTerm); } //DBFilter empPosNotExistsFilter = new DBFilter(); //empPosNotExistsFilter.add(new MatchField("ee.EmpID", "np.EmpID")); //orEmpPosTerm.add(new Exists(EEmpPositionInfo.db.dbclass.tableName + " np", empPosNotExistsFilter, true)); return(filter); }
private void btnSave_Click(object sender, EventArgs e) { Page.Validate("poll"); if (Page.IsValid) { Poll poll = new Poll(pollGuid); poll.SiteGuid = siteSettings.SiteGuid; poll.Question = txtQuestion.Text; poll.AnonymousVoting = chkAnonymousVoting.Checked; poll.AllowViewingResultsBeforeVoting = chkAllowViewingResultsBeforeVoting.Checked; poll.ShowOrderNumbers = chkShowOrderNumbers.Checked; poll.ShowResultsWhenDeactivated = chkShowResultsWhenDeactivated.Checked; if (dpActiveFrom.Text.Length > 0 && poll.ActiveFrom >= DateTime.UtcNow) { // You can't change date if poll has started. // TODO: promt user if invalid format/date DateTime activeFrom; DateTime.TryParse(dpActiveFrom.Text, out activeFrom); if (timeZone != null) { activeFrom = activeFrom.ToUtc(timeZone); } else { activeFrom = activeFrom.AddHours(-timeOffset); } poll.ActiveFrom = activeFrom; } if (dpActiveTo.Text.Length > 0) { // TODO: promt user if invalid format/date DateTime activeTo; DateTime.TryParse(dpActiveTo.Text, out activeTo); if (timeZone != null) { activeTo = activeTo.ToUtc(timeZone); } else { activeTo = activeTo.AddHours(-timeOffset); } // Make time 23:59:59 //activeTo = activeTo.AddHours(23).AddMinutes(59).AddSeconds(59); // You can't change to past date. if (activeTo >= DateTime.UtcNow) { poll.ActiveTo = activeTo; } } if (chkStartDeactivated.Checked) { // This only happens when new poll. poll.Deactivate(); } else { poll.Activate(); } poll.Save(); // Get options PollOption option; int order = 1; foreach (ListItem item in lbOptions.Items) { if (item.Text == item.Value) { option = new PollOption(); } else { if (item.Value.Length == 36) { option = new PollOption(new Guid(item.Value)); } else { option = new PollOption(); } } option.PollGuid = poll.PollGuid; option.Answer = item.Text; option.Order = order++; option.Save(); } WebUtils.SetupRedirect(this, SiteRoot + "/Poll/PollChoose.aspx" + "?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() ); } }
//public DataTable FilterEncryptedEmpInfoField(DataTable table) //{ // return FilterEncryptedEmpInfoField(table, null); //} public DataTable FilterEncryptedEmpInfoField(DataTable table, ListInfo info) { //binding.add(new LikeSearchBinder(EmpNo, "EmpNo")); //binding.add(new LikeSearchBinder(EmpEngSurname, "EmpEngSurname")); //binding.add(new LikeSearchBinder(EmpEngOtherName, "EmpEngOtherName")); //binding.add(new LikeSearchBinder(EmpChiFullName, "EmpChiFullName")); //binding.add(new LikeSearchBinder(EmpAlias, "EmpAlias")); //binding.add(new DropDownVLSearchBinder(EmpGender, "EmpGender", Values.VLGender).setLocale(ci)); if (!string.IsNullOrEmpty(EmpNo.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpNo"); DataView view = new DataView(table); view.RowFilter = "EmpNo like '%" + EmpNo.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpEngSurname.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpEngSurname"); DataView view = new DataView(table); view.RowFilter = "EmpEngSurname like '%" + EmpEngSurname.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpEngOtherName.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpEngOtherName"); DataView view = new DataView(table); view.RowFilter = "EmpEngOtherName like '%" + EmpEngOtherName.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpChiFullName.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpChiFullName"); DataView view = new DataView(table); view.RowFilter = "EmpChiFullName like '%" + EmpChiFullName.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpAlias.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpAlias"); DataView view = new DataView(table); view.RowFilter = "EmpAlias like '%" + EmpAlias.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpGender.SelectedValue)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpGender"); DataView view = new DataView(table); view.RowFilter = "EmpGender = '" + EmpGender.SelectedValue.Replace("'", "''") + "' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpHKID.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpHKID"); DataView view = new DataView(table); view.RowFilter = "EmpHKID like '%" + EmpHKID.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(EmpPassportNo.Text)) { DBAESEncryptStringFieldAttribute.decode(table, "EmpPassportNo"); DataView view = new DataView(table); view.RowFilter = "EmpPassportNo like '%" + EmpPassportNo.Text.Trim().Replace("'", "''") + "%' "; table = view.ToTable(); } if (!string.IsNullOrEmpty(info.orderby)) { if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase)) { if (!table.Columns.Contains("EmpEngFullName")) { table.Columns.Add("EmpEngFullName", typeof(string)); foreach (System.Data.DataRow row in table.Rows) { if (row["EmpID"] != DBNull.Value) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = (int)row["EmpID"]; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { row["EmpEngFullName"] = empInfo.EmpEngFullName; } } } } } } return(WebUtils.DataTableSortingAndPaging(table, info)); }
private dynamic ListAllFilesFolders(string requestPath) { var filePath = FilePath(requestPath); var files = fileSystem.GetFileList(filePath).Select(Mapper.Map <WebFile, FileServiceDto>).ToList(); var folders = fileSystem.GetFolderList(filePath).Select(Mapper.Map <WebFolder, FileServiceDto>).ToList(); var allowedFiles = new List <FileServiceDto>(); if ( requestPath == "/" && !string.IsNullOrWhiteSpace(fileSystem.Permission.UserFolder) && fileSystem.Permission.UserFolder != fileSystem.VirtualRoot ) { var userFolder = new List <WebFolder>() { new WebFolder { VirtualPath = fileSystem.Permission.UserFolder, Path = fileSystem.Permission.UserFolder, Created = DateTime.Now, Modified = DateTime.Now, Name = Resource.UserFolder } }; folders.AddRange(userFolder.Select(Mapper.Map <WebFolder, FileServiceDto>).ToList()); } var type = WebUtils.ParseStringFromQueryString("type", "file"); foreach (var folder in folders) { folder.ContentType = "dir"; } foreach (var file in files) { if ((type == "image") && !file.IsWebImageFile()) { continue; } if ((type == "media" || type == "audio" || type == "video") && !file.IsAllowedMediaFile()) { continue; } if ((type == "audio") && !file.IsAllowedFileType(WebConfigSettings.AudioFileExtensions)) { continue; } if ((type == "video") && !file.IsAllowedFileType(WebConfigSettings.VideoFileExtensions)) { continue; } if ((type == "file") && !file.IsAllowedFileType(allowedExtensions)) { continue; } file.ContentType = "file"; allowedFiles.Add(file); } return(new { result = folders.Concat(allowedFiles) }); }
public ActionResult LogOut() { WebUtils.AbandonSession(); return(this.SuccessData()); }
protected void Page_Load(object sender, EventArgs e) { WebUtils.CheckRightsForAdminPostPages(false); }
public async void TestMethod1() { WebUtils controller = new WebUtils(); string str = await controller.DoPost(null, null); }
private void dlUrlMap_ItemCommand(object sender, DataListCommandEventArgs e) { int urlID = Convert.ToInt32(dlUrlMap.DataKeys[e.Item.ItemIndex]); FriendlyUrl friendlyUrl = new FriendlyUrl(urlID); switch (e.CommandName) { case "edit": dlUrlMap.EditItemIndex = e.Item.ItemIndex; Control c = e.Item.FindControl("ddPagesEdit"); DropDownList dd = null; if ((c != null) && (pageList != null)) { dd = (DropDownList)c; dd.DataSource = pageList; dd.DataBind(); } PopulateControls(); if (dd != null) { String selection = ParsePageId(friendlyUrl.RealUrl); if (selection.Length > 0) { ListItem listItem = dd.Items.FindByValue(selection); if (listItem != null) { dd.ClearSelection(); listItem.Selected = true; } } } break; case "apply": TextBox txtItemFriendlyUrl = (TextBox)e.Item.FindControl("txtItemFriendlyUrl"); if (txtItemFriendlyUrl.Text.Length > 0) { Control cEdit = e.Item.FindControl("ddPagesEdit"); if (cEdit != null) { DropDownList ddEdit = (DropDownList)cEdit; friendlyUrl.Url = txtItemFriendlyUrl.Text; if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } int pageId = -1; if (int.TryParse(ddEdit.SelectedValue, out pageId)) { if (pageId > -1) { PageSettings page = new PageSettings(siteSettings.SiteId, pageId); friendlyUrl.PageGuid = page.PageGuid; } } friendlyUrl.RealUrl = "Default.aspx?pageid=" + ddEdit.SelectedValue; friendlyUrl.Save(); } WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidFriendlyUrlMessage; } break; case "applymanual": if ( ( (((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text.Length > 0) ) && ( (((TextBox)e.Item.FindControl("txtItemRealUrl")).Text.Length > 0) ) ) { friendlyUrl.Url = ((TextBox)e.Item.FindControl("txtItemFriendlyUrl")).Text; if (WebPageInfo.IsPhysicalWebPage("~/" + friendlyUrl.Url)) { this.lblError.Text = Resource.FriendlyUrlWouldMaskPhysicalPageWarning; return; } friendlyUrl.RealUrl = ((TextBox)e.Item.FindControl("txtItemRealUrl")).Text; friendlyUrl.PageGuid = Guid.Empty; friendlyUrl.Save(); WebUtils.SetupRedirect(this, Request.RawUrl); } else { this.lblError.Text = Resource.FriendlyUrlInvalidEntryMessage; } break; case "delete": FriendlyUrl.DeleteUrl(urlID); WebUtils.SetupRedirect(this, Request.RawUrl); break; case "cancel": WebUtils.SetupRedirect(this, Request.RawUrl); break; } }
private void ShowImage() { if (moduleId == -1) { return; } Gallery gallery = new Gallery(moduleId); DataTable dt = gallery.GetWebImageByPage(pageNumber); if (dt.Rows.Count > 0) { itemId = Convert.ToInt32(dt.Rows[0]["ItemID"]); totalPages = Convert.ToInt32(dt.Rows[0]["TotalPages"]); } showTechnicalData = WebUtils.ParseBoolFromHashtable( moduleSettings, "GalleryShowTechnicalDataSetting", false); if (itemId == -1) { return; } Literal topPageLinks = new Literal(); string pageUrl = SiteRoot + "/ImageGallery/GalleryBrowse.aspx?" + "pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&pagenumber="; topPageLinks.Text = UIHelper.GetPagerLinksWithPrevNext( pageUrl, 1, this.totalPages, this.pageNumber, "modulepager", "SelectedPage"); this.spnTopPager.Controls.Add(topPageLinks); GalleryImage galleryImage = new GalleryImage(moduleId, itemId); imageLink.Text = "<a onclick=\"window.open(this.href,'_blank');return false;\" href='" + ImageSiteRoot + fullSizeBaseUrl + galleryImage.ImageFile + "' ><img src='" + ImageSiteRoot + webSizeBaseUrl + galleryImage.WebImageFile + "' alt='" + Resources.GalleryResources.GalleryWebImageAltText + "' /></a>"; this.pnlGallery.Controls.Add(imageLink); this.lblCaption.Text = Server.HtmlEncode(galleryImage.Caption); this.lblDescription.Text = galleryImage.Description; if (showTechnicalData) { if (galleryImage.MetaDataXml.Length > 0) { xmlMeta.DocumentContent = galleryImage.MetaDataXml; string xslPath = System.Web.HttpContext.Current.Server.MapPath(SiteRoot + "/ImageGallery/GalleryMetaData.xsl"); xmlMeta.TransformSource = xslPath; } } }
public string DefaultPage() { string[] content = WebUtils.ReadPage("gameUI.html"); return(WebUtils.MergeStrings(content)); }
public void AddContent_OnClick(object sender, EventArgs e) { var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId); PageUtils.Redirect(WebUtils.GetContentAddAddUrl(PublishmentSystemId, nodeInfo, PageUrl)); }
private void LoadParams() { PageId = WebUtils.ParseInt32FromQueryString("pageid", PageId); ModuleId = WebUtils.ParseInt32FromQueryString("mid", ModuleId); canEdit = UserCanEditModule(ModuleId, RssFeed.FeatureGuid); }
static void Main(string[] args) { try { Logger.ShortenSourceName = true; try { OldConfig.Initialize(); Logger.LogLevel = OldConfig.StrToLogLevel(OldConfig.LoggingLevel); if (Logger.LogLevel < LogLevel.Info) { Logger.ShortenSourceName = false; } } catch (FileNotFoundException ex) { Logger.Exception("Error initializing Config", ex); } Logger.Info($"Using Beat Saber directory: {OldConfig.BeatSaberPath}"); ScrapedDataProvider.Initialize(); Logger.Info($"Scrapes loaded, {ScrapedDataProvider.BeatSaverSongs.Data.Count} BeatSaverSongs and {ScrapedDataProvider.ScoreSaberSongs.Data.Count} ScoreSaber difficulties loaded"); //DoFullScrape(); //var scoreSaberSongs = ScrapedDataProvider.ScoreSaberSongs.Data.Select(ss => ss.hash).Distinct().Count(); //var activeSongs = ScrapedDataProvider.Songs.Values.Where(s => s.ScoreSaberInfo?.Values.Count > 0).Count(); //Tests(); try { if (args.Length > 0) { var bsDir = new DirectoryInfo(args[0]); if (bsDir.Exists) { if (bsDir.GetFiles("Beat Saber.exe").Length > 0) { Logger.Info("Found Beat Saber.exe"); OldConfig.BeatSaberPath = bsDir.FullName; Logger.Info($"Updated Beat Saber directory path to {OldConfig.BeatSaberPath}"); Console.WriteLine("Press any key to continue..."); Console.ReadKey(); } else { Logger.Warning($"Provided directory does not appear to be Beat Saber's root folder, ignoring it"); } } } } catch (Exception ex) { Logger.Exception($"Error parsing command line arguments", ex); } if (!OldConfig.CriticalError) { WebUtils.Initialize(OldConfig.MaxConcurrentPageChecks); Stopwatch sw = new Stopwatch(); sw.Start(); SyncSaber ss = new SyncSaber(); ss.ScrapeNewSongs(); Console.WriteLine(); if (OldConfig.SyncFavoriteMappersFeed && OldConfig.FavoriteMappers.Count > 0) { Logger.Info($"Downloading songs from FavoriteMappers.ini..."); try { ss.DownloadSongsFromFeed(BeatSaverReader.NameKey, new BeatSaverFeedSettings(0) { Authors = OldConfig.FavoriteMappers.ToArray() }); } catch (AggregateException ae) { ae.WriteExceptions($"Exceptions downloading songs from FavoriteMappers.ini."); } catch (Exception ex) { Logger.Exception("Exception downloading songs from FavoriteMappers.ini.", ex); } } else { if (OldConfig.SyncFavoriteMappersFeed) { Logger.Warning($"Skipping FavoriteMappers.ini feed, no authors found in {Path.Combine(OldConfig.BeatSaberPath, "UserData", "FavoriteMappers.ini")}"); } } if (OldConfig.SyncFollowingsFeed) { // Followings Console.WriteLine(); Logger.Info($"Downloading songs from {BeastSaberReader.Feeds[BeastSaberFeeds.FOLLOWING].Name} feed..."); try { //ss.DownloadBeastSaberFeed(0, Web.BeastSaberReader.GetMaxBeastSaberPages(0)); ss.DownloadSongsFromFeed(BeastSaberReader.NameKey, new BeastSaberFeedSettings(0) { MaxPages = OldConfig.MaxFollowingsPages }); } catch (AggregateException ae) { ae.WriteExceptions($"Exceptions downloading songs from BeastSaberFeed: Following."); } catch (Exception ex) { Logger.Exception($"Exception downloading BeastSaberFeed: Following", ex); } } // Bookmarks if (OldConfig.SyncBookmarksFeed) { Console.WriteLine(); Logger.Info($"Downloading songs from {BeastSaberReader.Feeds[BeastSaberFeeds.BOOKMARKS].Name} feed..."); try { //ss.DownloadBeastSaberFeed(1, Web.BeastSaberReader.GetMaxBeastSaberPages(1)); ss.DownloadSongsFromFeed(BeastSaberReader.NameKey, new BeastSaberFeedSettings(1) { MaxPages = OldConfig.MaxBookmarksPages }); } catch (AggregateException ae) { ae.WriteExceptions($"Exceptions downloading songs from BeastSaberFeed: Bookmarks."); } catch (Exception ex) { Logger.Exception($"Exception downloading BeastSaberFeed: Bookmarks", ex); } } if (OldConfig.SyncCuratorRecommendedFeed) { // Curator Recommended Console.WriteLine(); Logger.Info($"Downloading songs from {BeastSaberReader.Feeds[BeastSaberFeeds.CURATOR_RECOMMENDED].Name} feed..."); try { //ss.DownloadBeastSaberFeed(2, Web.BeastSaberReader.GetMaxBeastSaberPages(2)); ss.DownloadSongsFromFeed(BeastSaberReader.NameKey, new BeastSaberFeedSettings(2) { MaxPages = OldConfig.MaxCuratorRecommendedPages }); } catch (AggregateException ae) { ae.WriteExceptions($"Exceptions downloading songs from BeastSaberFeed: Curator Recommended."); } catch (Exception ex) { Logger.Exception($"Exception downloading BeastSaberFeed: Curator Recommended", ex); } } if (OldConfig.SyncTopPPFeed) { // ScoreSaber Top PP Console.WriteLine(); Logger.Info($"Downloading songs from {ScoreSaberReader.Feeds[ScoreSaberFeeds.TOP_RANKED].Name} feed..."); try { //ss.DownloadBeastSaberFeed(2, Web.BeastSaberReader.GetMaxBeastSaberPages(2)); ss.DownloadSongsFromFeed(ScoreSaberReader.NameKey, new ScoreSaberFeedSettings((int)ScoreSaberFeeds.TOP_RANKED) { MaxSongs = 1000,//Config.MaxScoreSaberSongs, SongsPerPage = 10, searchOnline = true }); } catch (AggregateException ae) { ae.WriteExceptions($"Exceptions downloading songs from ScoreSaberFeed: Top Ranked."); } catch (Exception ex) { Logger.Exception($"Exception downloading ScoreSaberFeed: Top Ranked.", ex); } } /* * Console.WriteLine(); * Logger.Info($"Downloading newest songs on Beat Saver..."); * try * { * ss.DownloadSongsFromFeed(BeatSaverReader.NameKey, new BeatSaverFeedSettings(1) { * MaxPages = Config.MaxBeatSaverPages * }); * } * * catch (Exception ex) * { * Logger.Exception("Exception downloading BeatSaver newest feed.", ex); * } */ sw.Stop(); var processingTime = new TimeSpan(sw.ElapsedTicks); Console.WriteLine(); Logger.Info($"Finished downloading songs in {(int)processingTime.TotalMinutes} min {processingTime.Seconds} sec"); } else { foreach (string e in OldConfig.Errors) { Logger.Error($"Invalid setting: {e} = {OldConfig.Setting[e]}"); } } ScrapedDataProvider.BeatSaverSongs.WriteFile(); ScrapedDataProvider.ScoreSaberSongs.WriteFile(); } catch (OutOfDateException ex) { Logger.Error(ex.Message); } catch (AggregateException ae) { ae.WriteExceptions($"Uncaught exceptions in Main()"); } catch (Exception ex) { Logger.Exception("Uncaught exception in Main()", ex); } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId"); var channelId = AuthRequest.GetQueryInt("channelId"); var contentId = AuthRequest.GetQueryInt("id"); ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl")); if (string.IsNullOrEmpty(ReturnUrl)) { ReturnUrl = CmsPages.GetContentsUrl(SiteId, channelId); } _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); ContentInfo contentInfo = null; _styleInfoList = TableStyleManager.GetContentStyleInfoList(SiteInfo, _channelInfo); if (!IsPermissions(contentId)) { return; } if (contentId > 0) { contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId); } var titleFormat = IsPostBack ? Request.Form[ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)] : contentInfo?.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)); LtlTitleHtml.Text = ContentUtility.GetTitleHtml(titleFormat, AjaxCmsService.GetTitlesUrl(SiteId, _channelInfo.Id)); AcAttributes.SiteInfo = SiteInfo; AcAttributes.ChannelId = _channelInfo.Id; AcAttributes.ContentId = contentId; AcAttributes.StyleInfoList = _styleInfoList; if (!IsPostBack) { var pageTitle = contentId == 0 ? "添加内容" : "编辑内容"; LtlPageTitle.Text = pageTitle; if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentTranslate)) { PhTranslate.Visible = true; BtnTranslate.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(SiteId, true)); ETranslateContentTypeUtils.AddListItems(DdlTranslateType, true); ControlUtils.SelectSingleItem(DdlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy)); } else { PhTranslate.Visible = false; } CblContentAttributes.Items.Add(new ListItem("置顶", ContentAttribute.IsTop)); CblContentAttributes.Items.Add(new ListItem("推荐", ContentAttribute.IsRecommend)); CblContentAttributes.Items.Add(new ListItem("热点", ContentAttribute.IsHot)); CblContentAttributes.Items.Add(new ListItem("醒目", ContentAttribute.IsColor)); TbAddDate.DateTime = DateTime.Now; TbAddDate.Now = true; var contentGroupNameList = ContentGroupManager.GetGroupNameList(SiteId); foreach (var groupName in contentGroupNameList) { var item = new ListItem(groupName, groupName); CblContentGroups.Items.Add(item); } BtnContentGroupAdd.Attributes.Add("onclick", ModalContentGroupAdd.GetOpenWindowString(SiteId)); LtlTags.Text = ContentUtility.GetTagsHtml(AjaxCmsService.GetTagsUrl(SiteId)); if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentCheck)) { PhStatus.Visible = true; int checkedLevel; var isChecked = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, _channelInfo.Id, out checkedLevel); if (AuthRequest.IsQueryExists("contentLevel")) { checkedLevel = TranslateUtils.ToIntWithNagetive(AuthRequest.GetQueryString("contentLevel")); if (checkedLevel != CheckManager.LevelInt.NotChange) { isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel; } } CheckManager.LoadContentLevelToEdit(DdlContentLevel, SiteInfo, contentInfo, isChecked, checkedLevel); } else { PhStatus.Visible = false; } BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()")); //自动检测敏感词 ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(SiteInfo)); if (contentId == 0) { var attributes = TableStyleManager.GetDefaultAttributes(_styleInfoList); if (AuthRequest.IsQueryExists("isUploadWord")) { var isFirstLineTitle = AuthRequest.GetQueryBool("isFirstLineTitle"); var isFirstLineRemove = AuthRequest.GetQueryBool("isFirstLineRemove"); var isClearFormat = AuthRequest.GetQueryBool("isClearFormat"); var isFirstLineIndent = AuthRequest.GetQueryBool("isFirstLineIndent"); var isClearFontSize = AuthRequest.GetQueryBool("isClearFontSize"); var isClearFontFamily = AuthRequest.GetQueryBool("isClearFontFamily"); var isClearImages = AuthRequest.GetQueryBool("isClearImages"); var contentLevel = AuthRequest.GetQueryInt("contentLevel"); var fileName = AuthRequest.GetQueryString("fileName"); var formCollection = WordUtils.GetWordNameValueCollection(SiteId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, fileName); attributes.Load(formCollection); TbTitle.Text = formCollection[ContentAttribute.Title]; } AcAttributes.Attributes = attributes; } else if (contentInfo != null) { TbTitle.Text = contentInfo.Title; TbTags.Text = contentInfo.Tags; var list = new List <string>(); if (contentInfo.IsTop) { list.Add(ContentAttribute.IsTop); } if (contentInfo.IsRecommend) { list.Add(ContentAttribute.IsRecommend); } if (contentInfo.IsHot) { list.Add(ContentAttribute.IsHot); } if (contentInfo.IsColor) { list.Add(ContentAttribute.IsColor); } ControlUtils.SelectMultiItems(CblContentAttributes, list); TbLinkUrl.Text = contentInfo.LinkUrl; TbAddDate.DateTime = contentInfo.AddDate; ControlUtils.SelectMultiItems(CblContentGroups, TranslateUtils.StringCollectionToStringList(contentInfo.GroupNameCollection)); AcAttributes.Attributes = contentInfo; } } else { AcAttributes.Attributes = new AttributesImpl(Request.Form); } //DataBind(); }
private void LoadParams() { pageId = WebUtils.ParseInt32FromQueryString("pageid", pageId); moduleId = WebUtils.ParseInt32FromQueryString("mid", moduleId); }
// End 0000096, KuangWei, 2014-09-18 protected void Page_Load(object sender, EventArgs e) { if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read)) { return; } if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite)) { panelProcessEndOption.Visible = false; } else { panelProcessEndOption.Visible = true; } btnProcessEnd.OnClientClick = HROne.Translation.PromptMessage.PAYROLL_PROCESS_END_GENERIC_JAVASCRIPT; binding = new Binding(dbConn, db); // Start 0000069, KuangWei, 2014-08-26 //binding.add(new DropDownVLBinder(db, PayGroupID, EPayrollGroup.VLPayrollGroup)); initPayrollGroup(); // End 0000069, KuangWei, 2014-08-26 binding.add(CurrentPayPeriodID); DBFilter payPeriodFilter = new DBFilter(); payPeriodFilter.add(new Match("PayPeriodStatus", "<>", "T")); payPeriodFilter.add(new Match("PayPeriodStatus", "<>", "E")); if (!int.TryParse(PayGroupID.SelectedValue, out CurID)) { if (!int.TryParse(DecryptedRequest["PayGroupID"], out CurID)) { CurID = -1; } } payPeriodFilter.add(new Match("PayGroupID", CurID)); payPeriodFilter.add("PayPeriodFr", false); binding.add(new DropDownVLBinder(EPayrollPeriod.db, PayPeriodID, EPayrollPeriod.VLPayrollPeriod, payPeriodFilter)); binding.init(Request, Session); sNotConfirmEmpBinding = new SearchBinding(dbConn, EEmpPersonalInfo.db); //sNotConfirmEmpBinding.add(new HiddenMatchBinder(CurrentPayPeriodID,"ep.PayPeriodID" )); sNotTrialRunEmpBinding = new SearchBinding(dbConn, EEmpPersonalInfo.db); //sNotTrialRunEmpBinding.add(new HiddenMatchBinder(CurrentPayPeriodID, "pp.PayPeriodID")); if (!int.TryParse(PayPeriodID.SelectedValue, out CurPayPeriodID)) { if (!int.TryParse(DecryptedRequest["PayPeriodID"], out CurPayPeriodID)) { EPayrollGroup obj = new EPayrollGroup(); obj.PayGroupID = CurID; if (EPayrollGroup.db.select(dbConn, obj)) { CurPayPeriodID = obj.CurrentPayPeriodID; } else { CurPayPeriodID = -1; } } } HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls); NotConfirmEmpInfo = NotConfirm_ListFooter.ListInfo; //new ListInfo(); NotTrialRunEmpInfo = NotTrialRun_ListFooter.ListInfo; //new ListInfo(); if (!Page.IsPostBack) { loadObject(); //loadState(); if (CurID > 0) { panelPayPeriod.Visible = true; NotConfirmEmpView = loadNotConfirmData(NotConfirmEmpInfo, EEmpPayroll.db, NotConfirm_Repeater); NotTrialRunEmpView = loadNotTrialRunData(NotTrialRunEmpInfo, EEmpPersonalInfo.db, NotTrialRun_Repeater); } else { panelPayPeriod.Visible = false; panelProcessEndOption.Visible = false; } } }
private byte[] GetCss(HttpContext context, int siteId, string skinName, Encoding encoding) { string basePath = HttpContext.Current.Server.MapPath( "~/Data/Sites/" + siteId.ToInvariantString() + "/skins/" + skinName + "/"); string siteRoot = string.Empty; if (WebConfigSettings.UseFullUrlsForSkins) { siteRoot = WebUtils.GetSiteRoot(); } else { siteRoot = WebUtils.GetRelativeSiteRoot(); } string skinImageBasePath = siteRoot + "/Data/Sites/" + siteId.ToInvariantString() + "/skins/" + skinName + "/"; StringBuilder cssContent = new StringBuilder(); bool hasLessFiles = false; if (File.Exists(basePath + "style.config")) { ProcessCssFileList(cssContent, basePath, siteRoot, skinImageBasePath, out hasLessFiles); } //2013-08-20 JA added this to support add on products on the demo site // so I can add css needed to demo the add on features without having to add/maintain it in every skin // whereas customers would typically add the css that ships with the feature to their skin and list it in style.config if (WebConfigSettings.GlobalAddOnStyleFolder.Length > 0) { basePath = HttpContext.Current.Server.MapPath(WebConfigSettings.GlobalAddOnStyleFolder); if (File.Exists(basePath + "style.config")) { skinImageBasePath = siteRoot + WebConfigSettings.GlobalAddOnStyleFolder.Replace("~/", "/"); bool globalHasLess = false; // not supported/needed in global add on css ProcessCssFileList(cssContent, basePath, siteRoot, skinImageBasePath, out globalHasLess); } } string finalCss; if ((hasLessFiles) && (less != null)) { finalCss = ProcessLess(less.ToString()) + cssContent.ToString(); } else { finalCss = cssContent.ToString(); } if ((ShouldCacheOnServer()) && (WebConfigSettings.MinifyCSS)) { // this method is expensive (7.87 seconds as measured by ANTS Profiler // we do cache so its not called very often return(encoding.GetBytes(CssMinify.Minify(finalCss))); } return(encoding.GetBytes(finalCss)); }
private void LoadSettings(Hashtable settings) { if (settings == null) { throw new ArgumentException("must pass in a hashtable of settings"); } showTechnicalData = WebUtils.ParseBoolFromHashtable(settings, "GalleryShowTechnicalDataSetting", showTechnicalData); useCompactMode = WebUtils.ParseBoolFromHashtable(settings, "GalleryCompactModeSetting", useCompactMode); //useSlideShow = WebUtils.ParseBoolFromHashtable(settings, "UseSilverlightSlideshow", useSlideShow); if (settings.Contains("SlideShowTheme")) { slideShowTheme = settings["SlideShowTheme"].ToString(); } slideShowWidth = WebUtils.ParseInt32FromHashtable(settings, "SlideShowWidth", slideShowWidth); slideShowHeight = WebUtils.ParseInt32FromHashtable(settings, "SlideShowHeight", slideShowHeight); slideShowWindowlessMode = WebUtils.ParseBoolFromHashtable(settings, "SlideShowWindowlessMode", slideShowWindowlessMode); thumbnailWidth = WebUtils.ParseInt32FromHashtable(settings, "GalleryThumbnailWidthSetting", thumbnailWidth); thumbnailHeight = WebUtils.ParseInt32FromHashtable(settings, "GalleryThumbnailHeightSetting", thumbnailHeight); thumbsPerPage = WebUtils.ParseInt32FromHashtable(settings, "GalleryThumbnailsPerPageSetting", thumbsPerPage); webSizeWidth = WebUtils.ParseInt32FromHashtable(settings, "GalleryWebImageWidthSetting", webSizeWidth); webSizeHeight = WebUtils.ParseInt32FromHashtable(settings, "GalleryWebImageHeightSetting", webSizeHeight); if (settings.Contains("CustomCssClassSetting")) { customCssClass = settings["CustomCssClassSetting"].ToString(); } if (settings.Contains("ResizeBackgroundColor")) { resizeBackgroundColor = settings["ResizeBackgroundColor"].ToString(); } if (settings.Contains("ColorBoxTransition")) { colorBoxTransition = settings["ColorBoxTransition"].ToString(); } if (settings.Contains("ColorBoxTransitionSpeed")) { colorBoxTransitionSpeed = settings["ColorBoxTransitionSpeed"].ToString(); } if (settings.Contains("ColorBoxOpacity")) { colorBoxOpacity = settings["ColorBoxOpacity"].ToString(); } colorBoxUseSlideshow = WebUtils.ParseBoolFromHashtable(settings, "ColorBoxUseSlideshow", colorBoxUseSlideshow); if (settings.Contains("ColorBoxSlideshowSpeed")) { colorBoxSlideshowSpeed = settings["ColorBoxSlideshowSpeed"].ToString(); } colorBoxSlideshowAuto = WebUtils.ParseBoolFromHashtable(settings, "ColorBoxSlideShowAuto", colorBoxSlideshowAuto); colorBoxSlideShowStartAuto = WebUtils.ParseBoolFromHashtable(settings, "ColorBoxSlideShowStartAuto", colorBoxSlideShowStartAuto); useNivoSlider = WebUtils.ParseBoolFromHashtable(settings, "UseNivoSlider", useNivoSlider); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/css"; if (context.Request.RequestType == POST) { return; } bool isCompressed = DO_GZIP && this.CanGZip(context.Request); //bool isCompressed = false; int siteId = SiteUtils.ParseSiteIdFromSkinRequestUrl(); string skinName = "styleshout-refresh"; if (context.Request["skin"] != null) { skinName = SiteUtils.SanitizeSkinParam(context.Request["skin"]); } string media = "screen"; if (context.Request["media"] != null) { media = context.Request["media"]; } skinVersion = WebUtils.ParseGuidFromQueryString("sv", Guid.Empty).ToString(); UTF8Encoding encoding = new UTF8Encoding(false); if (!this.WriteFromCache(context, siteId, skinName, isCompressed)) { byte[] cssBytes = GetCss(context, siteId, skinName, encoding); using (MemoryStream memoryStream = new MemoryStream(5000)) { using (Stream writer = isCompressed ? (Stream)(new GZipStream(memoryStream, CompressionMode.Compress)) : memoryStream) { writer.Write(cssBytes, 0, cssBytes.Length); } byte[] responseBytes = memoryStream.ToArray(); if (ShouldCacheOnServer()) { // TODO: maybe we should cache it to disk instead of memory lock (this) { string cahceKey = GetCacheKey(siteId, skinName, isCompressed); context.Cache.Insert( cahceKey, responseBytes, null, System.Web.Caching.Cache.NoAbsoluteExpiration, CACHE_DURATION); } } this.WriteBytes(responseBytes, context, isCompressed); } } }