protected void Button3_Click(object sender, EventArgs e) { //更新详细集 string id = Request.QueryString["id"]; if (id == null || id == "") { return; } string strsql; strsql = string.Format("select * From [T_film_detail] where filmid={0} order by id asc", id); DataView dv = DBFun.GetDataView(strsql); int idv = dv.Table.Rows.Count; for (int i = 1; i <= idv; i++) { //修改原有的,看有没有变化,变化的才改 if (Request.Form["urla" + i] != dv.Table.Rows[i - 1]["filename"].ToString()) { strsql = string.Format("Update [T_film_detail] set filename='{0}' where id ={1}", Request.Form["urla" + i], dv.Table.Rows[i - 1]["id"].ToString()); DBFun.ExecuteSql(strsql); } } Response.Write("<script>alert('影片修改成功!');window.location.href='film_edit.aspx?Action=Edit&ID=" + id + "';</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string str_sql; str_sql = "SELECT top 20 hot,leixing,id,title+'('+format(shijian,'mm-dd')+')' as biaoti FROM news where leibie = '新闻' order by shijian asc,id asc"; DataView dv = DBFun.GetDataView(str_sql); GV_news.DataSource = dv; GV_news.DataBind(); Session["dv_news"] = dv; //更改数据库数据类型 //str_sql = "alter table cpry alter column cdrw_gg_khyx1 varchar(255)"; //DBFun.ExecuteSql(str_sql); //str_sql = "alter table cpry alter column cdrw_gg_khcz1 varchar(255)"; //DBFun.ExecuteSql(str_sql); //str_sql = "alter table cpry alter column cdrw_gg_khyx2 varchar(255)"; //DBFun.ExecuteSql(str_sql); //str_sql = "alter table cpry alter column cdrw_gg_khcz2 varchar(255)"; //DBFun.ExecuteSql(str_sql); str_sql = "select * from cpry"; DataTable dt = DBFun.dataTable(str_sql); if (!dt.Columns.Contains("score_zj")) { str_sql = "alter table cpry add COLUMN score_zj double;"; DBFun.ExecuteSql(str_sql); } } }
public static DataRow Counter(Boolean BUpdate) { //string UserIP = Request.UserHostAddress.ToString(); string strsql = ""; if (!BUpdate) { strsql = "Select TotalBrowser,TodayBrowser From T_counter"; DataRow dr = DBFun.GetDataRow(strsql); return(dr); } string strqry = "select * From T_counter"; DataRow drw = DBFun.GetDataRow(strqry); if (drw["TodayDate"].ToString() != DateTime.Today.ToString()) { //新的一天 if ((int)drw["topip"] < (int)drw["todayip"]) { //刷新最高访问量 strsql = string.Format("Update [T_counter] Set topip={0},topdate=#{1}#", drw["todayip"].ToString(), drw["TodayDate"].ToString()); DBFun.ExecuteSql(strsql); } strsql = string.Format("Update [T_Counter] Set todayip=0,todaybrowser=0,daynum=daynum+1,todaydate=#{0}#," + "yesterdayip={1},yesterdaybrowser={2}", DateTime.Today.ToString(), drw["todayip"].ToString(), drw["todaybrowser"].ToString()); DBFun.ExecuteSql(strsql); strsql = string.Format("Insert Into [T_counterMore] (vtime,vip,browser) values(#{0}#,{1},{2})", DateTime.Today.AddDays(-1).ToString(), drw["todayip"].ToString(), drw["todaybrowser"].ToString()); DBFun.ExecuteSql(strsql); strsql = string.Format("Delete From T_counterMore where vtime<=#{0}#", DateTime.Today.AddDays(-15).ToString()); DBFun.ExecuteSql(strsql); strsql = "Delete From T_Online"; DBFun.ExecuteSql(strsql); } else { //统计开始 strsql = "Update T_Counter Set todaybrowser=todaybrowser+1,totalbrowser=totalbrowser+1"; DBFun.ExecuteSql(strsql); //strqry = string.Format("Select IP From [T_Online] where ip='{0}'", UserIP); if (!DBFun.SearchTable(strqry)) { //新用户访问 //strsql = string.Format("Insert Into [T_Online] (sessionid,userid,ip) values('{0}','{1}','{2}')", // Session.SessionID.ToString(), Session["Userid"].ToString(), UserIP); //DBFun.ExecuteSql(strsql); strsql = "Update T_counter Set todayip=todayip+1,totalip=totalip+1"; DBFun.ExecuteSql(strsql); } } string str_sql; str_sql = "Select TotalBrowser,TodayBrowser From T_counter"; drw = DBFun.GetDataRow(str_sql); return(drw); }
protected void Button1_Click(object sender, EventArgs e) { //添加 //保存图片 string strsql; string NewID = ""; string img_url = UploadPicFile(FileUpload1); if (img_url == "") { img_url = "nopic.jpg"; //不上传图片,默认为无图片 } strsql = string.Format("insert Into T_films (PathID,Film_name,Other_name,Film_director,Film_Player," + "Film_class,Film_classID,Film_from,film_Level,film_clear,film_money,film_Pic,film_gut," + "playtype,filmisseq,Filmisgood1," + "filmisGood2,FilePhyPath,FileFolder,AllowDown,ShowType,SearchKey) values ({0},'{1}','{2}','{3}','{4}'," + "'{5}',{6},{7},{8},{9},{10},'{11}','{12}'," + "{13},{14},{15}," + "{16},'{17}','{18}',{19},{20},'{21}')", DwPath.SelectedValue, TbFilmname.Text, TbOthername.Text, TbDirector.Text, TbPlayer.Text, DwClass.SelectedItem.Text, DwClass.SelectedItem.Value, DwFrom.SelectedItem.Value, DwLevel.Text, DwClear.Text, (TbMoney.Text == "" ? "0" : TbMoney.Text), img_url, TbGut.Text.Replace("'", "''"), Rbfilmtype.Text, RbIsReq.Text, (CkbBest.Items[0].Selected ? 1 : 0), (CkbBest.Items[1].Selected ? 1 : 0), TbFilmPhyPath.Text, uppath.Value, Rb_AllowDown.Text, Rb_Showtype.Text, (Tb_SearchKey.Text == "" ? TbFilmname.Text : Tb_SearchKey.Text)); try { if (DBFun.ExecuteUpdate(strsql)) { NewID = DBFun.SearchValue("select Max(ID) from T_films"); int ijs = 0; for (int i = 1; i <= Convert.ToInt32(upjs.Value); i++) { strsql = string.Format("Insert Into [T_film_detail] (filename,filmid) values ('{0}',{1})", Request["urla" + i], NewID); if (DBFun.ExecuteUpdate(strsql)) { ijs++; } } strsql = string.Format("update T_films Set film_num = {0} where id={1}", ijs, NewID); DBFun.ExecuteSql(strsql); Response.Write("<script>alert('影片添加成功!');window.location.href='film_edit.aspx?Action=Edit&ID=" + NewID + "';</script>"); } } catch { Response.Write("<script>alert('影片添加失败!请确认填写正确!');</script>"); } }
protected void Button6_Click(object sender, EventArgs e) { str_sql = "select * from 表1"; dv = DBFun.GetDataView(str_sql); string str_name, str_py; for (int i = 0; i < dv.Table.Rows.Count; i++) { str_name = dv.Table.Rows[i]["姓名"].ToString(); str_py = WordToal.GetAllPYLetters(str_name); str_sql = "update 表1 set 邮箱地址='" + str_py + "' where 姓名 ='" + str_name + "' "; DBFun.ExecuteSql(str_sql); } }
protected void Button2_Click(object sender, EventArgs e) { string str_sql = "select * from t_teacher"; string str_pwd; string str_jsh; System.Data.DataTable dt = DBFun.dataTable(str_sql); for (int i = 0; i < dt.Rows.Count; i++) { str_jsh = dt.Rows[i]["jsh"].ToString(); str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str_jsh, "MD5"); str_sql = "update t_teacher set pwd = '" + str_pwd + "' where jsh = '" + str_jsh + "'"; DBFun.ExecuteSql(str_sql); } }
protected void btn_CreateRws_Click(object sender, EventArgs e) { str_sql = "delete from t_Rws where appYear=year(date())"; DBFun.ExecuteSql(str_sql); str_sql = "exec C_Rws "; if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('生成成功!');</script>"); bindData(); } else { Response.Write("<script>alert('生成失败!');</script>"); } }
protected void Button4_Click(object sender, EventArgs e) { string str_sql = "select * from t_expert"; string str_pwd; string str_xsh; System.Data.DataTable dt = DBFun.dataTable(str_sql); for (int i = 0; i < dt.Rows.Count; i++) { str_xsh = dt.Rows[i]["loginname"].ToString(); str_pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str_xsh, "MD5"); str_sql = "update t_expert set pwd = '" + str_pwd + "' where loginname = '" + str_xsh + "'"; DBFun.ExecuteSql(str_sql); } Response.Write("<script>alert('执行完毕!');</script>"); }
protected void bindData() { string str_sql = "exec Q_Para_Cyqk_By_szbm '" + Session["dept_name"].ToString() + "'"; DataView dv = DBFun.GetDataView(str_sql); if (dv != null) { if (dv.Table.Rows.Count > 0) { string str_jsh = "", str_jsh_old = "", str_xmcy = ""; for (int i = 0; i < dv.Table.Rows.Count; i++) { if (i == 0) { str_jsh_old = dv.Table.Rows[i]["jsh"].ToString(); } str_jsh = dv.Table.Rows[i]["jsh"].ToString(); if (str_jsh == str_jsh_old) { str_xmcy += "," + dv.Table.Rows[i]["xm"].ToString(); } else { if (str_jsh_old != "") { str_sql = "update t_teacher_list set xmcy = '" + str_xmcy.Substring(1) + "' where appyear=year(date()) and jsh = '" + str_jsh_old + "'"; DBFun.ExecuteSql(str_sql); } str_jsh_old = dv.Table.Rows[i]["jsh"].ToString(); str_xmcy = "," + dv.Table.Rows[i]["xm"].ToString(); } } str_sql = "update t_teacher_list set xmcy = '" + str_xmcy.Substring(1) + "' where appyear=year(date()) and jsh = '" + str_jsh + "'"; DBFun.ExecuteSql(str_sql); } } lbl_year.Text = DateTime.Today.Year.ToString(); str_sql = "exec Q_Para_hzb_By_szbm '" + Session["dept_name"].ToString() + "'"; dv = DBFun.GetDataView(str_sql); if (dv == null) { return; } gv_1.DataSource = dv; gv_1.DataBind(); Session["dv_detail"] = dv; }
protected void btn_Ok_Click(object sender, EventArgs e) { //操作 string strOpid = ""; string strsql; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("sle"); string id = GridView1.Rows[i].Cells[0].Text; if (ckb.Checked) { if (strOpid == "") { strOpid += ("(" + id); } else { strOpid += ("," + id); } } } strOpid += ")"; if (strOpid == ")") { Response.Write("<script>alert('没有选中任何记录!');history.go(-1);</script>"); } else { if (dw_Operation.Text == "0") { //删除 strsql = string.Format("delete from T_films where id in {0}", strOpid); if (DBFun.ExecuteUpdate(strsql)) { strsql = string.Format("Delete From T_film_Detail where filmid in {0}", strOpid); DBFun.ExecuteSql(strsql); //删除实际文件路径 ltl_Msg.Text = "删除成功!"; dvlist = DBFun.GetDataView(Session["strqry"].ToString()); AspNetPager1.RecordCount = dvlist.Table.Rows.Count; Cache["dvlist"] = dvlist; bindData(); } } } }
protected void btn_create_Click(object sender, EventArgs e) { str_sql = "delete from t_zjry3 where left(appNo,4)=year(date()) "; DBFun.ExecuteSql(str_sql); str_sql = " insert into t_zjry3 (zjNo,appNo) " + " select loginname,appNo from t_expertlist3 a,t_teacher_list b " + " where a.appyear=b.appyear and a.cGroup =b.cGroup3 and a.appyear=year(date()) and cGroup3 is not null "; if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('生成成功!');</script>"); bindData(); } else { Response.Write("<script>alert('生成失败!');</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { //添加 string id = Request.QueryString["id"]; if (id == null || id == "") { return; } string strqry = ""; strqry = string.Format("Insert into [T_film_detail] (filename,filmid) values ('{0}',{1})", TbAdd.Text, id); DBFun.ExecuteSql(strqry); strqry = string.Format("Update [T_films] set film_num=film_num+1,filmupdatetime=#{1}# where id={0}", id, DateTime.Now.ToString()); DBFun.ExecuteSql(strqry); Response.Redirect("film_Edit.aspx?Action=Edit&ID=" + id); }
protected void CommitInfoxmcy() { str_sql = "exec Q_Para_Cyqk_By_appNo '" + Session["appNo"].ToString() + "'"; dv = DBFun.GetDataView(str_sql); if (dv == null || dv.Table.Rows.Count == 0) { return; } string str_xmcy = ""; for (int i = 0; i < dv.Table.Rows.Count; i++) { str_xmcy += "," + dv.Table.Rows[i]["xm"].ToString(); } str_sql = "update t_teacher_list set xmcy = '" + str_xmcy.Substring(1) + "' where appNo = '" + Session["appNo"].ToString() + "'"; DBFun.ExecuteSql(str_sql); }
protected void btn_create_Click(object sender, EventArgs e) { string str_sql = "delete from t_zjry2 where appYear=year(date()) "; DBFun.ExecuteSql(str_sql); str_sql = " insert into t_zjry2 (zjNo,appNo) " + " select loginname,appNo from t_expertlist2 a,t_teacher_list b " + " where a.appyear=year(date()) and a.cGroup =b.cGroup2 and b.status=(select url from t_dict where flm=11 and bm=6) and cGroup2 is not null "; if (DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('生成成功!');</script>"); bindData(); } else { Response.Write("<script>alert('生成失败!');</script>"); } }
protected void btn_calc_Click(object sender, EventArgs e) { string str_sql = "alter table cpry add column score_xmrw numeric,score_lzbg numeric,score_yjcg numeric"; try { DBFun.ExecuteSql(str_sql); } catch { } str_sql = "select sfzh,sbzw from cpry,t_dict " + "where url=gzdw and edit_flag=false and cpry.tj_flag='推荐' and sh_flag='通过' and t_dict.tj_flag=true order by gzdw asc, ID asc;"; DataView dv = DBFun.dataView(str_sql); DataView dv_zj; for (int i = 0; i < dv.Table.Rows.Count; i++) { Session["sfzh"] = dv.Table.Rows[i]["sfzh"].ToString(); string str_score = ""; if (dv.Table.Rows[i]["sbzw"].ToString() == "研究员") { str_score = GetScore_yjy(); } else { str_score = GetScore_gg(); } string str_s1, str_s2, str_s3, str_s4; str_s1 = str_score.Substring(0, str_score.IndexOf(",")); str_s2 = str_score.Substring(str_score.IndexOf(",") + 1, str_score.LastIndexOf(",") - str_score.IndexOf(",") - 1); str_s3 = str_score.Substring(str_score.LastIndexOf(",") + 1); //计算专家评分 string strqry = "select iif(isnull(fs_pjys_sum),'0',fs_pjys_sum) as fs_sum,zj_sfzh,cpry_sfzh,jypj,UserName,zjdm,iif(isnull(fs_pjys_sum),'否','是') as sfpj from zjry,pszj where sfzh = zj_sfzh and pszj.flag = 1 "; strqry = strqry + " and cpry_sfzh = '" + dv.Table.Rows[i]["sfzh"].ToString() + "'"; dv_zj = DBFun.GetDataView(strqry); str_s4 = PrivateFun.Get_Score_zj(dv_zj); str_sql = "update cpry set score_xmrw = " + str_s1 + ",score_lzbg=" + str_s2 + ",score_yjcg=" + str_s3 + ",score_zj=" + str_s4 + " where sfzh = '" + Session["sfzh"].ToString() + "';"; if (!DBFun.ExecuteUpdate(str_sql)) { Response.Write("<script>alert('计算分数失败,请重新计算!');</script>"); return; } } Response.Write("<script>alert('计算分数成功!');</script>"); }
private void LoginIn() { //生成的验证码被保存到session中 #region 验证码 if (Session["CheckCode"] != null) { string checkcode = Session["CheckCode"].ToString(); if (this.tbx_yzm.Text != checkcode) { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('验证码输入错误!')", true); return; } } #endregion #region 管理员登陆 if (lbl_type.Text == "admin") { string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); str_sql = string.Format("select count(*) From master where admin_name='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(str_sql).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } str_sql = string.Format("select * From master where admin_name='{0}' and admin_pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(str_sql); if (UserDr == null) { Response.Write(@"<script>alert('密码不正确!');window.history.go(-1);</script>"); } else { //string strsql = string.Format("Update master set Lnum=Lnum +1,LLoginIP='{0}',LLoginTime=#{1}# where admin_name='{2}'", // Page.Request.UserHostAddress.ToString(), DateTime.Now.ToString(), UserDr["admin_name"].ToString()); //DBFun.ExecuteSql(strsql); Session["admin_type"] = "admin"; Session["admin_name"] = UserDr["admin_name"].ToString(); Session["admin_id"] = UserDr["id"].ToString(); Response.Redirect("Admin_index.aspx"); } } #endregion #region 参评人员登陆 else if (lbl_type.Text == "jycpry") { DataRow UserDr; //判断用户名 str_sql = string.Format("select count(*) From t_teacher where jsh='{0}'", tbx_UserName.Text.Trim()); if (DBFun.ExecuteScalar(str_sql).ToString() != "1") { //Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('用户名不存在!')"); return; } //判断密码 string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text.Trim(), "MD5"); str_sql = string.Format("select jsh,pwd,jsm From t_teacher where jsh='{0}' and pwd='{1}'", tbx_UserName.Text.Trim(), pwd); UserDr = DBFun.GetDataRow(str_sql); if (UserDr == null) { Response.Write(@"<script>alert('密码不正确!');window.history.go(-1);</script>"); return; } //如果认证成功,直接跳转进入申报系统; Session["jsh"] = UserDr["jsh"].ToString(); Session["jsm"] = UserDr["jsm"].ToString(); Session["appNo"] = DateTime.Today.Year + UserDr["jsh"].ToString(); Response.Redirect("../user_index.aspx"); } #endregion #region 系部登陆 else if (lbl_type.Text == "jyrs") { ////判断是否到截止日期,包含当天 //str_sql = " SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 9 )) FROM t_dict;"; //if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) < 0) //{ // Response.Write(@"<script>alert('部门申报截止日期已到,不能再申报了!');window.history.go(-1);</script>"); // return; //} str_sql = string.Format("select count(*) From t_dict where flm=13 and url = '{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(str_sql).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); str_sql = string.Format("select * From t_dict where flm=13 and url = '{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(str_sql); if (UserDr == null) { Response.Write(@"<script>alert('密码不正确!');window.history.go(-1);</script>"); return; } //str_sql = "select * from t_dict where flm = 13 and url = '" + tbx_UserName.Text + "'"; //Session["admin_type"] = lbl_type.Text; //Session["admin_name"] = UserDr["name"].ToString(); //Session["admin_id"] = UserDr["url"].ToString(); Session["dept_type"] = lbl_type.Text; Session["dept_name"] = UserDr["name"].ToString(); Session["dept_id"] = UserDr["url"].ToString(); Response.Redirect("renshi_index.aspx"); } #endregion #region 专家登陆 else if (lbl_type.Text == "jyzj") { ////判断是否到截止日期,包含当天 //str_sql = " SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 11 )) FROM t_dict;"; //if (Convert.ToInt16(DBFun.ExecuteScalar(str_sql)) < 0) //{ // Response.Write(@"<script>alert('专家评审截止日期已到,不能再评审了!');window.history.go(-1);</script>"); // return; //} string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string str_UserName = tbx_UserName.Text; str_sql = "select count(*) from t_Expert where LoginName = '" + str_UserName + "'"; if (DBFun.ExecuteScalar(str_sql).ToString() == "0") { Response.Write(@"<script>alert('用户名不存在!');location.replace(location.href);</script>"); return; } str_sql = string.Format("select jsh as LoginName,jsm as UserName From t_teacher where jsh='{0}' and pwd='{1}' ", str_UserName, pwd); DataRow UserDr = DBFun.GetDataRow(str_sql); if (UserDr == null) { str_sql = string.Format("select * From t_Expert where LoginName='{0}' and pwd='{1}' ", str_UserName, pwd); UserDr = DBFun.GetDataRow(str_sql); if (UserDr == null) { Response.Write(@"<script>alert('密码不正确!');location.replace(location.href);</script>"); return; } } str_sql = string.Format("Update t_Expert set Lnum=Lnum +1,LLoginIP='{0}',LLoginTime=#{1}# where LoginName='{2}' ", Page.Request.UserHostAddress.ToString(), DateTime.Now.ToString(), UserDr["LoginName"].ToString()); DBFun.ExecuteSql(str_sql); Session["admin_type"] = lbl_type.Text; Session["admin_name"] = UserDr["UserName"].ToString(); Session["admin_id"] = UserDr["LoginName"].ToString(); Response.Redirect("./zj_index.aspx"); } #endregion }
protected void Page_Load(object sender, EventArgs e) { //网页加载 CommFun.IsAdmin(); string strqry; if (!IsPostBack) { //服务器路径 strqry = "select * From T_Path"; DwPath.DataSource = DBFun.GetDataView(strqry).Table; DwPath.DataTextField = "Caption"; DwPath.DataValueField = "id"; DwPath.DataBind(); //类型 strqry = "select * From T_Class"; DwClass.DataSource = DBFun.GetDataView(strqry); DwClass.DataTextField = "caption"; DwClass.DataValueField = "ID"; DwClass.DataBind(); string Action = Request.QueryString["Action"]; string id = Request.QueryString["ID"]; string pid = Request.QueryString["PID"]; if (Action == "Edit" && id != null) { //是示信息以供修改 strqry = string.Format("select * From T_films where ID={0}", id); DataRow dr = DBFun.GetDataView(strqry).Table.Rows[0]; DwPath.Text = dr["pathid"].ToString(); TbFilmname.Text = dr["film_name"].ToString(); TbOthername.Text = dr["other_name"].ToString(); TbDirector.Text = dr["film_director"].ToString(); TbPlayer.Text = dr["film_player"].ToString(); DwClass.Text = dr["film_classid"].ToString(); DwFrom.Text = dr["film_from"].ToString(); DwLevel.Text = dr["film_level"].ToString(); DwClear.Text = dr["film_clear"].ToString(); CkbBest.Items[0].Selected = (dr["filmisgood1"].ToString() == "1"); CkbBest.Items[1].Selected = (dr["filmisgood2"].ToString() == "1"); TbMoney.Text = dr["film_money"].ToString(); Rbfilmtype.Text = dr["playtype"].ToString(); RbIsReq.Text = dr["filmisseq"].ToString(); TbPicUrl.Text = dr["film_pic"].ToString(); TbGut.Text = dr["film_gut"].ToString().Replace("<br>", "\n");; TbFilmPhyPath.Text = dr["filePhypath"].ToString(); uppath.Value = dr["filefolder"].ToString(); Rb_AllowDown.Text = dr["AllowDown"].ToString(); Rb_Showtype.Text = dr["showType"].ToString(); Tb_SearchKey.Text = dr["SearchKey"].ToString(); img_pic.Src = "..\\film_poster\\" + dr["film_pic"].ToString(); //显示详细集数 strqry = string.Format("select * From T_Film_detail where filmid={0} order by id asc", id); string strDetail = ""; DataView dv = DBFun.GetDataView(strqry); for (int i = 0; i < dv.Table.Rows.Count; i++) { strDetail += "第" + (i + 1) + "集:<input type=text name=urla" + (i + 1) + " size=60 value=" + dv.Table.Rows[i]["filename"].ToString() + ">"; strDetail += " <a href=film_edit.aspx?Action=Delete&ID=" + dv.Table.Rows[i]["id"].ToString() + "&PID=" + id + ">删除</a><br/>"; } Label2.Text = strDetail; //InnerHtml = strDetail; } if (Action == "Delete" && id != null) { strqry = string.Format("Delete From [T_film_detail] where id={0}", id); DBFun.ExecuteSql(strqry); strqry = string.Format("Update [T_films] set film_num=film_num-1,filmupdatetime=#{1}# where id={0}", pid, DateTime.Now.ToString()); DBFun.ExecuteSql(strqry); Response.Redirect("film_edit.aspx?Action=Edit&ID=" + pid); } } }
protected void zj_Login(int flag) { string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string str_sfzh = tbx_UserName.Text; string strqry = "select count(*) from pszj where sfzh = '" + str_sfzh + "' and flag = " + flag.ToString(); if (DBFun.ExecuteScalar(strqry).ToString() == "0") { Response.Write(@"<script>alert('用户名不存在!');</script>"); return; } //if (DBFun.ExecuteScalar(strqry).ToString() != "0") //{ // strqry = "select iif(isnull(lnum),0,lnum) From pszj where sfzh = '" + tbx_UserName.Text + "' and flag = " + flag.ToString(); // if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) != 0) // { // Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); // return; // } //} //else //{ // strqry = string.Format("select count(*) From pszj where LoginName='{0}' and flag = "+flag.ToString(), tbx_UserName.Text); // if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) == 0) // { // Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); // return; // } // strqry = string.Format("select sfzh From pszj where LoginName='{0}' and flag = " + flag.ToString(), tbx_UserName.Text); // str_sfzh = DBFun.ExecuteScalar(strqry).ToString(); //} strqry = string.Format("select * From pszj where sfzh='{0}' and pwd='{1}' and flag = " + flag.ToString(), str_sfzh, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); } else { strqry = string.Format("Update pszj set Lnum=Lnum +1,LLoginIP='{0}',LLoginTime=#{1}# where sfzh='{2}' and flag = " + flag.ToString(), Page.Request.UserHostAddress.ToString(), DateTime.Now.ToString(), UserDr["sfzh"].ToString()); DBFun.ExecuteSql(strqry); if (flag == 1) { Session["admin_type"] = "zhuanjia"; } else if (flag == 2) { Session["admin_type"] = "ejzj"; } else if (flag == 3) { Session["admin_type"] = "tszj"; } Session["admin_name"] = UserDr["UserName"].ToString(); Session["admin_id"] = UserDr["sfzh"].ToString(); Response.Redirect("./zhuanjia_index.aspx"); } }
private void btnevent() { //管理员登陆 #region 管理员登陆 if (lbl_type.Text == "admin") { string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(*) From master where admin_name='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } strqry = string.Format("select * From master where admin_name='{0}' and admin_pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('密码不正确!');window.history.go(-1);</script>"); } else { ////登陆成功 //if (ckb_AutoLogin.Checked) //{ // HttpCookie ck = new HttpCookie("UserInfoSave"); // ck.Expires = DateTime.Now.AddDays(30); // ck.Values.Add("ID", UserDr["id"].ToString()); // ck.Values.Add("UserName", UserDr["UserName"].ToString()); // ck.Values.Add("UserPwd", UserDr["UserPwd"].ToString()); // Response.Cookies.Add(ck); //} ////Enter(UserDr); string strsql = string.Format("Update master set Lnum=Lnum +1,LLoginIP='{0}',LLoginTime=#{1}# where admin_name='{2}'", Page.Request.UserHostAddress.ToString(), DateTime.Now.ToString(), UserDr["admin_name"].ToString()); DBFun.ExecuteSql(strsql); Session["admin_type"] = "admin"; Session["admin_name"] = UserDr["admin_name"].ToString(); Session["admin_id"] = UserDr["id"].ToString(); Response.Redirect("Admin_index.aspx"); } } #endregion //人事部门登陆 #region 人事部门登陆 else if (lbl_type.Text == "renshi") { string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(*) From t_dict where flm=2 and url = '{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } strqry = string.Format("select * From t_dict where flm=2 and url = '{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); return; } strqry = "select tj_flag from t_dict where flm = 2 and url = '" + tbx_UserName.Text + "'"; Session["admin_type"] = "renshi"; Session["admin_name"] = UserDr["name"].ToString(); Session["admin_id"] = UserDr["url"].ToString(); //if (DBFun.ExecuteScalar(strqry).ToString().ToLower() == "true") //{ // Response.Redirect("renshi_list.aspx"); //} Response.Redirect("renshi_index.aspx"); } #endregion //正高级参评人员登陆 #region 正高级参评人员登陆 else if (lbl_type.Text == "1") { //判断用户名 string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(sfzh) From cpry where sfzh='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } //判断密码 strqry = string.Format("select sfzh,pwd,yourname From cpry where sfzh='{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); return; } //判断是否到截止日期 strqry = "SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 3 ))" + " FROM t_dict" + " WHERE flm=8 AND t_dict.bm=3;"; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) < 0) { Response.Write(@"<script>alert('报名截止日期已到,不能再报名了!');window.history.go(-1);</script>"); return; } else { Session["sfzh"] = UserDr["sfzh"].ToString(); Session["name"] = UserDr["yourname"].ToString(); strqry = "select count(*) from cpry where sfzh = '" + tbx_UserName.Text + "' and edit_flag = true "; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) != 1) { strqry = "select sbzw from cpry where sfzh = '" + tbx_UserName.Text + "'"; if (DBFun.ExecuteScalar(strqry).ToString() == "研究员") { Response.Redirect("../PrintPreview_yjy.aspx"); } else { Response.Redirect("../PrintPreview_zyjgg.aspx"); } } Response.Redirect("../zgsb_shenbao.aspx"); } } #endregion //专家登陆 正高级 else if (lbl_type.Text == "zhuanjia") { zj_Login(1); } //专家登陆 专业技术二级 else if (lbl_type.Text == "ejzj") { zj_Login(2); } //专家登陆 特殊津贴人员 else if (lbl_type.Text == "tszj") { zj_Login(3); } //参评人员登陆 专业技术二级 #region 参评人员登陆 专业技术二级 else if (lbl_type.Text == "ejcpry") { //判断用户名 string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(sfzh) From ej_cpry where sfzh='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } //判断密码 strqry = string.Format("select sfzh,pwd,yourname From ej_cpry where sfzh='{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); return; } //判断是否到截止日期 strqry = "SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 9 ))" + " FROM t_dict" + " WHERE flm=8 AND t_dict.bm=9;"; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) < 0) { Response.Write(@"<script>alert('报名截止日期已到,不能再报名了!');window.history.go(-1);</script>"); return; } else { Session["sfzh"] = UserDr["sfzh"].ToString(); Session["name"] = UserDr["yourname"].ToString(); strqry = "select count(*) from ej_cpry where sfzh = '" + tbx_UserName.Text + "' and edit_flag = true "; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) != 1) { Response.Redirect("../PrintPreview_erji.aspx"); } Response.Redirect("../zyjsej.aspx"); } } #endregion //参评人员登陆 特殊津贴人员 #region 参评人员登陆 特殊津贴人员 else if (lbl_type.Text == "tscpry") { //判断用户名 string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(sfzh) From ts_cpry where sfzh='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } //判断密码 strqry = string.Format("select sfzh,pwd,yourname From ts_cpry where sfzh='{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); return; } //判断是否到截止日期 strqry = "SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 11 ))" + " FROM t_dict" + " WHERE flm=8 AND t_dict.bm=11;"; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) < 0) { Response.Write(@"<script>alert('报名截止日期已到,不能再报名了!');window.history.go(-1);</script>"); return; } else { Session["sfzh"] = UserDr["sfzh"].ToString(); Session["name"] = UserDr["yourname"].ToString(); strqry = "select count(*) from ts_cpry where sfzh = '" + tbx_UserName.Text + "' and edit_flag = true "; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) != 1) { Response.Redirect("../PrintPreview_ts.aspx"); } Response.Redirect("../tsjtry.aspx"); } } #endregion //参评人员登陆 优秀论文人员 #region 参评人员登陆 优秀论文人员 else if (lbl_type.Text == "lwcpry") { //判断用户名 string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbx_Pwd.Text, "MD5"); string strqry = string.Format("select count(sfzh) From lw_cpry where sfzh='{0}'", tbx_UserName.Text); if (DBFun.ExecuteScalar(strqry).ToString() != "1") { Response.Write(@"<script>alert('用户名不存在!');window.history.go(-1);</script>"); return; } //判断密码 strqry = string.Format("select sfzh,pwd,yourname From lw_cpry where sfzh='{0}' and pwd='{1}'", tbx_UserName.Text, pwd); DataRow UserDr = DBFun.GetDataRow(strqry); if (UserDr == null) { Response.Write(@"<script>alert('用户名或密码不正确!');window.history.go(-1);</script>"); return; } //判断是否到截止日期 strqry = "SELECT datediff('d',format(now(),'yyyy-MM-dd'), (select url from t_dict where flm = 8 and bm = 20 ))" + " FROM t_dict" + " WHERE flm = 8 AND t_dict.bm = 20;"; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) < 0) { Response.Write(@"<script>alert('报名截止日期已到,不能再报名了!');window.history.go(-1);</script>"); return; } else { Session["sfzh"] = UserDr["sfzh"].ToString(); Session["name"] = UserDr["yourname"].ToString(); strqry = "select count(*) from lw_cpry where sfzh = '" + tbx_UserName.Text + "' and edit_flag = true "; if (Convert.ToInt16(DBFun.ExecuteScalar(strqry)) != 1) { //打印界面 Response.Redirect("../PrintPreview_lw.aspx"); } //申报界面 Response.Redirect("../lw_sb.aspx"); } } #endregion }