2005年12月12日

showmodaldialog 的问题

如何在打开对话框的页面服务端获取window.dialogArguments传递过来的参数,希望在PAGE_LOAD中以这个参数执行SQL?

posted @ 2005-12-12 08:52 蔚然之家 阅读(110) 评论(0) 编辑

2005年11月17日

开发一个网络学习游戏(抛砖引玉)

     当今国内网游遍天下,借着娱乐名义,不知毒害了多少缺乏自制力的中小学生,如今大部分网游简直就是二十一世纪的“鸦片”,一个一个网吧就是“烟馆”,这些经营网游的,比如陈XX,就是最大的“毒枭”,由于我们个体很渺小,我们无法做到“销烟”或者“禁烟”,甚至我们的呐喊完全淹没于对这些“成功人士”的吹捧声中,我们不反对网络游戏,我们反对利用网络游戏进行过分娱乐,我们希望利用网络游戏进行学习,就比如罂粟花可以制成“鸦片”,也可以制成药来救人。哪道我们不能联合起来,运用我们的智慧,发明一种有利于青少年身心健康,有利于青少年快乐成长,让他们在游戏中学习的网络学游。当我看到5岁的儿子趴在屏幕前熟练的玩着红警时,我决心为他做些什么,为他们做些什么。我的想法是:运用网络游戏的方式,开发一套分年级的,利用课本知识,可以和网友或者同学、家长、老师组成团队,攻克难关或者相互PK的学习游戏,这样一方面可以培养孩子的团队合作精神,交往能力,更可以让孩子更深的理解课本知识,到实际生活中来学习,提高学习兴趣,进一步提高学习效果,我想家长和学校能表示欢迎。为了使自己不沦为其他网游的帮凶、同类,我们可以采用基金会的形式来组织,我们不盈利,主要目的为社会服务,体现人生命的价值,伸出我们的手吧,帮帮这些孩子们,也让我们自己的心灵受到洗涤。
初步发展的想法是:
1、      招兵买马,成立核心开发团队,讨论项目方案和说明书
2、      成立基金会,用方案去拉赞助,为项目开发提供经费(这事需要长期做,本人愿意尽力)
3、      开发出原型后,试用推广,进一步吸引比如:教育、心理、医学、法律、科技界的人士加入,完善游戏。
4、      大力推广,维护运行。
初步开发设想:
1、      python语言作为主要开发语言(开源,我们喜欢)
2、      能控制游戏运行时间,比如玩一个小时就退出,晚上9点后不能玩

posted @ 2005-11-17 15:22 蔚然之家 阅读(348) 评论(1) 编辑

2005年11月12日

Coalesys PanelBar + R.a.d Treeview +Xml 构建的Asp.net 菜单和权限管理模块

posted @ 2005-11-12 23:01 蔚然之家 阅读(2424) 评论(19) 编辑

登陆按钮的处理

asp.net应用程序首先碰到的是用户登录处理,按下登陆按钮时需要关闭本页面,打开一个没有地址栏菜单栏、工具栏的新窗口,我的处理方法如下(只能在IE下使用,这方法本人并不喜欢,可老板喜欢,局域网下使用,安全系数并不要很高,防君子就可以了,用户的个性菜单是存放在一个以用户ID命名的xml文件的)
 1    private void btOK_Click(object sender, System.EventArgs e)
 2        {
 3            string s ="<script language = JavaScript>";
 4            if (Page.IsValid) 
 5                   {
 6                string userId = tbUser.Text; //加密口令
 7                CryptMethod cr = new CryptMethod();
 8                string cryptpass = cr.Encrypto(tbPass.Text);
 9                bool success = Account.SignIn(userId,cryptpass); //判断用户名和口令
10                string filename = Server.MapPath(XML_FILE+userId+".xml");
11                if(!File.Exists(filename))  //判断用户配置文件
12                      {
13                
14                                    lbError.Text ="没有用户配置文件"
15                    return ;
16                   }

17                                
18                if (success) //口令正确
19                        {
20                    if (FormsAuthentication.GetRedirectUrl(userId, false).EndsWith(URL_DEFAULT)) 
21                    {
22                                  FormsAuthentication.SetAuthCookie(userId, false);
23                
24                                                s += "window.opener=null;" + System.Environment.NewLine;
25                        s += "window.close();" + System.Environment.NewLine;
26                        if (chkPassword.Checked)//进入修改口令界面
27                               {
28                                  s +="window.open('/PressMange/UserControl/UserChangePassPerson.aspx');"+System.Environment.NewLine;
29                           }

30                        else  //进入主界面
31                        s += "window.open('main.aspx','dialog','left=0,top=0,height=710,width=1010,resizable=1,status=0,scrollbars=0');"+System.Environment.NewLine;
32                       
33                    s+="</script>";
34
35                    RegisterClientScriptBlock("script",s);
36                
37                    }

38                    else
39                    {
40               
41                    FormsAuthentication.RedirectFromLoginPage(userId, false);
42                    }

43                  }

44                else 
45                {
46                    lbError.Text ="非法登陆";
47                }

48            }

49
50        }

