我是学习机械专业的学生,但导师让我们自己编程序,现在学习C#也有1个月的时间了,但是以前师兄编的程序还是看不懂,师兄现在已经毕业了,我没的问人,忘哪位高手帮我看看这个程序,顺便再帮我分析分析还应该看些什么书才能看懂这些程序(我已经看完了C#的基本语法和数据库的基本语句),我现在很迷茫。。感激不尽!protected void report_drop_SelectedIndexChanged(object sender, EventArgs e)
{
string userpath = Server.MapPath(".") + "//User//";
if (report_drop.SelectedValue == "Word报告")
{
int PlanNum; string ResultFilePath = userpath + "\\Report\\SingleWellWordReports"; deletedir(ResultFilePath); StreamReader sr = new StreamReader(userpath + "//Temp//Simu_ComputePlan.tmp");
PlanNum = Int32.Parse(sr.ReadLine());
sr.Close();
if (PlanNum == 1)
{
SinglePlanWordReport(); }
else
{
MultiPlanWordReport(); }
} if (report_drop.SelectedValue == "网页报告")
{
string ResultFilePath = userpath + "\\Report\\SingleWellWebReports"; deletedir(ResultFilePath); StreamReader tempsr = new StreamReader(userpath + "\\Temp\\Simu_ComputePlan.tmp", System.Text.Encoding.Default);
int temp = int.Parse(tempsr.ReadLine());
tempsr.Close();
if (temp == 1)
{
SingleWellSRePort();
}
else
{
SingleWellMRePort(); }
} }
{
string userpath = Server.MapPath(".") + "//User//";
if (report_drop.SelectedValue == "Word报告")
{
int PlanNum; string ResultFilePath = userpath + "\\Report\\SingleWellWordReports"; deletedir(ResultFilePath); StreamReader sr = new StreamReader(userpath + "//Temp//Simu_ComputePlan.tmp");
PlanNum = Int32.Parse(sr.ReadLine());
sr.Close();
if (PlanNum == 1)
{
SinglePlanWordReport(); }
else
{
MultiPlanWordReport(); }
} if (report_drop.SelectedValue == "网页报告")
{
string ResultFilePath = userpath + "\\Report\\SingleWellWebReports"; deletedir(ResultFilePath); StreamReader tempsr = new StreamReader(userpath + "\\Temp\\Simu_ComputePlan.tmp", System.Text.Encoding.Default);
int temp = int.Parse(tempsr.ReadLine());
tempsr.Close();
if (temp == 1)
{
SingleWellSRePort();
}
else
{
SingleWellMRePort(); }
} }
用到了ASP.NET 中的 Server 对象
参考http://blog.163.com/hs_admin_jsjd/blog/static/175159035200752511507508/还用读取文件类StreamReader
参考http://panjunlai.blog.163.com/blog/static/5819030120104207820105/