using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CpmBigDataImportService;
using Appkit.Web.Management;
using Appkit.IO;
using System.Text;
public partial class Yshd_Other_GenerateData : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TextBox1.Text = DateTime.Today.ToString("yyyyMM");
}
}
private string GetSqlFromText(string gzqj)
{
string yf = (new DateTime(int.Parse(gzqj.Substring(0, 4)), int.Parse(gzqj.Substring(4, 2)), 1)).AddMonths(-1).Month.ToString();
string sqlPart = MyCommon.ReadStringFromFile("hd.txt", AkDirService.CurrentDir, Encoding.Default);
return string.Format(sqlPart, gzqj, yf);
}
protected void Button1_Click(object sender, EventArgs e)
{
string gzqj = TextBox1.Text;
if (!string.IsNullOrEmpty(gzqj))
{
string sql;//= GetSql(gzqj);
sql = GetSqlFromText(gzqj);
MyCommon.WriteLog(sql);
//return;
SqlConnectConfig sqc = new SqlConnectConfig().ConfigByDbString(YSHD.DB.Main.ConnectionString);
MyCommon.ExecuteSql(sql, sqc.ConnectString);
string url = "../../search/NormSearchAgent.aspx?objtype=yshdcyl";
url = AkContext.CheckUrl(url);
AkContext.Current.Response.Redirect(url, true);
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" CodeFile="GenerateData.aspx.cs" Inherits="Yshd_Other_GenerateData" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>生成数据</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="当前月份"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="80"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="生成预实核对数据" OnClick="Button1_Click" />
</div>
</form>
</body>
</html>