コード例 #1
0
    private void MyInit()
    {
        using (SqlConnection conn = new DB().GetConnection())
        {
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from Doctor order by ID desc;";
            conn.Open();
            SqlDataReader rd = cmd.ExecuteReader();
            DoctorDDL.DataSource     = rd;
            DoctorDDL.DataValueField = "GUID";
            DoctorDDL.DataTextField  = "DoctorName";
            DoctorDDL.DataBind();
            rd.Close();
            DoctorDDL.Items.Insert(0, new ListItem("按医生分类", "-1"));

            cmd.CommandText = "select * from Doctor where GUID=@GUID";
            cmd.Parameters.AddWithValue("@GUID", Session["DoctorGUID"].ToString());
            rd = cmd.ExecuteReader();
            string IsAdmin = "";
            if (rd.Read())
            {
                IsAdmin = Util.AESDecrypt(rd["IsAdmin"].ToString());
            }
            rd.Close();
            if (IsAdmin == "True")
            {
                DelBtn.Visible = true;
            }
            else
            {
                DelBtn.Visible = false;
            }

            conn.Close();
        }
    }
コード例 #2
0
ファイル: Dashboard.aspx.cs プロジェクト: OMGdadada/newMPRE
    private void MyInit()
    {
        HospitalGUID.Text = Session["HospitalGUID"].ToString();
        using (SqlConnection conn = new DB().GetConnection())
        {
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from Doctor order by ID desc;";
            conn.Open();
            SqlDataReader rd = cmd.ExecuteReader();
            DoctorDDL.DataSource     = rd;
            DoctorDDL.DataValueField = "GUID";
            DoctorDDL.DataTextField  = "DoctorName";
            DoctorDDL.DataBind();
            rd.Close();
            DoctorDDL.Items.Insert(0, new ListItem("按医生分类", "-1"));

            /*
             * cmd.CommandText = "select count(*) as maxrow from [Patient] ";
             * rd = cmd.ExecuteReader();
             * if (rd.Read())
             * {
             *  PatientNum.Text = rd["maxrow"].ToString();
             * }
             * rd.Close();
             *
             *
             * cmd.CommandText = "select count(*) as maxrow from [TSView] where IsDel=0";
             * rd = cmd.ExecuteReader();
             * if (rd.Read())
             * {
             *  TestNum.Text = rd["maxrow"].ToString();
             * }
             * rd.Close();
             *
             * cmd.CommandText = "select count(*) as maxrow from [Report] where IsDel=0";
             * rd = cmd.ExecuteReader();
             * if (rd.Read())
             * {
             *  ReportNum.Text = rd["maxrow"].ToString();
             * }
             * rd.Close();
             *
             * cmd.CommandText = "select * from [Hospital] where [GUID] = @HospitalGUID";
             * cmd.Parameters.AddWithValue("@HospitalGUID", HospitalGUID.Text);
             * rd = cmd.ExecuteReader();
             * if (rd.Read())
             * {
             *  Image1.ImageUrl = rd["Avatar"].ToString();
             *  HospitalName.Text = rd["HospitalName"].ToString();
             *  Introduction.Text = rd["Introduction"].ToString();
             * }
             * rd.Close();
             */
            cmd.CommandText = "select * from Doctor where GUID=@GUID";
            cmd.Parameters.AddWithValue("@GUID", Session["DoctorGUID"].ToString());
            rd = cmd.ExecuteReader();
            string IsAdmin = "";
            if (rd.Read())
            {
                IsAdmin = Util.AESDecrypt(rd["IsAdmin"].ToString());
            }
            rd.Close();
            if (IsAdmin == "True")
            {
                DelBtn.Visible = true;
            }
            else
            {
                DelBtn.Visible = false;
            }

            conn.Close();
        }
    }