Beispiel #1
0
        protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e)
        {
            int roleID = GetSelectedDataKeyID(GridDpt);


            if (e.CommandName == "Edit")
            {
                Model.tReg model = BLL.GetModel(roleID);
                model.tDo = "已处理";
                if (BLL.Update(model))
                {
                    LoadData();
                }
                else
                {
                    Alert.ShowInTop("更新失败!");
                }
            }
        }
Beispiel #2
0
        protected void btn_Click(object sender, EventArgs e)
        {
            if (txt_name.Text.Trim() == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('客户名称不能为空!');</script>");
                txt_name.Focus();
                return;
            }
            if (txt_peo.Text.Trim() == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('联系人不能为空!');</script>");
                txt_peo.Focus();
                return;
            }
            if (txt_phone.Text.Trim() == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('联系电话不能为空!');</script>");
                txt_phone.Focus();
                return;
            }

            BLL.tReg          bll      = new BLL.tReg();
            List <Model.tReg> userList = bll.GetModelList(" tIp='" + Request.UserHostAddress + "'  order by Id desc ");

            Model.tReg tReg = userList.Count == 0 ? null : userList[0];
            DateTime   dt   = DateTime.Now;

            if (tReg != null)
            {
                if ((dt - (DateTime)tReg.tTime).Hours < 1)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('一个小时内不能重复注册!');</script>");
                    return;
                }
            }
            Model.tReg tRegNew = new Model.tReg();

            tRegNew.tName   = NoHTML(txt_name.Text);
            tRegNew.tAdress = NoHTML(txt_address.Text);
            tRegNew.tCode   = NoHTML(txt_code.Text);
            tRegNew.tMoney  = NoHTML(txt_money.Text);
            tRegNew.tType   = NoHTML(txt_type.Text);
            tRegNew.tPeo    = NoHTML(txt_peo.Text);
            tRegNew.tEm     = NoHTML(txt_em.Text);
            tRegNew.tPhone  = NoHTML(txt_phone.Text);
            tRegNew.tIp     = NoHTML(Request.UserHostAddress);
            tRegNew.tTime   = dt;
            if (bll.Add(tRegNew) > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('提交成功,请耐心等待!');</script>");
                txt_name.Text    = "";
                txt_address.Text = "";
                txt_code.Text    = "";
                txt_money.Text   = "";
                txt_type.Text    = "";
                txt_peo.Text     = "";
                txt_em.Text      = "";
                txt_phone.Text   = "";
                return;
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('提交失败,请直接拨打电话联系!');</script>");
                return;
            }
        }