Exemple #1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            //数据表为空时不执行本操作
            if (bds.Current == null)
            {
                return;
            }
            Datasets.DSjckja.toptionlbRow r = (Datasets.DSjckja.toptionlbRow)(((DataRowView)bds.Current).Row);
            string cmd = "SELECT * FROM toptionxm WHERE lbdm =" + ClsQ.Q1(r.dm);

            if (ClsMSSQL.Exists(cmd, ClsDBCon.ConStrKj))
            {
                ClsMsgBox.Jg("该类别下存在项目无法删除");
                return;
            }
            ClsMsgBox.YesNo("确定要删除该记录吗?", deleting);
        }
Exemple #2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     #region 账户或口令为空判断
     txtLoginName.Text = txtLoginName.Text.Trim();
     if (string.IsNullOrEmpty(txtLoginName.Text))
     {
         ClsMsgBox.Jg("账号不能为空!");
         return;
     }
     txtPassword.Text = txtPassword.Text.Trim();
     if (string.IsNullOrEmpty(txtPassword.Text))
     {
         ClsMsgBox.Jg("口令不能为空!");
         return;
     }
     #endregion
     #region  账户、口令有效性判断
     if (!ClsMSSQL.Exists("tlogin", "loginname", txtLoginName.Text, ClsDBCon.ConStrKj))
     {
         ClsMsgBox.Jg("账户不存在!");
         return;
     }
     #endregion
     string cmd = string.Format("SELECT * FROM tlogin WHERE loginname = '{0}' AND " + "password = '******'", txtLoginName.Text, txtPassword.Text);
     if (!ClsMSSQL.Exists(cmd, ClsDBCon.ConStrKj))
     {
         ClsMsgBox.Jg("口令不正确");
         return;
     }
     #region 是否保存到cookie
     if (chkAutoSave.Checked)
     {
         Context.Cookies["Account"]  = txtLoginName.Text;
         Context.Cookies["Password"] = txtPassword.Text;
     }
     else
     {
         Context.Cookies["Account"]  = "";
         Context.Cookies["Password"] = "";
     }
     #endregion
     this.Context.Session.IsLoggedOn = true;
 }