예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        private string AddUser(FrameBaseFunction.Model.ClsUserInfoMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into _UserInfo(");
            strSql.Append("vchrUid,vchrName,vchrPwd,vchrRemark,dtmCreate,dtmClose");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + model.vchrUid + "',");
            strSql.Append("'" + model.vchrName + "',");
            strSql.Append("'" + clsDES.Encrypt(model.vchrPwd) + "',");
            strSql.Append("'" + model.vchrRemark + "',");
            strSql.Append("'" + model.dtmCreate + "',");
            strSql.Append("'" + model.dtmClose + "'");
            strSql.Append(")");
            return(strSql.ToString());
        }
예제 #2
0
파일: Login.aspx.cs 프로젝트: chrgu000/DEMO
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        string uname = UserName.Text;//获取用户名
        string pwd   = Password.Text;
        //string NowDate = ASPxDateEdit1.Value.ToString();
        string upwd = clsDES.Encrypt(pwd);//获取密码

        ULogin(uname, upwd);
        //if (ADLogin("192.168.1.13", uname, pwd) == false)
        //{
        //    ULogin(uname, upwd);
        //}
    }
예제 #3
0
    public bool Insert(string vchrUid, string vchrName, string vchrPwd, string vchrRemark, DateTime dtmCreate, DateTime dtmClose)
    {
        string    uid = Session["uID"].ToString();
        ArrayList arr = new ArrayList();
        Sql       sql = new Sql();

        sSQL = "select * from  " + tablename + " where vchrUid='" + vchrUid + "'";
        DataTable dt = clsSQLCommond.ExecQuery(sSQL);

        if (dt.Rows.Count == 0)
        {
            sql.Get(tablename, "vchrUid", vchrUid, true);
        }
        else
        {
            sql.Get(tablename, "vchrUid", vchrUid, false);
        }
        sql.ToString("vchrName", vchrName);
        if (dtmCreate != null)
        {
            sql.ToString("dtmCreate", dtmCreate);
        }
        if (dtmClose != null)
        {
            sql.ToString("dtmClose", dtmClose);
        }
        if (vchrPwd != null && vchrPwd != "")
        {
            sql.ToString("vchrPwd", clsDES.Encrypt(vchrPwd));
        }
        else
        {
            //sql.ToString("vchrPwd", clsDES.Encrypt("123456"));
        }
        sql.ToString("vchrRemark", vchrRemark);
        arr.Add(sql.ReturnSql());
        bool b = clsSQLCommond.ExecSqlTran(arr);

        return(true);
    }
예제 #4
0
    protected void ToSave(object sender, EventArgs e)
    {
        SqlConnection  con = new SqlConnection(clsSQLCommond.Online);
        SqlCommand     cmd = new SqlCommand();
        SqlTransaction trans;

        con.Open();
        cmd.Connection  = con;
        trans           = con.BeginTransaction();
        cmd.Transaction = trans;
        try
        {
            #region 主表
            Sql sc = new Sql();
            if (YxBtn.HidID == "")
            {
                sc.Get(tablename, tableid, TextBox1.Text, true);
            }
            else
            {
                sc.Get(tablename, tableid, TextBox1.Text, false);
            }

            sc.ToString("vchrName", TextBox2.Text);
            if (TextBox3.Value == "" || TextBox3.Text != TextBox4.Text)
            {
                throw new Exception("密码不同或为空");
            }
            else
            {
                sc.ToString("vchrPwd", clsDES.Encrypt(TextBox3.Text));
            }
            //sc.ToString("cDepCode", ASPxComboBox1.Value.ToString());
            //sc.ToString("vchrRemark", TextBox7.Text);

            //if (ASPxDateEdit1.Value != null)
            //{
            //    sc.ToString("dtmCreate", ASPxDateEdit1.Value.ToString());
            //}
            //if (ASPxDateEdit2.Value != null)
            //{
            //    sc.ToString("dtmClose", ASPxDateEdit2.Value.ToString());
            //}

            cmd.CommandText = sc.ReturnSql();
            cmd.ExecuteNonQuery();
            #endregion


            trans.Commit();

            Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('保存成功');window.location.href ='../List.aspx';</script>");
        }
        catch (Exception ee)
        {
            trans.Rollback();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "<script>alert('" + ee.Message + "');</script>");
        }
        finally
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }
    }
