public static void WritToDB(object state) { try { List <XElement> list = XElement.Load(AppDomain.CurrentDomain.BaseDirectory + "AppSettings.config").Elements("add").ToList <XElement>(); BasicConfigService service = new BasicConfigService(); foreach (XElement element in list) { string name = element.Attribute("key").Value; string str3 = element.Attribute("value").Value; BasicConfig byName = service.GetByName(name); if (byName != null) { byName.ParaValue = str3; service.Update(byName); } else { byName = new BasicConfig { Id = Guid.NewGuid().ToString(), ParaName = name, ParaValue = str3 }; service.Add(byName); } } } catch { } }
protected void Button1_ServerClick(object sender, EventArgs e) { string text = this.txtpass.Text.Trim().ToString(); if (!(base.Request.QueryString["tt"].ToString() == "1")) { try { BasicConfigService basicConfigService = new BasicConfigService(); BasicConfig byName = basicConfigService.GetByName("TheDeletePwd"); byName.ParaValue = text; basicConfigService.Update(byName); string script = "\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\ttop.ui.show( '设置成功!');\r\n\t\t\t\t\t</script>\r\n\t\t\t\t"; base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), script); } catch { string script2 = "\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\ttop.ui.show( '设置失败!');\r\n\t\t\t\t\t</script>\r\n\t\t\t\t"; base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), script2); } return; } bool twoPWD = myxml.GetTwoPWD(text); BasicConfigService basicConfigService2 = new BasicConfigService(); basicConfigService2.GetValue("TheDeletePwd"); if (twoPWD) { this.Session["twopass"] = "******"; base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), "<script>window.opener=null;window.close(this);</script>"); return; } base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), "<script>alert('密码错误!');</script>"); }
public static void ClearTotal2(object o) { Log4netHelper.Error(new Exception("clearTotal2 开始执行"), "clearTotal2", "bery"); BasicConfigService service = new BasicConfigService(); BasicConfig byName = service.GetByName("IsClearTaskTotal2"); if (byName.ParaValue != "1") { try { BudTaskService service2 = new BudTaskService(); BudModifyTaskService source = new BudModifyTaskService(); new PTPrjInfoService(); foreach (BudModifyTask task in source.ToList <BudModifyTask>()) { source.UpdateTotal2(task.ModifyTaskId); } string cmdText = string.Format("\r\n\t\t\t\t\tSELECT TaskId FROM Bud_Task\r\n\t\t\t\t\tWHERE TaskId IN ( SELECT TaskId FROM Bud_TaskResource )\r\n\t\t\t\t", new object[0]); DataTable table = SqlHelper.ExecuteQuery(CommandType.Text, cmdText, new SqlParameter[0]); for (int i = 0; i < table.Rows.Count; i++) { string taskId = table.Rows[i][0].ToString(); service2.UpdateTotal2(taskId); } byName.ParaValue = "1"; service.Update(byName); Log4netHelper.Error(new Exception("clearTotal2 执行成功"), "clearTotal2", "bery"); } catch (Exception exception) { Log4netHelper.Error(exception, "clearTotal2", "bery"); } } }
public static void ClearPTPrjInfo(object o) { try { Log4netHelper.Error(new Exception("ClearPTPrjInfo 开始执行"), "ClearPTPrjInfo", "bery"); BasicConfigService service = new BasicConfigService(); BasicConfig byName = service.GetByName("IsClearPTPrjInfo"); if (byName == null) { byName = new BasicConfig { Id = Guid.NewGuid().ToString(), ParaName = "IsClearPTPrjInfo", ParaValue = "0", Note = "是否已经把PT_PrjInfo_ZTB表的数据导入PT_PrjInfo表中" }; service.Add(byName); } if (byName.ParaValue != "1") { string cmdText = "SELECT PrjGuid FROM PT_PrjInfo_ZTB WHERE PrjGuid Not IN (SELECT PrjGuid FROM PT_PrjInfo)"; foreach (DataRow row in SqlHelper.ExecuteQuery(CommandType.Text, cmdText, new SqlParameter[0]).Rows) { Guid id = new Guid(row[0].ToString()); PTPrjInfoZTBService service2 = new PTPrjInfoZTBService(); PTPrjInfoService service3 = new PTPrjInfoService(); PTPrjInfoZTB byId = service2.GetById(id); service3.ChangePrjInfo(byId, 2, 1); } byName.ParaValue = "1"; service.Update(byName); } } catch (Exception exception) { Log4netHelper.Error(exception, "ClearPTPrjInfo", "bery"); } }
protected void btnSave_Click(object sender, EventArgs e) { string strdomain = domain.Text.Trim().ToString(); string strcorpId = corpId.Text.Trim().ToString(); string strcorpSecret = corpSecret.Text.Trim().ToString(); try { BasicConfig byName = basicConfigService.GetByName("domain"); byName.ParaValue = domain.Text.Trim().ToString(); basicConfigService.Update(byName); BasicConfig byName2 = basicConfigService.GetByName("corpId"); byName2.ParaValue = corpId.Text.Trim().ToString(); basicConfigService.Update(byName2); BasicConfig byName3 = basicConfigService.GetByName("corpSecret"); byName3.ParaValue = corpSecret.Text.Trim().ToString(); basicConfigService.Update(byName3); BasicConfig byName4 = basicConfigService.GetByName("journalIfCheckTime"); byName4.ParaValue = journalIfCheckTime.SelectedValue.ToString(); basicConfigService.Update(byName4); BasicConfig byName5 = basicConfigService.GetByName("journalIfScore"); byName5.ParaValue = journalIfScore.SelectedValue.ToString(); basicConfigService.Update(byName5); BasicConfig byName6 = basicConfigService.GetByName("AgentId_log"); byName6.ParaValue = AgentId_log.Text.Trim().ToString(); basicConfigService.Update(byName6); BasicConfig byName7 = basicConfigService.GetByName("Secret_log"); byName7.ParaValue = Secret_log.Text.Trim().ToString(); basicConfigService.Update(byName7); BasicConfig byName8 = basicConfigService.GetByName("AgentId_task"); byName8.ParaValue = AgentId_task.Text.Trim().ToString(); basicConfigService.Update(byName8); BasicConfig byName9 = basicConfigService.GetByName("Secret_task"); byName9.ParaValue = Secret_task.Text.Trim().ToString(); basicConfigService.Update(byName9); BasicConfig byName10 = basicConfigService.GetByName("AgentId_doc"); byName10.ParaValue = AgentId_doc.Text.Trim().ToString(); basicConfigService.Update(byName10); BasicConfig byName11 = basicConfigService.GetByName("Secret_doc"); byName11.ParaValue = Secret_doc.Text.Trim().ToString(); basicConfigService.Update(byName11); BasicConfig byName12 = basicConfigService.GetByName("Secret_txl"); byName12.ParaValue = Secret_txl.Text.Trim().ToString(); basicConfigService.Update(byName12); BasicConfig byName13 = basicConfigService.GetByName("workHours"); byName13.ParaValue = workHours.Text.Trim().ToString(); basicConfigService.Update(byName13); BasicConfig byName14 = basicConfigService.GetByName("workDays"); byName14.ParaValue = workDays.Text.Trim().ToString(); basicConfigService.Update(byName14); BasicConfig byName15 = basicConfigService.GetByName("AgentId_Treasury"); byName15.ParaValue = AgentId_Treasury.Text.Trim().ToString(); basicConfigService.Update(byName15); BasicConfig byName16 = basicConfigService.GetByName("Secret_Treasury"); byName16.ParaValue = Secret_Treasury.Text.Trim().ToString(); basicConfigService.Update(byName16); BasicConfig byName17 = basicConfigService.GetByName("ifMoreBudget"); byName17.ParaValue = ifMoreBudget.SelectedValue.ToString(); basicConfigService.Update(byName17); string script = "\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\ttop.ui.show( '设置成功!');\r\n\t\t\t\t\t</script>\r\n\t\t\t\t"; base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), script); } catch { string script2 = "\r\n\t\t\t\t\t<script>\r\n\t\t\t\t\t\ttop.ui.show( '设置失败!');\r\n\t\t\t\t\t</script>\r\n\t\t\t\t"; base.ClientScript.RegisterStartupScript(base.GetType(), Guid.NewGuid().ToString(), script2); } return; }