Exemple #1
0
        public void Save(Doctor aDoctor)
        {
            string sqlQuery = "INSERT INTO tbl_doctors VALUES('" + aDoctor.Name + "','" + aDoctor.Degree + "','" + aDoctor.Specification + "', '" + aDoctor.DoctorCenterId + "')";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            aSqlCommand.ExecuteNonQuery();
            aConnectionManager.CloseConnection();
        }
        internal List <District> GetAllDistrict()
        {
            List <District> aDistrictList = new List <District>();
            string          sqlQuery      = "SELECT * FROM tbl_districts ORDER BY id ASC";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            aReader     = aSqlCommand.ExecuteReader();
            while (aReader.Read())
            {
                District aDistrict = new District();
                aDistrict.DistrictId   = Convert.ToInt32(aReader["id"]);
                aDistrict.DistrictName = aReader["name"].ToString();
                aDistrictList.Add(aDistrict);
            }
            aConnectionManager.CloseConnection();
            return(aDistrictList);
        }
        internal bool CreateNewCenter(Center aCenter)
        {
            string sqlQuery = "INSERT INTO tbl_centers VALUES('" + aCenter.CenterName + "', " + aCenter.DistrictId +
                              ", " + aCenter.ThanaId + ", '" + aCenter.CenterUserId + "', '" + aCenter.CenterPassword + "')";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            int effectedRows = aSqlCommand.ExecuteNonQuery();

            aConnectionManager.CloseConnection();
            if (effectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        internal string SaveMedicineToDb(Medicine aMedicine)
        {
            string sqlQuery = "INSERT INTO tbl_medicines VALUES('" + aMedicine.MedicineName + "', '" +
                              aMedicine.MedicinePower + "')";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            int effectedRows = aSqlCommand.ExecuteNonQuery();

            aConnectionManager.CloseConnection();
            if (effectedRows > 0)
            {
                return("Medicine Add SuccesFully");
            }
            else
            {
                return("fail");
            }
        }
Exemple #5
0
        internal string AddNewDisease(Disease aDisease)
        {
            string sqlQuery = "INSERT INTO tbl_diseases VALUES('" + aDisease.DiseaseName + "', '" +
                              aDisease.DiseaseDescription + "', '" + aDisease.TreatementProcedure + "', '" +
                              aDisease.PreparedDrugs + "')";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            int effectedRows = aSqlCommand.ExecuteNonQuery();

            aConnectionManager.CloseConnection();
            if (effectedRows > 0)
            {
                return("New diseases added succcesfully");
            }
            else
            {
                return("Falied");
            }
        }
        internal Center FindCodePswrd(Center aCenterLogin)
        {
            string query = "SELECT id, code, password FROM tbl_centers WHERE code='" + aCenterLogin.CenterUserId + "'AND password='******'";

            aSqlCommand = new SqlCommand(query, aConnectionManager.GetConnection());
            aReader     = aSqlCommand.ExecuteReader();
            if (aReader.HasRows)
            {
                Center aCenter = new Center();
                while (aReader.Read())
                {
                    aCenter.CenterId       = Convert.ToInt32(aReader["id"]);
                    aCenter.CenterUserId   = aReader["code"].ToString();
                    aCenter.CenterPassword = aReader["password"].ToString();
                }
                aConnectionManager.CloseConnection();
                return(aCenter);
            }
            aConnectionManager.CloseConnection();
            return(null);
        }
        public int AddNewPatient(Patient aPatient)
        {
            string sqlQuery = "INSERT INTO tbl_patients VALUES('"
                              + aPatient.VoterId + "','" + aPatient.DistrictId + "','" + aPatient.ThanaId + "')";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            int effectedRows = aSqlCommand.ExecuteNonQuery();

            if (effectedRows > 0)
            {
                aSqlCommand.CommandText = "SELECT MAX(id) AS Id FROM tbl_patients";
                aReader = aSqlCommand.ExecuteReader();
                aReader.Read();
                int patientId = Convert.ToInt32(aReader["Id"]);
                aConnectionManager.CloseConnection();
                return(patientId);
            }
            else
            {
                return(0);
            }
        }
        internal int SaveTreatement(Treatement aTreatement)
        {
            string sqlQuery = "INSERT INTO tbl_service_taken VALUES('" + aTreatement.PatientId + "', '" +
                              aTreatement.Observation + "', '" + aTreatement.Date + "', '" + aTreatement.DoctorId + "', " + aTreatement.CenterId + ")";

            aSqlCommand = new SqlCommand(sqlQuery, aConnectionManager.GetConnection());
            int effectedRows = aSqlCommand.ExecuteNonQuery();

            if (effectedRows > 0)
            {
                aSqlCommand.CommandText = "SELECT MAX(id) AS Id FROM tbl_service_taken";
                aReader = aSqlCommand.ExecuteReader();
                aReader.Read();
                int serviceId = Convert.ToInt32(aReader["Id"]);
                aConnectionManager.CloseConnection();
                return(serviceId);
            }
            else
            {
                aConnectionManager.CloseConnection();
                return(0);
            }
        }