Esempio n. 1
0
    protected void lvUserList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
    {
        Label lblnID = (Label)lvUserList.Items[e.NewSelectedIndex].FindControl("lblnUserID");
        int   _nID   = 0;

        DBLL.clsUser user = new DBLL.clsUser();
        if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0)
        {
            MultiView1.ActiveViewIndex = 1;
            DataTable dt = user.Select_tb_UserBynUserID(_nID);
            txtsUsername.Text = dt.Rows[0]["sUsername"].ToString();
            txtsPassword.Text = dt.Rows[0]["sPassword"].ToString();
            txtsPassword.Attributes.Add("Value", txtsPassword.Text);
            txtsPassword2.Text = dt.Rows[0]["sPassword"].ToString();
            txtsPassword2.Attributes.Add("Value", txtsPassword2.Text);
            txtsRealName.Text          = dt.Rows[0]["sRealName"].ToString();
            rblnUserSex.SelectedValue  = dt.Rows[0]["nUserSex"].ToString();
            txtsUserQQ.Text            = dt.Rows[0]["sUserQQ"].ToString();
            txtsUserMSN.Text           = dt.Rows[0]["sUserMSN"].ToString();
            txtsUserPhone.Text         = dt.Rows[0]["sUserPhone"].ToString();
            txtsUserEmail.Text         = dt.Rows[0]["sUserEmail"].ToString();
            cbIsContact.Checked        = bool.Parse(dt.Rows[0]["IsContact"].ToString());
            cbIsInquiry.Checked        = bool.Parse(dt.Rows[0]["IsInquiry"].ToString());
            rblnUserType.SelectedValue = dt.Rows[0]["nUserType"].ToString();
            hfUserUpdateID.Value       = _nID.ToString();
        }
    }
Esempio n. 2
0
 protected void BtnAdd_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     if (ValiAdd())
     {
         DBLL.clsUser       user   = new DBLL.clsUser();
         DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
         int _Result = user.insert_tb_User(txtsUsername.Text, txtsPassword2.Text, txtsRealName.Text, int.Parse(rblnUserSex.SelectedValue), txtsUserQQ.Text, txtsUserMSN.Text, txtsUserPhone.Text, txtsUserEmail.Text, int.Parse(rblnUserType.SelectedValue), Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, 1, cbIsContact.Checked, cbIsInquiry.Checked);
         if (_Result > 0)
         {
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertSuccess");
             ShowMsg1.Show();
             Clear();
         }
         else
         {
             ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertFail");
             ShowMsg1.Show();
         }
     }
     else
     {
         ShowMsg1.Show();
     }
 }
Esempio n. 3
0
    public void ReBindPageList()
    {
        DBLL.clsUser User = new DBLL.clsUser();
        DataTable    dt   = new DataTable();

        dt = User.sp_selectNormalTableOfAllByUser(false);
        if (dt != null)
        {
            UserList.Merge(dt);
            lvUserList.DataSource = UserList;
            lvUserList.DataBind();
        }
        else
        {
            lvUserList.DataSource = null;
            lvUserList.DataBind();
        }
    }
Esempio n. 4
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     try
     {
         int nID = 0;
         if (int.TryParse(hfID.Value.ToString(), out nID) && nID > 0)
         {
             //更新
             if (ValiEdit())
             {
                 DBLL.clsUser       user   = new DBLL.clsUser();
                 DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
                 bool _Result = user.update_tb_UserBynUserID(nID, txtsUsername.Text, txtsPassword0.Text, txtsRealName.Text, int.Parse(RadioButtonList1.SelectedValue), txtsUserQQ.Text, txtsUserMSN.Text, txtsUserPhone.Text, txtsUserEmail.Text, int.Parse(RadioButtonList2.SelectedValue), Session["user"].ToString(), DateTime.Now, true, 1, true, true);
                 if (_Result == true)
                 {
                     ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess");
                     ShowMsg1.Show();
                 }
                 else
                 {
                     //失败就一条
                     ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail");
                     ShowMsg1.Show();
                 }
             }
             else
             {
                 ShowMsg1.Show();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 5
0
 protected void BtnUpdate_Click(object sender, EventArgs e)
 {
     //判断session
     if (Session["User"] == null || Session["User"].ToString().Length < 1)
     {
         Response.Redirect(Request.RawUrl);
     }
     try
     {
         if (ValiEdit())
         {
             DBLL.clsUser       user   = new DBLL.clsUser();
             DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
             bool _Result = user.update_tb_UserBynUserID(int.Parse(hfUserUpdateID.Value), txtsUsername.Text, txtsPassword2.Text, txtsRealName.Text, int.Parse(rblnUserSex.SelectedValue), txtsUserQQ.Text, txtsUserMSN.Text, txtsUserPhone.Text, txtsUserEmail.Text, int.Parse(rblnUserType.SelectedValue), Session["user"].ToString(), DateTime.Now, true, 1, cbIsContact.Checked, cbIsInquiry.Checked);
             if (_Result == true)
             {
                 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess");
                 ShowMsg1.Show();
                 MultiView1.ActiveViewIndex = 0;
                 ReBindPageList();
             }
             else
             {
                 //失败就一条
                 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail");
                 ShowMsg1.Show();
             }
         }
         else
         {
             ShowMsg1.Show();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 6
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         DBLL.clsUser user = new DBLL.clsUser();
         DataTable    dt   = user.Select_tb_UserBysUsernameandsPassword(txtUsername.Text, txtPassword.Text);
         if (dt != null && dt.Rows.Count > 0)
         {
             Session["UserID"] = dt.Rows[0]["nUserID"].ToString();
             Session["User"]   = dt.Rows[0]["sUsername"].ToString();
             Response.Redirect("Default.aspx");
         }
         else
         {
             ShowMsg1.InnerContent = "<p>用户名或密码错误!</p>";
             ShowMsg1.Show();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int nID = 0;
         if (Request.QueryString["nID"] != null && int.TryParse(Request.QueryString["nID"].ToString(), out nID) && nID > 0)
         {
             lblBigtitle.Text  = "编辑数据";
             BtnAdd.Visible    = false;
             btnUpdate.Visible = true;
             DBLL.clsUser clUser = new DBLL.clsUser();
             DataTable    dt     = clUser.Select_tb_UserBynUserID(nID);
             if (dt != null && dt.Rows.Count > 0)
             {
                 hfID.Value = dt.Rows[0]["nUserID"].ToString();
                 RadioButtonList2.SelectedValue = dt.Rows[0]["nUserType"].ToString();
                 txtsUsername.Text              = dt.Rows[0]["sUsername"].ToString();
                 txtsPassword0.Text             = dt.Rows[0]["sPassword"].ToString();
                 txtsPassword1.Text             = dt.Rows[0]["sPassword"].ToString();
                 RadioButtonList1.SelectedValue = dt.Rows[0]["nUserSex"].ToString();
                 txtsRealName.Text              = dt.Rows[0]["sRealName"].ToString();
                 txtsUserQQ.Text    = dt.Rows[0]["sUserQQ"].ToString();
                 txtsUserMSN.Text   = dt.Rows[0]["sUserMSN"].ToString();
                 txtsUserPhone.Text = dt.Rows[0]["sUserPhone"].ToString();
                 txtsUserEmail.Text = dt.Rows[0]["sUserEmail"].ToString();
                 //绑定数据
             }
         }
         else
         {
             lblBigtitle.Text  = "添加数据";
             btnUpdate.Visible = false;
             BtnAdd.Visible    = true;
         }
     }
 }