public static DoctorDto GetOneDoctorDto(string table,string strwhere)
        {
            DoctorDto doctorDto=new DoctorDto();

            doctorDto = DoctorDal.GetOneDoctor(table, strwhere);

            return doctorDto;
        }
        public ActionResult DoctorInsert(DoctorAddViewModel model)
        {
            DoctorDto doctorDto = new DoctorDto();

            doctorDto.DoctorUserName = model.DoctorUserName;
            doctorDto.DoctorRealName = model.DoctorRealName;
            doctorDto.DoctorPassword = CommonTools.ToMd5(model.DoctorPassword);
            doctorDto.DoctorRegTime = System.DateTime.Now;

            DoctorBll.AddDoctor(doctorDto);

               return RedirectTo("/Doctor/DoctorIndex", "医生添加成功了");
               //return RedirectToAction("DoctorIndex");
        }
        public static void AddDoctor(DoctorDto doctorDto)
        {
            SqlParameter[] arParames = DoctorDal.getParameters(doctorDto);
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
                SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateDoctor", arParames);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
        public static List<DoctorDto> GetDoctorList(string strwhere)
        {
            List<DoctorDto> doctorlist = new List<DoctorDto>();

            SqlParameter[] arParames = new SqlParameter[2];
            arParames[0] = new SqlParameter("@table ", SqlDbType.VarChar, 200);
            arParames[0].Value = "QxsqDoctor";

            arParames[1] = new SqlParameter("@Where ", SqlDbType.VarChar, 8000);
            arParames[1].Value = strwhere;
             SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
            DataTable dt = null;
            DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "getModelByWhere", arParames);
            dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
                DoctorDto doctorDto = new DoctorDto();

                doctorDto = DoctorDal.getDataRowToDoctorDto(dr);

                doctorlist.Add(doctorDto);

            }

            return doctorlist;
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
 public static void UpdateDoctorDto(DoctorDto doctorDto)
 {
     DoctorDal.UpdateDoctor(doctorDto);
 }
 public static void AddDoctor(DoctorDto doctorDto)
 {
     DoctorDal.AddDoctor(doctorDto);
 }
        private static SqlParameter[] getParameters(DoctorDto doctorDto)
        {
            SqlParameter[] arParames = new SqlParameter[5];

            arParames[0] = new SqlParameter("@DoctorId", SqlDbType.Int);
            arParames[0].Value = doctorDto.DoctorId;

            arParames[1] = new SqlParameter("@DoctorUserName", SqlDbType.VarChar, 50);
            arParames[1].Value = doctorDto.DoctorUserName;

            arParames[2] = new SqlParameter("@DoctorPassword", SqlDbType.VarChar, 50);
            arParames[2].Value = doctorDto.DoctorPassword;

            arParames[3] = new SqlParameter("@DoctorRealName", SqlDbType.VarChar, 50);
            arParames[3].Value = doctorDto.DoctorRealName;

            arParames[4] = new SqlParameter("@DoctorRegTime", SqlDbType.DateTime);
            arParames[4].Value = doctorDto.DoctorRegTime;

            return arParames;
        }
        private static DoctorDto getDataRowToDoctorDto(DataRow dr)
        {
            DoctorDto doctorDto = new DoctorDto();

            doctorDto.DoctorId = int.Parse(dr["DoctorId"].ToString());
            doctorDto.DoctorUserName = dr["DoctorUserName"].ToString();
            doctorDto.DoctorRealName = dr["DoctorRealName"].ToString();

            doctorDto.DoctorPassword = dr["DoctorPassword"].ToString();

            doctorDto.DoctorRegTime = DateTime.Parse(dr["DoctorRegTime"].ToString());

            return doctorDto;
        }
Exemple #9
0
 public static void SetSessions(DoctorDto doctorDto)
 {
     HttpContext.Current.Session["DoctorId"] = doctorDto.DoctorId;
 }