예제 #5
0
        public string GetSave(string iID, string date1, string date2, string txt6, string txt7, string txt8, string txt9, string isnew, string[] arrautoid, string[] arr1, string[] arr2, string[] arr3, string[] arr4, string[] arr5, string[] arrimg1, string[] arrbar1, string hiddel, string[] arr7)
        {
            ArrayList arrlist = new ArrayList();

            string[] strdel = hiddel.Split(',');
            for (int i = 0; i < strdel.Length; i++)
            {
                if (strdel[i].Trim() != "")
                {
                    sSQL = "delete from Visitors where AutoID=" + strdel[i];
                    arrlist.Add(sSQL);
                }
            }

            #region 主表
            Sql sc = new Sql();
            if (iID == "")
            {
                sSQL = "select isnull(max(iID),0)+1 from Visitor";
                long ID = long.Parse(clsSQLCommond.ExecString(sSQL));
                iID = ID.ToString();

                sc.Get("Visitor", "iID", ID.ToString(), true);

                sc.ToString("dCreatesysTime", DateTime.Now.ToString());
                sc.ToString("dCreatesysPerson", Session["uID"].ToString());
            }
            else
            {
                sc.Get("Visitor", "iID", iID, false);

                sc.ToString("dChangeVerifyTime", DateTime.Now.ToString());
                sc.ToString("dChangeVerifyPerson", Session["uID"].ToString());
            }
            //sc.ToString("S1", TextBox1.Text);
            //sc.ToString("S2", TextBox2.Text);
            //sc.ToString("S3", DropDownList3.SelectedValue);
            //sc.ToString("S4", TextBox4.Text);
            //sc.ToString("S5", TextBox5.Text);

            sc.ToString("S6", txt6);
            sc.ToString("S7", txt7);
            sc.ToString("S8", txt8);
            sc.ToString("S9", txt9);

            sc.ToString("Date1", date1);
            sc.ToString("Date2", date2);
            //sc.ToString("Date3", Label13_1.Text);
            //sc.ToString("Date4", Label14_1.Text);

            //sc.ToString("Img1", hidImg1.Value);

            if (isnew != "")
            {
                sc.ToString("I1", 1);
            }
            else
            {
                sc.ToString("I1", 2);
            }
            arrlist.Add(sc.ReturnSql());
            #endregion

            sSQL = "select isnull(max(AutoID),0)+1 from Visitors";
            long AutoID = long.Parse(clsSQLCommond.ExecString(sSQL));

            #region 从表
            for (int i = 0; i < arrautoid.Length; i++)
            {
                Sql scc = new Sql();
                if (arrautoid[i] == "")
                {
                    scc.Get("Visitors", "AutoID", AutoID.ToString(), true);
                    AutoID = AutoID + 1;
                }
                else
                {
                    scc.Get("Visitors", "AutoID", arrautoid[i], false);
                }
                scc.ToString("iiID", iID);
                scc.ToString("SS1", clsDES.Encrypt(arr1[i]));
                scc.ToString("SS2", arr2[i]);
                scc.ToString("SS3", arr3[i]);
                scc.ToString("SS4", clsDES.Encrypt(arr4[i]));
                scc.ToString("SS5", clsDES.Encrypt(arr5[i]));
                scc.ToString("SS6", arrbar1[i]);
                scc.ToString("SS7", arr7[i]);
                scc.ToString("IImg1", arrimg1[i]);
                if (isnew != "")
                {
                    sc.ToString("I2", 1);
                }
                else
                {
                    sc.ToString("I2", 0);
                }
                arrlist.Add(scc.ReturnSql());
            }
            #endregion
            try
            {
                clsSQLCommond.ExecSqlTran(arrlist);
            }
            catch
            {
                return("");
            }
            return(iID);
        }