posted @ 2005-11-12 13:29 蔚然之家 阅读(652) 评论(0) 编辑

2005年11月10日

asp.net报表解决方法(第一次使用cnblogs的blog)

    private string subTotal(int row ,int num)
        

            
string r = (row+1).ToString();
         
if( num == 0)//
         {
             
return "=C"+r+"+F"+r+"-I"+r;
         }

        
else
            
return "=E"+r+"+H"+r+"-K"+r;
            
        }

        
private string sumTotal(string scol,int firstrow,int num){

        
string r = num.ToString();
            
string fr = firstrow.ToString();
            
return "=Sum("+scol+fr+":"+scol+r+")";

        }

        
private void CreateExcelWorkbook(DataRow[] rows)
        
{
            
string strCurrentDir = Server.MapPath(".."+ "\\TempReports\\";
            
string licenseFile = MapPath(".."+ "\\XML\\Aspose.Excel.lic";             
            Excel excel 
= new Excel(licenseFile, this);
        ;
            
string designerFile = strCurrentDir+"cangku2.xls";
                        excel.Open(designerFile);
            Worksheet sheet 
= excel.Worksheets["Sheet1"];
            sheet.Name 
= "wuzi";
            Cells cells 
= sheet.Cells;
            
int styleIndex;
            
            styleIndex 
= excel.Styles.Add();
            Aspose.Excel.Style stylecell 
= excel.Styles[styleIndex];
            stylecell.Borders[BorderType.LeftBorder].LineStyle
=CellBorderType.Thin;
            stylecell.Borders[BorderType.TopBorder].LineStyle 
= CellBorderType.Thin;
            stylecell.Borders[BorderType.RightBorder].LineStyle
=CellBorderType.Thin;
            stylecell.Borders[BorderType.BottomBorder].LineStyle 
= CellBorderType.Thin;
            
int iRow =4;
            
foreach(DataRow row in rows)
            
{
            cells[iRow,
0].PutValue(row[0].ToString());
            cells[iRow,
1].PutValue(row[1].ToString());
            cells[iRow,
2].PutValue(row[2]);
            cells[iRow,
3].PutValue( row[3]);
            cells[iRow,
4].PutValue(row[4]);
            cells[iRow,
5].PutValue(row[5]);
            cells[iRow,
6].PutValue(row[3]);
            cells[iRow,
7].PutValue(row[6]);
            cells[iRow,
8].PutValue(row[7]);
            cells[iRow,
9].PutValue(row[3]);
            cells[iRow,
10].PutValue(row[8]);
            cells[iRow,
11].Formula=subTotal(iRow,0);
            cells[iRow,
12].PutValue(row[3]);
            cells[iRow,
13].Formula=subTotal(iRow,1);
            iRow
++;
                }

            
string zj="总计";
                cells[iRow,
3].PutValue(zj);
                 cells[iRow,
6].PutValue(zj);
                 cells[iRow,
9].PutValue(zj);
               cells[iRow,
12].PutValue(zj);
                cells[iRow,
4].Formula=sumTotal("E",5,iRow);
                cells[iRow,
7].Formula=sumTotal("H",5,iRow);
                cells[iRow,
10].Formula=sumTotal("K",5,iRow);
                cells[iRow,
13].Formula=sumTotal("N",5,iRow);
                cells[
1,8].PutValue(cpStartDate.SelectedDate.ToShortDateString());
                cells[
1,12].PutValue(cpEndDate.SelectedDate.ToShortDateString());
            Range range 
= cells.CreateRange(4,0,iRow-4+1,14);
                range.Style 
= stylecell;
            
for(int i = 0; i < excel.Worksheets.Count ; i ++)
            
{
                sheet 
= excel.Worksheets[i];
                
if(sheet.Name != "wuzi")
                
{
             excel.Worksheets.RemoveAt(i);
                    i 
--;
                }


            }

                
/*Response.Clear();
          Response.Buffer= true;
          Response.Charset="GB2312";

        this.Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");
*/

            
        excel.Save(HttpUtility.UrlEncode(
"物资进出库汇总.xls",Encoding.UTF8), SaveType.OpenInBrowser,FileFormatType.Default,this.Response);
}
   做ASP.NET项目时,都会碰到报表问题,中国式报表的繁琐让我很是反感,可没法子啊,客户有需求!自然而然想用DCOM直接操作EXCEL,马马虎虎算是成了,虽说安全性不好,资源浪费严重,毕竟在局域网中使用,凑合吧,但我讨厌在服务端那个没有结束的EXCEL进程,杀死,一定要把敌人杀死! google了一把,当今中外都有这个问题,解决方案也有,WINXP下杀了,但我在WINDOWS 2003下搞了整整一天也没杀死,得,真想自个杀了。后来有人推荐了个控件ASPOSE,这玩意强,服务端都不用装EXCEL,效果不错!想偷懒的用这玩意,一个字爽!

posted @ 2005-11-10 15:36 蔚然之家 阅读(4563) 评论(54) 编辑