예제 #1
0
        //Doctor Detail in List
        public List <DoctorForTable> GetDoctorList(Int32 userID)
        {
            List <DoctorForTable> listDoctor = new List <DoctorForTable>();

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetDoctorList", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("userID", userID);
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    DoctorForTable doctorModel = new DoctorForTable();
                    doctorModel.DoctorID          = Int32.Parse(reader[0].ToString());
                    doctorModel.FirstName         = reader[1].ToString();
                    doctorModel.LastName          = reader[2].ToString();
                    doctorModel.EmailID           = reader[3].ToString();
                    doctorModel.RelatedHospital   = reader[4].ToString();
                    doctorModel.Specialty         = reader[5].ToString();
                    doctorModel.Address           = reader[6].ToString();
                    doctorModel.ContactNumber1    = Int64.Parse(reader[7].ToString());
                    doctorModel.ContactNumber2    = Int64.Parse(reader[8].ToString());
                    doctorModel.PrimaryDoctorMark = reader[9].ToString();
                    listDoctor.Add(doctorModel);
                }
            }
            return(listDoctor);
        }
        public void Post(DoctorForTable doctorModel)
        {
            string token = this.Request.Headers.GetValues("Token").Single();

            string[] userDetails = UserDetails(token);
            int      userID      = Convert.ToInt32(userDetails[2]);

            try
            {
                DoctorDetailsModel docModel = new DoctorDetailsModel();
                docModel.doctorID          = doctorModel.DoctorID;
                docModel.firstName         = doctorModel.FirstName;
                docModel.lastName          = doctorModel.LastName;
                docModel.email             = doctorModel.EmailID;
                docModel.relatedHospital   = doctorModel.RelatedHospital;
                docModel.specialty         = doctorModel.Specialty;
                docModel.address           = doctorModel.Address;
                docModel.contactNumber1    = doctorModel.ContactNumber1;
                docModel.contactNumber2    = doctorModel.ContactNumber2;
                docModel.primaryDoctorMark = doctorModel.PrimaryDoctorMark;
                docModel.userID            = 101;
                //Checking Doctordetails InDataBase
                bool checkDoctorInDB = UDBusiness.CheckDoctorInDB(docModel.doctorID, docModel.userID);
                if (!checkDoctorInDB)
                {
                    //setting model to Doctor DB
                    UDBusiness.SetDoctorDetails(docModel);
                    //Updating Primary Mark
                    if (docModel.primaryDoctorMark.Equals("Yes"))
                    {
                        UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID);
                    }
                }
                else
                {
                    //Update Doctor Details in DB
                    UDBusiness.UpdateDoctorDetails(docModel, docModel.userID);
                    if (docModel.primaryDoctorMark.Equals("Yes"))
                    {
                        UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID);
                    }
                }
                //Authorization a =new Authorization
            }
            catch (Exception ex)
            {
                WriteLog write   = new WriteLog();
                string   message = ex.Message;
                write.WriteLogMessage(message);
                string strMsg = UDBusiness.IngnoreSpecialCharacter(message);
                string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
            }
        }
예제 #3
0
 public void AddNewDoctor(DoctorForTable doctorModel)
 {
     try
     {
         UserDetailsModel   udModel  = (UserDetailsModel)Session["userModel"];
         DoctorDetailsModel docModel = new DoctorDetailsModel();
         docModel.doctorID          = doctorModel.DoctorID;
         docModel.firstName         = doctorModel.FirstName;
         docModel.lastName          = doctorModel.LastName;
         docModel.email             = doctorModel.EmailID;
         docModel.relatedHospital   = doctorModel.RelatedHospital;
         docModel.specialty         = doctorModel.Specialty;
         docModel.address           = doctorModel.Address;
         docModel.contactNumber1    = doctorModel.ContactNumber1;
         docModel.contactNumber2    = doctorModel.ContactNumber2;
         docModel.primaryDoctorMark = doctorModel.PrimaryDoctorMark;
         docModel.userID            = udModel.userId;
         //Checking Doctordetails InDataBase
         //bool checkDoctorInDB = UDBusiness.CheckDoctorInDB(docModel.doctorID,docModel.userID);
         bool checkDoctorInDB = UDBusiness.CheckDoctorInDBEF(docModel.doctorID, docModel.userID);
         if (!checkDoctorInDB)
         {
             //setting model to Doctor DB
             UDBusiness.AddNewDoctorEF(docModel);
             //Updating Primary Mark
             if (docModel.primaryDoctorMark.Equals("Yes"))
             {
                 //UDBusiness.UpdateDoctorPrimaryMark(docModel.userID, docModel.doctorID);
                 UDBusiness.UpdateDoctorPrimaryMarkEF(docModel.userID, docModel.doctorID);
             }
         }
         else
         {
             //Update Doctor Details in DB
             //UDBusiness.UpdateDoctorDetails(docModel, docModel.userID);
             UDBusiness.UpdateDoctorInEF(docModel, docModel.userID);
             if (docModel.primaryDoctorMark.Equals("Yes"))
             {
                 UDBusiness.UpdateDoctorPrimaryMarkEF(docModel.userID, docModel.doctorID);
             }
         }
     }
     catch (Exception ex)
     {
         WriteLog write   = new WriteLog();
         string   message = ex.Message;
         write.WriteLogMessage(message);
         string strMsg = UDBusiness.IngnoreSpecialCharacter(message);
         string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
         Response.Write(script);
     }
 }