protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["username"] == null) { WebMessageBox.Show("请登录", "../Default.aspx"); } else { Label1.Text = string.Format("{0} 管理 欢迎您,", Session["username"].ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["username"] == null) { WebMessageBox.Show("请登录", "../NewLogin.aspx"); } Label1.Text = Session["username"].ToString(); //绑定 bind(); bind1(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { if (Session["UserName"].ToString().ToLower() != "TSOFT".ToLower()) { WebMessageBox.Show("请登录后方可进入网站后台!", "../Logon.aspx"); } } catch { } } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int tt; if (!int.TryParse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim(), out tt)) { WebMessageBox.Show("请输入合法的专业人数"); return; } Operation.runSql("update t_major set name='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim() + "',nums='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim() + "',remark='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim() + "' where id='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'"); GridView1.EditIndex = -1; bind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { WebMessageBox.Show("对不起,您还没登录!", "login(会员)/Default.aspx"); } else { DataList1.DataSource = op.SelectMember(Session["username"].ToString()); DataList1.DataBind(); DataList2.DataSource = op.SelectMemberAddress(Session["username"].ToString()); DataList2.DataBind(); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { if (((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim() == "") { WebMessageBox.Show("请输入教师姓名"); return; } Operation.runSql("update t_teacher set name='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim() + "',zhicheng='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim() + "',xueli='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim() + "' where id='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'"); GridView1.EditIndex = -1; bind(); }
//不同意 protected void Button5_Click(object sender, EventArgs e) { if (TextBox23.Text == "") { WebMessageBox.Show("请输入审批意见"); return; } string id = SaveID.Text; string sql = "update Rbook_message set university_advise='" + TextBox23.Text + "',state_id=1 where id =" + id; System.Diagnostics.Debug.WriteLine(sql); SQLHelper.ExecuteNonQuery(sql); initData(); }
//修改机动册数确定 protected void ChangeOK_Click(object sender, EventArgs e) { try { for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("CheckBox3"); if (cbox.Checked) { string id = GridView1.DataKeys[i].Value.ToString(); double auto_per = (Convert.ToDouble(TextBox5.Text)) * 0.01;//输入的内容转换成百分比,小数 string plan_num = "", total_num = "", book_price = "", total_price = ""; string sql1 = "select book_price,plan_num from form_order where id = " + id; SqlDataReader reader = SQLHelper.ExecuteReader(sql1); while (reader.Read()) { book_price = reader["book_price"].ToString(); plan_num = reader["plan_num"].ToString(); } //只入不舍 string auto_num = (Convert.ToInt32((Convert.ToInt32(plan_num)) * auto_per) + 1).ToString(); total_num = ((Convert.ToInt32(plan_num)) + (Convert.ToInt32(auto_num))).ToString(); total_price = ((Convert.ToDouble(total_num)) * (Convert.ToDouble(book_price))).ToString(); string sql = "update form_order set auto_num='" + auto_num + "',total_num='" + total_num + "',total_price='" + total_price + "' where id =" + id; SQLHelper.ExecuteNonQuery(sql); } } string sql2 = "select id,book_id,book_name,plan_num,auto_num,total_num,total_price,book_price,press_time,press_name,campus from form_order where order_id='" + TextBox1.Text + "' and supply_person='" + DropDownList3.SelectedValue + "'"; DataTable dt = SQLHelper.GetDataTable(sql2); GridView1.DataSource = dt; GridView1.DataKeyNames = new string[] { "id" }; GridView1.DataBind(); SqlDataReader readtp = SQLHelper.ExecuteReader(sql2); double totalprice = 0; while (readtp.Read()) { totalprice += Convert.ToDouble(readtp["total_price"].ToString()); } TotalPrice.Text = totalprice.ToString(); TextBox5.Text = ""; } catch (Exception ex) { WebMessageBox.Show(ex.Message); } }
protected void submit_Click(object sender, EventArgs e) { try { this.labIamge.Visible = true; labIamge.Text = ""; if (imageUpload.PostedFile.FileName == "") { WebMessageBox.Show("要上传的文件不允许为空!"); return; } else { string filePath = imageUpload.PostedFile.FileName; string filename = filePath.Substring(filePath.LastIndexOf("//") + 1); string fileEx = filePath.Substring(filePath.LastIndexOf(".") + 1); string relativepath = "image/ftp/" + filename; string strSql = "select * from tb_Shop where imagename='" + storeName.Text.Trim() + "'"; DataTable dsTable = dbObj.GetDataSetStr(strSql, "tb_Shop"); if (dsTable.Rows.Count > 0) { WebMessageBox.Show("该图片已经存在!"); } else { //判断图片格式 if (fileEx == "jpg" || fileEx == "png" || fileEx == "gif") { op.InsertShop(TypeName.Text.Trim(), relativepath, storeName.Text.Trim(), Convert.ToUInt32(Price.Text.Trim()), Type.Text.Trim(), Textarea1.Value.Trim(),CheckBox1.Checked); WebMessageBox.Show("上传成功"); } else { WebMessageBox.Show("上传的图片扩展名错误!"); } } } } catch (Exception error) { labIamge.Text = "处理发生错误!原因:" + error.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { //将附件传送到服务器上 string path = FileUpload1.PostedFile.FileName; //获取上传图片路径 string ext = path.Substring(path.LastIndexOf(".") + 1); //获取图片扩展名 if (ext.ToLower() == "jpg" || ext.ToLower() == "bmp" || ext.ToLower() == "gif" || ext.ToLower() == "png" || ext.ToLower() == "tif") { string sPath = Server.MapPath("..\\Photo\\" + PhotoID + "." + ext); //设置图片保存到服务器上路径 path = ".\\Photo\\" + PhotoID + "." + ext; //保存到数据库中路径 using ( OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../photo.mdb"))) { //初始化数据添加操作 OleDbCommand cmd = new OleDbCommand( "insert into tb_Photo(PhotoTitle,photoContent,photoPath,photoType,photoUser)values('" + txtTitle.Text + "','" + txtContent.Text + "','" + path + "','" + ddlPicType.Text + "','" + Session["User"] + "')", conn); //打开数据库连接 conn.Open(); //执行数据添加操作,并判断其实返回值,大于0添加成功,反之,失败。 if (cmd.ExecuteNonQuery() > 0) { //关闭数据库连接 conn.Close(); //调用自定义方法,获取数据库中最新数据。 GetFileSource(); //获取最新数据 FileUpload1.PostedFile.SaveAs(sPath); //保存到服务器 //提示成功信息 WebMessageBox.Show("已成功保存到数据库中......", "Default.aspx"); } else { //关闭数据库连接 conn.Close(); //提示错误信息 WebMessageBox.Show("操作失败!"); } } } else { WebMessageBox.Show("只能上传图片文件!"); } }
protected void Page_Load(object sender, EventArgs e) { //DataList1.DataSource = op.SelectInfo(); //DataList1.DataBind(); if (Session["UserName"] == null) { Load(); WebMessageBox.Show("请登录", "login(会员)/Default.aspx"); } else { Label1.Text = Session["UserName"].ToString(); Load(); } }
protected void Button1_Click(object sender, EventArgs e) { // 保存排课 if (GridView1.Rows[0].Cells[13].Text != GridView2.Rows.Count.ToString()) { WebMessageBox.Show("保存失败,每周上课次数必须为" + GridView1.Rows[0].Cells[13].Text); return; } for (int i = 0; i < GridView2.Rows.Count; ++i) { Operation.runSql("insert into t_coursetable(taskid,weekdays,sections) values('" + GridView1.DataKeys[0].Value.ToString() + "','" + GridView2.Rows[i].Cells[0].Text + "','" + GridView2.Rows[i].Cells[1].Text + "')"); } WebMessageBox.Show("保存完成", "paikemana.aspx"); }
protected void submit_button_Click(object sender, EventArgs e) { evaluated.Evaluation = this.TextBox1.Text; evaluated.AttendActivity = activity.SelectedItem.ToString(); int i = evaluated.EvaluationInsert(evaluated); if (i == 0) { WebMessageBox.Show("评价成功,感谢您对我们的大力支持", "../index.aspx"); } else { WebMessageBox.Show("评价失败"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { Account newInfor = new Account(); Console.WriteLine(txtName.Text); newInfor.username = txtUsername.Text; newInfor.name = txtName.Text; newInfor.phone = txtPhone.Text; newInfor.email = txtEmail.Text; string[] arr = txtDatePicker.Text.Split('/'); DateTime dob = DateTime.Parse(arr[1].ToString() + "/" + arr[0].ToString() + "/" + arr[2].ToString() + " 00:00:00 AM"); string sqlFormattedDob = dob.Date.ToString("yyyy-MM-dd HH:mm:ss"); newInfor.dob = sqlFormattedDob; int rbIndex = rbList.SelectedIndex; if (rbIndex == 0) { newInfor.gender = "male"; } else { newInfor.gender = "female"; } int result = dao.updateAccount(newInfor); if (result == 1) { wmb.Show("Update profile for account " + newInfor.username + " successfully!"); } else { wmb.Show("There are some mistake when update profile, please try again!"); } }
protected void Button1_Click(object sender, EventArgs e) { bool blConfirm = Convert.ToBoolean(this.chkConfirm.Checked); //是否被确认 bool blSend = Convert.ToBoolean(this.chkConsignment.Checked); //是否已发货 // 修改订单表中订单状态 string strSql = "update tb_OrderInfo "; strSql += " set isConfirm='" + blConfirm + "',isSend='" + blSend + "',confirmTime='" + DateTime.Now + "'"; strSql += "where OrderID=" + Convert.ToInt32(Request["OrderId"].Trim()); SqlCommand myCmd = obj.GetCommandStr(strSql); obj.ExecNonQuery(myCmd); WebMessageBox.Show("修改成功!"); //Response.Write("<script>alert('" + blConfirm + "');</script>"); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (lblCheckCode.Text.Trim() != txtCheckCode.Text.Trim()) //判断验证码 { WebMessageBox.Show("输入验证码不正确!", "Logon.aspx"); } if (operation.Logon(txtUser.Text, txtPwd.Text).Tables[0].Rows.Count > 0) //判断用户是否合法。 { Session.Add("UserName", txtUser.Text.Trim()); //将用户名称存储在Session中,用于判断非法用户进行后台。 Response.Redirect("BackGround/Default.aspx"); //用户名称或密码正确,进入后台首页 } else { WebMessageBox.Show("用户名称或密码不正确!", "Logon.aspx"); } }
protected void submit_button_Click(object sender, EventArgs e) { if (this.name.Text == null || this.email.Text == null || this.telephone.Text == null || this.validateaddress.Text == null) { WebMessageBox.Show("你的信息未填完整!", "offlinevalidate.aspx"); } else { offlinevalidate1.Name = this.name.Text; offlinevalidate1.Email = this.email.Text; offlinevalidate1.Telephone = this.telephone.Text; offlinevalidate1.ValidateAddress = this.validateaddress.Text; offlinevalidate1.AddOfflineUser(offlinevalidate1); WebMessageBox.Show("你的线下认证报名成功!", "index.aspx"); } }
//获取发送的消息,发送人和接收人分别用参数获取 //发送消息后通过ajax轮询的方式接收人获取消息提示 protected void Button1_Click(object sender, EventArgs e) { mymsg.SendUsername = myfriend.UserName; mymsg.RecvUsername = myfriend.FriendName; mymsg.Message = TextBox1.Text; mymsg.DateTime = DateTime.Now; mymsg.Readed = 0; if (mymsg.MessageInsert(mymsg) == 0) { WebMessageBox.Show("消息发送成功", "myfriend.aspx"); } else { WebMessageBox.Show("消息发送失败,请重新发送"); } }
protected void Button2_Click(object sender, EventArgs e) { Session["ShopCart"] = null; Session["username"] = dengluming.Text.Trim(); if (op.memberLogin(dengluming.Text.Trim(), mima.Text.Trim()).Tables[0].Rows.Count > 0) { Session.Add("users", dengluming.Text.Trim()); // string a= Session["users"].ToString(); Response.Redirect("../index(Member).aspx"); } else { WebMessageBox.Show("用户名或密码不正确", "Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { //获取该用户的已读和未读消息列表并根据日期时间排列,返回到前台页面供使用 //前台ajax返回json数据轮询动态刷新消息列表 if (Session["username"] == null) { WebMessageBox.Show("session失效,请重新登录", "../../../../login/login.aspx"); } else { mymsg.RecvUsername = Session["username"].ToString(); Label6.Text = mymsg.MessageSelectByRecvUser(mymsg).Tables[0].Rows.Count.ToString(); Label2.Text = mymsg.MessageSelectByRecvUserUnreaded(mymsg).Tables[0].Rows.Count.ToString(); Label4.Text = mymsg.MessageSelectByRecvUserReaded(mymsg).Tables[0].Rows.Count.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["teachid"] == null) { WebMessageBox.Show("请登录", "../Default.aspx"); } else { Label1.Text = string.Format("{0} 老师欢迎您,", Session["teachname"].ToString()); } DataTable dt1 = Operation.getDatatable("select DISTINCT major from t_coursetask"); bind(); } }
//删除 protected void GVItSupports_RowDeleting(object sender, GridViewDeleteEventArgs e) { int rowid = e.RowIndex; int id = (int)gvItSupports.DataKeys[rowid].Value; string errmsg = string.Empty; if (Common.DeleteItSupport(id, out errmsg)) { BindGvItSupport(); //WebMessageBox.ShowSuccess(this, "Add login user ok."); } else { WebMessageBox.Show(this, errmsg); } }
protected void Button3_Click(object sender, EventArgs e) { try { string sql1 = "select order_id,order_date,date_year,operate_person,supply_person,supplier_phone,book_id,book_name,book_price,remain_num from Storage_management_end where book_id=" + book_id; DataTable dt = SQLHelper.GetDataTable(sql1); GridView1.AllowSorting = false; GridView1.DataSource = dt; GridView1.DataBind(); SqlDataReader read = SQLHelper.ExecuteReader("select * from Storage_management_end where book_id =" + book_id); //记录下书号和订单号,作为一本书的唯一标示 int amount = 0; for (; read.Read();) { //amount = int.Parse(read["remain_num"].ToString()); amount = int.Parse(TextBox17.Text); if (TextBox3.Text == "" && TextBox3.Text == "0") { WebMessageBox.Show("不能输入空值或零!"); } if (int.Parse(TextBox3.Text) > amount) { WebMessageBox.Show("输入的数量有错!"); } else { int remain = amount - Convert.ToInt32(TextBox3.Text); string sql = "insert into return_history (order_id,operate_person,operater_phone,date_year ,semester ,supply_person,supplier_phone,book_id ,book_name,press_name,book_price,plan_num,auto_num,total_price,order_discount ,arrived_discount ,sell_discount ,arrived_amount ,unarrived_amount ,arrival_amount ,arrived_date ,Campus ,Storage_location ,out_num,remain_num ,order_date, press_time,state_id,total_num,return_num,return_date)"; sql += "values('" + read["order_id"].ToString() + "','" + read["operate_person"].ToString() + "','" + read["operater_phone"].ToString() + "','" + read["date_year"].ToString() + "','" + read["semester"].ToString() + "','" + read["supply_person"].ToString() + "','" + read["supplier_phone"].ToString() + "','" + read["book_id"].ToString() + "','" + read["book_name"].ToString() + "','" + read["press_name"].ToString() + "','" + read["book_price"].ToString() + "','" + read["plan_num"].ToString() + "','" + read["auto_num"].ToString() + "','" + read["total_price"].ToString() + "','" + read["order_discount"].ToString() + "','" + read["arrived_discount"].ToString() + "','" + read["sell_discount"].ToString() + "','" + read["arrived_amount"].ToString() + "','" + read["unarrived_amount"].ToString() + "','" + read["arrival_amount"].ToString() + "','" + read["arrived_date"].ToString() + "','" + read["Campus"].ToString() + "','" + read["Storage_location"].ToString() + "','" + read["out_num"].ToString() + "','" + read["remain_num"].ToString() + "','" + read["order_date"].ToString() + "','" + read["press_time"].ToString() + "','" + read["state_id"].ToString() + "','" + read["total_num"].ToString() + "','" + TextBox3.Text.ToString() + "','" + System.DateTime.Now.ToString("d") + "')"; SQLHelper.ExecuteNonQuery(sql); SQLHelper.ExecuteReader("update Storage_management_end set remain_num='" + remain.ToString() + "'where book_id= '" + book_id + "' "); string sql2 = "select date_year,semester,supply_person,book_id,book_name,press_name,return_num,return_date,Storage_location from return_history where book_id =" + book_id; DataTable dt1 = SQLHelper.GetDataTable(sql2); GridView2.DataSource = dt1; GridView2.DataBind(); string sql3 = "delete from Storage_management_end where remain_num='0'"; SQLHelper.ExecuteNonQuery(sql3); Button4.Visible = true; } } Button3.Focus(); } catch (Exception ex) { WebMessageBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["username"] == null) { WebMessageBox.Show("请登录", "../Default.aspx"); } Label1.Text = string.Format("{0} 管理 欢迎您,", Session["username"].ToString()); //绑定 bind(); DropDownList1.Items.Add("全部"); DropDownList1.Items.Add("未审核"); DropDownList1.Items.Add("审核通过"); DropDownList1.Items.Add("审核未通过"); //DropDownList1.Items.Add("星期四"); DropDownList1.Items.Add("星期五"); } }
protected void Button2_Click(object sender, EventArgs e) { if (GridView1.Rows[0].Cells[13].Text == GridView2.Rows.Count.ToString()) { WebMessageBox.Show("每周上课次数只能为" + GridView1.Rows[0].Cells[13].Text); return; } // 安排上课 if (DropDownList1.SelectedIndex < 1) { WebMessageBox.Show("请选择上课星期"); return; } if (DropDownList2.SelectedIndex < 1) { WebMessageBox.Show("请选择上课节次"); return; } // 首先验证当前是否已经排课 DataTable dt = Session["dthandle"] as DataTable; for (int i = 0; i < dt.Rows.Count; ++i) { if (dt.Rows[i][1].ToString() == DropDownList1.SelectedIndex.ToString() && dt.Rows[i][2].ToString() == DropDownList2.SelectedIndex.ToString()) { WebMessageBox.Show("此时间段当前已经安排"); return; } } // 下面验证此排课是否有效 int[,] teacher_table; int[,] major_table; int[,] or_table; // 教师空闲课表 专业年级空闲时间 或操作之后的空暇表 teacher_table = generalTeachTable(GridView1.Rows[0].Cells[7].Text, GridView1.Rows[0].Cells[6].Text); major_table = generalMajorTable(GridView1.Rows[0].Cells[9].Text, GridView1.Rows[0].Cells[9].Text, GridView1.Rows[0].Cells[6].Text); or_table = tableOrOperate(teacher_table, major_table); if (or_table[DropDownList2.SelectedIndex - 1, DropDownList1.SelectedIndex - 1] == 1) { WebMessageBox.Show("安排失败,此时间段已经被排课"); return; } // 可以排课 DataRow r = dt.NewRow(); r[0] = dt.Rows.Count; r[1] = DropDownList1.SelectedIndex; r[2] = DropDownList2.SelectedIndex; dt.Rows.Add(r); bind(dt); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { string strSql = "select count(*) from tb_Shop where id = " + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); SqlCommand cmd = obj.GetCommandStr(strSql); if (Convert.ToInt32(obj.ExecScalar(cmd)) < 0) { WebMessageBox.Show("您已删除了最后一条!请添加商品"); } else { string strSql1 = "delete from tb_Shop where id=" + Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); SqlCommand myCmd = obj.GetCommandStr(strSql1); obj.ExecNonQuery(myCmd); gvMemberBind(); } }
protected void Page_Load(object sender, EventArgs e) { active.UserName = Request.QueryString["username"]; active.ActiveCode = Request.QueryString["activecode"]; activeuser.UserName = Request.QueryString["username"]; if (active.EmailActiveSelect(active).Tables[0].Rows.Count > 0) { if (activeuser.UpdateUserStatus(activeuser) == 0) { active.EmailActiveDelete(active); //从activecode表中删除记录 WebMessageBox.Show("激活成功", "../user/auth_user/common_user/userdefault.aspx"); } else { WebMessageBox.Show("激活失败", "../index.aspx"); } } }
protected void Button1_Click(object sender, EventArgs e) { try { ViewState["SortOrder"] = "date_year"; ViewState["OrderDire"] = "ASC"; GridViewBind(); if (GridView1.Rows.Count != 0) { Button2.Visible = true; //Button3.Visible = true; } } catch (Exception ex) { WebMessageBox.Show(ex.ToString()); } }
public void Button1_Click(object sender, EventArgs e) { //添加 if (TextBox1.Text == "") { WebMessageBox.Show("请输入新密码"); return; } if (TextBox2.Text == "") { WebMessageBox.Show("请确认新密码"); return; } if (TextBox1.Text != TextBox2.Text) { WebMessageBox.Show("两次输入密码不一致"); return; } ChangeSql(TextBox1.Text); WebMessageBox.Show("修改完成"); }
protected void Button1_Click(object sender, EventArgs e) { //添加 if (TextBox1.Text == "") { WebMessageBox.Show("请输入新密码"); return; } if (TextBox2.Text == "") { WebMessageBox.Show("请确认新密码"); return; } if (TextBox1.Text != TextBox2.Text) { WebMessageBox.Show("两次输入密码不一致"); return; } Operation.runSql("update t_student set pwd='" + TextBox1.Text + "' where studentId='" + Session["student"].ToString() + "'"); WebMessageBox.Show("修改完成"); }