Пример #1
0
        protected override void OnInit(EventArgs e)
        {
            string userName = CookieHelper.GetCookieValue("myCookie");

            if (!string.IsNullOrEmpty(userName))
            {
                user = UserTran.Get(userName);
                Response.Write(" <script> parent.window.location.href= '../login.aspx' </script> ");
            }
            base.OnInit(e);
        }
Пример #2
0
    public string fnCount(UserTran userTran)
    {
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[id]", userTran.id);

        string sCountSql =
            "          SELECT COUNT(id)   " +
            "          FROM   [MNDTuser_tran]   " +
            "          WHERE  1 = 1 " + sCondition;
        string sPageSize = PublicApi.fnGetValue(sCountSql, "MNDT");

        return(sPageSize);
    }
Пример #3
0
    public string fnDeletes(User user, string sIP, string sId)
    {
        string sSql = " UPDATE [dbo].[MNDTuser] " +
                      "       SET [status] = 'D' " +
                      " WHERE [id] IN (" + user.id + ")";
        UserTran userTran = new UserTran();

        userTran.Id(user.id)
        .IP(sIP)
        .Status("D")
        .CreateId(sId);
        sSql += fnInsertsSql(userTran);

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Пример #4
0
    private string fnInsertSql(UserTran userTran)
    {
        string sSql =
            "  INSERT INTO [MNDTuser_tran]  " +
            "             ([id]  " +
            "             ,[ip]  " +
            "             ,[status]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "       VALUES  " +
            "             ('" + userTran.id + "'  " +
            "             , '" + userTran.ip + "'  " +
            "             , '" + userTran.status + "'  " +
            "             , '" + userTran.create_id + "'  " +
            "             , GETDATE())  ";

        return(sSql);
    }
Пример #5
0
    private string fnInsertsSql(UserTran userTran)
    {
        string sSql =
            "  INSERT INTO [MNDTuser_tran]  " +
            "             ([id]  " +
            "             ,[ip]  " +
            "             ,[status]  " +
            "             ,[create_id]  " +
            "             ,[create_datetime])  " +
            "  SELECT [id]  " +
            "        , '" + userTran.ip + "'  " +
            "        , '" + userTran.status + "'  " +
            "        , '" + userTran.create_id + "'  " +
            "        , GETDATE()  " +
            "  FROM [MNDTuser]  " +
            " WHERE [id] IN (" + userTran.id + ")";

        return(sSql);
    }
Пример #6
0
    public string fnUpdate(User user, string sIP, string sId)
    {
        string sSql = "  UPDATE [dbo].[MNDTuser]  " +
                      "     SET [account] = '" + user.account + "'  " +
                      "        ,[password] = '" + user.encrypt_password + "'  " +
                      "        ,[name] = '" + user.name + "'  " +
                      "        ,[address] = '" + user.address + "'  " +
                      "        ,[phone] = '" + user.phone + "'  " +
                      "        ,[status] = '" + user.status + "'  " +
                      "  WHERE [id] = '" + user.id + "' ";
        UserTran userTran = new UserTran();

        userTran.Id(user.id)
        .IP(sIP)
        .Status("M")
        .CreateId(sId);
        sSql += fnInsertSql(userTran);

        return(PublicApi.fnExecuteSQL(sSql, "MNDT"));
    }
Пример #7
0
    // iPage 第N頁
    // iSize 最大顯示數量
    public DataTable fnSelects(UserTran userTran, int iPage, int iSize)
    {
        int    iStart     = (iPage - 1) * iSize + 1;
        int    iEnd       = iPage * iSize;
        string sCondition = "";

        sCondition += PublicApi.fnAddCondition("[id]", userTran.id);
        string sInquireSql =
            "  SELECT [account_tran].[id],   " +
            "         [account_tran].[ip],   " +
            "         [account_tran].[status],   " +
            "         [account_tran].[create_id],   " +
            "         CONVERT(char, [account_tran].[create_datetime], 120) 'create_datetime'   " +
            "  FROM   (SELECT Row_number() OVER (ORDER BY [create_datetime] ASC) NUM,   " +
            "                  *   " +
            "          FROM   [MNDTuser_tran]   " +
            "          WHERE  1 = 1 " + sCondition + ") AS [account_tran]  " +
            "  WHERE  NUM BETWEEN " + iStart.ToString() + " AND " + iEnd.ToString() + "   ";

        return(PublicApi.fnGetDt(sInquireSql, "MNDT"));
    }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string userCookie = CookieHelper.GetCookieValue("myCookie");
         if (!string.IsNullOrEmpty(userCookie))
         {
             var user = UserTran.Get(userCookie);
             if (user != null)
             {
                 litDeptName.Text     = DeptmentTran.Get(int.Parse(user.DeptmentId.ToString())).DeptmentName;
                 litUserTrueName.Text = user.UserTrueName;
             }
             else
             {
                 Response.Write(" <script> parent.window.location.href= '../login.aspx' </script> ");
             }
         }
         else
         {
             Response.Write(" <script> parent.window.location.href= '../login.aspx' </script> ");
         }
     }
 }