Exemplo n.º 1
0
    private string ValidateUser(string myUserID, string myUserPassword)
    {
        this.Session["UserID"] = myUserID;
        string myJsonStr = "";
        string myState = "error";
        string myContent = "用户[" + myUserID + "]登录后台系统失败!";
           // myUserPassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(myUserPassword, "MD5");
        string mySql = "select * from tbl_User where UserName = '******' and UserPassword = '******'";

        ConnCls myConnCls = new ConnCls();
        DataRow myRow = myConnCls.GetDataRow(mySql);
        if (myRow != null)
        {
            myState = "ok";
            myContent = "用户[" + myUserID + "]登录后台系统成功!";

        }

        List<CReturnListCls> myJsonList = new List<CReturnListCls>();
        CReturnListCls myReturnListCls=new CReturnListCls();
        CReturnCls myReturnCls = new CReturnCls();
        myReturnCls.state = myState;
        myReturnListCls.ReturnInfo.Add(myReturnCls);
        myJsonList.Add(myReturnListCls);
        myJsonStr = JsonConvert.SerializeObject(myJsonList);

        //LogCls myLogCls = new LogCls();
        //myLogCls.WriteLog(myUserID, myContent);

        return myJsonStr;
    }
Exemplo n.º 2
0
    private string GetListInfo()
    {
        List<CListCls> myJsonList = new List<CListCls>();
        CListCls myListCls = new CListCls();
        ConnCls myConnCls = new ConnCls();
        string myJsonStr = "";
        int myInfoListCount = 0;

        string mySql = GetQuerySql();
        myListCls.InfoListCount = myInfoListCount;

        DataTable myTable = myConnCls.GetDataTable(mySql);
        foreach (DataRow myRow in myTable.Rows)
        {

            string myname = myRow["CName"].ToString();
            string mynumber = myRow["CNumber"].ToString();
            CInfoCls myInfoCls = new CInfoCls();
            myInfoCls.CName = myname;
            myInfoCls.CNumber = mynumber;
            myListCls.Info.Add(myInfoCls);
        }
        myJsonList.Add(myListCls);

        myJsonStr = JsonConvert.SerializeObject(myJsonList);

        return myJsonStr;
    }
Exemplo n.º 3
0
 public void WriteLog(string myUserID, string myContent)
 {
     ConnCls myConn = new ConnCls();
     string myUserName = myConn.GetUserNameByUserID(myUserID);
     string myLogDateTime = DateTime.Now.ToString();
     string mySql = "insert into tbl_Log (LogContent,UserID,UserName,LogDateTime) values("
         + "'" + myContent + "','" + myUserID + "','" + myUserName + "','" + myLogDateTime + "')";
     myConn.ExecuteSql(mySql);
 }
Exemplo n.º 4
0
 //设置查询条件
 private string GetQuerySql()
 {
     ConnCls myConnCls = new ConnCls();
     string mySql = "select * from CBarTest";
     return mySql;
 }