Ejemplo n.º 1
0
        public static void doctorDepartmentInsert(DepartmentDoctor depDoc)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = Common.getConnection();
                cmd.CommandText = "Doctor_Department_Insert";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter sDepartmentName = new SqlParameter("@departmentName", depDoc.departmentName);
                sDepartmentName.SqlDbType = System.Data.SqlDbType.NVarChar;
                cmd.Parameters.Add(sDepartmentName);

                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 2
0
        public static void doctorDepartmentDelete(DepartmentDoctor depDoc)
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = Common.getConnection();
                cmd.CommandText = "Doctor_Department_Delete";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter iDepartmentId = new SqlParameter("@departmentId", depDoc.departmentId);
                iDepartmentId.SqlDbType = System.Data.SqlDbType.Int;
                cmd.Parameters.Add(iDepartmentId);

                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 3
0
        public static List <DepartmentDoctor> getDepartmentList()
        {
            List <DepartmentDoctor> DepartmentList = new List <DepartmentDoctor>();

            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.Connection  = Common.getConnection();
                cmd.CommandText = "Doctor_Department_Select";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DepartmentDoctor dep = new DepartmentDoctor();
                    dep.departmentName = dt.Rows[i]["departmentName"].ToString();
                    dep.departmentId   = Int32.Parse(dt.Rows[i]["departmentId"].ToString());
                    DepartmentList.Add(dep);
                }
            }
            return(DepartmentList);
        }