Beispiel #1
0
    private void initUser()
    {
        if (Session["user"] == null)
        {
            Response.Redirect("../Admin_login.aspx");
            return;
        }
        UserPower u = Session["user"] as UserPower;

        if (u == null)
        {
            Response.Redirect("../Admin_login.aspx");
            return;
        }
        if (u.IsAdmin())
        {
            hf_hidden_test.Value = "true";
            btn_manage.Visible   = true;
        }
        else
        {
            hf_hidden_test.Value = "false";
            btn_manage.Visible   = false;
        }
    }
Beispiel #2
0
 private void PowerManage(UserPower user)
 {
     if (user.IsAdmin())
     {
         //do nothing
         btn_insert.Visible = true;
     }
     else if (user.IsSuperuser())
     {
         //ddl_dept.Visible = false;
         //lbl_dept.Text = user.UserDeptName;
         //p_floor.Visible = false;
     }
     else if (user.IsUser())
     {
         ddl_dept.Visible         = false;
         lbl_dept.Text            = user.UserDeptName;
         p_floor.Visible          = false;
         ddl_floor.Visible        = false;
         p_catigory2.Visible      = false;
         ddl_category2.Visible    = false;
         btn_export_floor.Visible = false;
         div_operation.Visible    = false;
     }
     else
     {
         //default
     }
 }
Beispiel #3
0
    private string GetPowerSqlWhere(UserPower user)
    {
        string retValue = "";

        if (user.IsAdmin())
        {
            //do nothing
        }
        else if (user.IsSuperuser())
        {
        }
        else if (user.IsUser())
        {
            retValue = " and dept='" + user.UserDeptName + "' ";
        }
        else
        {
            //default
        }
        return(retValue);
    }
Beispiel #4
0
    protected void rpt_patient_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //e.Item.DataItem
        UserPower user = Session["user"] as UserPower;

        //user = GetDummyUser();
        if (user == null)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "javascript", "<script>没有登录或会话失效,请登录!</script>");
            Response.Redirect("../../Admin_login.aspx");
        }
        object  o         = e.Item.DataItem;
        Control Btndelete = e.Item.FindControl("btn_delete");

        if (Btndelete != null)
        {
            if (!user.IsAdmin())
            {
                Btndelete.Visible = false;
            }
        }
    }