public List <TreatmentGiven> LoadGriddata(string voterID, int serviceNumber)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select * from tbl_TreatmentGiven where VoterID = '" + voterID + "' and ServiceGiven = '" + serviceNumber + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            List <TreatmentGiven> generalList = new List <TreatmentGiven>();
            SqlDataReader         reader      = command.ExecuteReader();

            while (reader.Read())
            {
                TreatmentGiven aTreatmentGiven = new TreatmentGiven();
                aTreatmentGiven.Disease  = reader["Disease"].ToString();
                aTreatmentGiven.Medicine = reader["Medicine"].ToString();
                aTreatmentGiven.Dose     = reader["Dose"].ToString();
                aTreatmentGiven.Meal     = reader["Meal"].ToString();
                aTreatmentGiven.Quantity = int.Parse(reader["Quantity"].ToString());
                aTreatmentGiven.Note     = reader["Note"].ToString();
                generalList.Add(aTreatmentGiven);
            }
            reader.Close();
            connection.Close();
            return(generalList);
        }
예제 #2
0
        public int SaveTreatmentGiven(TreatmentGiven aTreatmentGiven)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "insert into tbl_TreatmentGiven values ('" + aTreatmentGiven.VoterID + "','" + aTreatmentGiven.ServiceGiven + "','" + aTreatmentGiven.Observation + "','" + aTreatmentGiven.Date + "','" + aTreatmentGiven.Doctor + "','" + aTreatmentGiven.Disease + "','" + aTreatmentGiven.Medicine + "','" + aTreatmentGiven.Dose + "','" + aTreatmentGiven.Meal + "','" + aTreatmentGiven.Quantity + "','" + aTreatmentGiven.Note + "','" + aTreatmentGiven.CenterID + "','" + aTreatmentGiven.ThanaID + "','" + aTreatmentGiven.DistrictID + "')";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
예제 #3
0
        public ActionResult TreatmentGiven(FormCollection collection)
        {
            //HospitalLocation Location = new HospitalLocation();
            //collection
            //return View();
            TreatmentGiven location = new TreatmentGiven();

            location.HospitalId = Convert.ToInt32(collection["hospital_name_hid_name"]);
            location.LocationId = 0;



            return(View());
        }
 public List<TreatmentGiven> DiseaseWiseList(string fromdate, string todate, string diseaseName)
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "select DistrictID, VoterID, Disease  from tbl_TreatmentGiven where Date >= '" + fromdate + "' and Date <= '" + todate + "' and Disease = '" + diseaseName + "'";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     List<TreatmentGiven> diseaseWisesList = new List<TreatmentGiven>();
     SqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         TreatmentGiven aTreatmentGiven = new TreatmentGiven();
         aTreatmentGiven.DistrictID = int.Parse(reader["DistrictID"].ToString());
         aTreatmentGiven.VoterID = reader["VoterID"].ToString();
         diseaseWisesList.Add(aTreatmentGiven);
     }
     reader.Close();
     connection.Close();
     return diseaseWisesList;
 }
예제 #5
0
        public List <TreatmentGiven> DiseaseWiseList(string fromdate, string todate, string diseaseName)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select DistrictID, VoterID, Disease  from tbl_TreatmentGiven where Date >= '" + fromdate + "' and Date <= '" + todate + "' and Disease = '" + diseaseName + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            List <TreatmentGiven> diseaseWisesList = new List <TreatmentGiven>();
            SqlDataReader         reader           = command.ExecuteReader();

            while (reader.Read())
            {
                TreatmentGiven aTreatmentGiven = new TreatmentGiven();
                aTreatmentGiven.DistrictID = int.Parse(reader["DistrictID"].ToString());
                aTreatmentGiven.VoterID    = reader["VoterID"].ToString();
                diseaseWisesList.Add(aTreatmentGiven);
            }
            reader.Close();
            connection.Close();
            return(diseaseWisesList);
        }
 public List<TreatmentGiven> LoadGeneralData(string voterID, int totalService)
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "select * from tbl_TreatmentGiven where VoterID = '" + voterID + "' and ServiceGiven = '"+totalService+"'";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     List<TreatmentGiven> generalList = new List<TreatmentGiven>();
     SqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         TreatmentGiven aTreatmentGiven = new TreatmentGiven();
         aTreatmentGiven.CenterID = int.Parse(reader["CenterID"].ToString());
         aTreatmentGiven.Date = reader["Date"].ToString();
         aTreatmentGiven.Doctor = reader["Doctor"].ToString();
         aTreatmentGiven.Observation = reader["Observation"].ToString();
         aTreatmentGiven.ServiceGiven = int.Parse(reader["ServiceGiven"].ToString());
         generalList.Add(aTreatmentGiven);
     }
     reader.Close();
     connection.Close();
     return generalList;
 }
        public List <TreatmentGiven> LoadGeneralData(string voterID, int totalService)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select * from tbl_TreatmentGiven where VoterID = '" + voterID + "' and ServiceGiven = '" + totalService + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            List <TreatmentGiven> generalList = new List <TreatmentGiven>();
            SqlDataReader         reader      = command.ExecuteReader();

            while (reader.Read())
            {
                TreatmentGiven aTreatmentGiven = new TreatmentGiven();
                aTreatmentGiven.CenterID     = int.Parse(reader["CenterID"].ToString());
                aTreatmentGiven.Date         = reader["Date"].ToString();
                aTreatmentGiven.Doctor       = reader["Doctor"].ToString();
                aTreatmentGiven.Observation  = reader["Observation"].ToString();
                aTreatmentGiven.ServiceGiven = int.Parse(reader["ServiceGiven"].ToString());
                generalList.Add(aTreatmentGiven);
            }
            reader.Close();
            connection.Close();
            return(generalList);
        }
 public int SaveTreatmentGiven(TreatmentGiven aTreatmentGiven)
 {
     return aTreatmentGivenGateway.SaveTreatmentGiven(aTreatmentGiven);
 }
 public List<TreatmentGiven> LoadGriddata(string voterID, int serviceNumber)
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "select * from tbl_TreatmentGiven where VoterID = '" + voterID + "' and ServiceGiven = '"+serviceNumber+"'";
     SqlCommand command = new SqlCommand(query, connection);
     connection.Open();
     List<TreatmentGiven> generalList = new List<TreatmentGiven>();
     SqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         TreatmentGiven aTreatmentGiven = new TreatmentGiven();
         aTreatmentGiven.Disease = reader["Disease"].ToString();
         aTreatmentGiven.Medicine = reader["Medicine"].ToString();
         aTreatmentGiven.Dose = reader["Dose"].ToString();
         aTreatmentGiven.Meal = reader["Meal"].ToString();
         aTreatmentGiven.Quantity = int.Parse(reader["Quantity"].ToString());
         aTreatmentGiven.Note = reader["Note"].ToString();
         generalList.Add(aTreatmentGiven);
     }
     reader.Close();
     connection.Close();
     return generalList;
 }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            string center = Session["Center"].ToString();
            string thana = Session["Thana"].ToString();
            string district = Session["District"].ToString();
            int result = 0;
            int serviceNumber = int.Parse(servicegivenTextBox.Text) + 1;

            foreach (TreatmentGiven givenTreatment in treatmentList)
            {
                TreatmentGiven anotherTreatmentGiven = new TreatmentGiven();

                anotherTreatmentGiven.VoterID = voterIDTextBox.Text;
                anotherTreatmentGiven.ServiceGiven = serviceNumber;
                anotherTreatmentGiven.Observation = observationTextBox.Text;
                DateTime date = dateCalender.SelectedDate;
                string day = date.Day.ToString();
                string month = date.Month.ToString();
                string year = date.Year.ToString();
                string datetoSave = year + "/" + month + "/" + day;
                anotherTreatmentGiven.Date = datetoSave;
                anotherTreatmentGiven.Doctor = doctorDropDownList.SelectedItem.ToString();

                anotherTreatmentGiven.Disease = givenTreatment.Disease;
                anotherTreatmentGiven.Medicine = givenTreatment.Medicine;
                anotherTreatmentGiven.Dose = givenTreatment.Dose;
                anotherTreatmentGiven.Meal = givenTreatment.Meal;
                anotherTreatmentGiven.Quantity = givenTreatment.Quantity;
                anotherTreatmentGiven.Note = givenTreatment.Note;
                anotherTreatmentGiven.CenterID = aTreatmentGivenManager.GetIDByCenter(center);
                anotherTreatmentGiven.ThanaID = aTreatmentGivenManager.GetIDByThanaName(thana);
                anotherTreatmentGiven.DistrictID = aTreatmentGivenManager.GetIDByDistrictName(district);

                result = aTreatmentGivenManager.SaveTreatmentGiven(anotherTreatmentGiven);
            }

            if (result != 0)
            {
                showLabel.Text = "Treatment saved successfully";
            }
            else
            {
                showLabel.Text = "Treatment not saved.";
            }

            PdfPTable pdfPTable = new PdfPTable(treatmentGridView.HeaderRow.Cells.Count);

            foreach (TableCell headerCell in treatmentGridView.HeaderRow.Cells)
            {
                PdfPCell pdfCell = new PdfPCell(new Phrase(headerCell.Text));
                pdfPTable.AddCell(pdfCell);
            }

            foreach (GridViewRow gridViewRow in treatmentGridView.Rows)
            {
                foreach (TableCell tableCell in gridViewRow.Cells)
                {
                    PdfPCell pdfCell = new PdfPCell(new Phrase(tableCell.Text));
                    pdfPTable.AddCell(pdfCell);
                }

            }

            Document document = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
            PdfWriter.GetInstance(document, Response.OutputStream);
            //PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("test.pdf", FileMode.Create));

            Paragraph nationalID = new Paragraph(voterIDLabel.Text + " : " + voterIDTextBox.Text);
            Paragraph name = new Paragraph("Name : " + nameTextBox.Text);
            //Paragraph centerName = new Paragraph(newCenter.Name);
            Paragraph address = new Paragraph("Address : " + addressTextBox.Text);
            Paragraph age = new Paragraph("Age : " + ageTextBox.Text);
            Paragraph dates = new Paragraph("Date : " + dateCalender.SelectedDate.ToString());
            Paragraph doctor = new Paragraph("Doctor : " + doctorDropDownList.SelectedItem.ToString());
            Paragraph service = new Paragraph("Service Given : " + servicegivenTextBox.Text + " times.\n\n\n\n\n");
            Paragraph observation = new Paragraph("Observation : " + observationTextBox.Text);

            document.Open();
            document.Add(nationalID);
            document.Add(name);
            document.Add(address);
            //document.Add(centerName);
            document.Add(dates);
            document.Add(doctor);
            document.Add(observation);

            document.Add(age);
            document.Add(service);

            document.Add(pdfPTable);
            document.Close();

            Response.ContentType = "Application";
            Response.AppendHeader("content-disposition", "attachment;filename=PatientInfo.pdf");
            Response.Write(document);
            Response.Flush();
            Response.End();
            document.Close();

            treatmentList.RemoveAll(t => t.VoterID.Equals(voterIDTextBox.Text));

            Response.Redirect(Request.Path);
            Response.Redirect(Request.RawUrl);
            Response.Redirect(Request.Url.ToString());
        }
 public int SaveTreatmentGiven(TreatmentGiven aTreatmentGiven)
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "insert into tbl_TreatmentGiven values ('"+aTreatmentGiven.VoterID+"','"+aTreatmentGiven.ServiceGiven+"','"+aTreatmentGiven.Observation+"','"+aTreatmentGiven.Date+"','"+aTreatmentGiven.Doctor+"','"+aTreatmentGiven.Disease+"','"+aTreatmentGiven.Medicine+"','"+aTreatmentGiven.Dose+"','"+aTreatmentGiven.Meal+"','"+aTreatmentGiven.Quantity+"','"+aTreatmentGiven.Note+"','"+aTreatmentGiven.CenterID+"','"+aTreatmentGiven.ThanaID+"','"+aTreatmentGiven.DistrictID+"')";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     return rowAffected;
 }
        protected void saveButton_Click(object sender, EventArgs e)
        {
            string center        = Session["Center"].ToString();
            string thana         = Session["Thana"].ToString();
            string district      = Session["District"].ToString();
            int    result        = 0;
            int    serviceNumber = int.Parse(servicegivenTextBox.Text) + 1;

            foreach (TreatmentGiven givenTreatment in treatmentList)
            {
                TreatmentGiven anotherTreatmentGiven = new TreatmentGiven();

                anotherTreatmentGiven.VoterID      = voterIDTextBox.Text;
                anotherTreatmentGiven.ServiceGiven = serviceNumber;
                anotherTreatmentGiven.Observation  = observationTextBox.Text;
                DateTime date       = dateCalender.SelectedDate;
                string   day        = date.Day.ToString();
                string   month      = date.Month.ToString();
                string   year       = date.Year.ToString();
                string   datetoSave = year + "/" + month + "/" + day;
                anotherTreatmentGiven.Date   = datetoSave;
                anotherTreatmentGiven.Doctor = doctorDropDownList.SelectedItem.ToString();

                anotherTreatmentGiven.Disease    = givenTreatment.Disease;
                anotherTreatmentGiven.Medicine   = givenTreatment.Medicine;
                anotherTreatmentGiven.Dose       = givenTreatment.Dose;
                anotherTreatmentGiven.Meal       = givenTreatment.Meal;
                anotherTreatmentGiven.Quantity   = givenTreatment.Quantity;
                anotherTreatmentGiven.Note       = givenTreatment.Note;
                anotherTreatmentGiven.CenterID   = aTreatmentGivenManager.GetIDByCenter(center);
                anotherTreatmentGiven.ThanaID    = aTreatmentGivenManager.GetIDByThanaName(thana);
                anotherTreatmentGiven.DistrictID = aTreatmentGivenManager.GetIDByDistrictName(district);

                result = aTreatmentGivenManager.SaveTreatmentGiven(anotherTreatmentGiven);
            }

            if (result != 0)
            {
                showLabel.Text = "Treatment saved successfully";
            }
            else
            {
                showLabel.Text = "Treatment not saved.";
            }



            PdfPTable pdfPTable = new PdfPTable(treatmentGridView.HeaderRow.Cells.Count);

            foreach (TableCell headerCell in treatmentGridView.HeaderRow.Cells)
            {
                PdfPCell pdfCell = new PdfPCell(new Phrase(headerCell.Text));
                pdfPTable.AddCell(pdfCell);
            }

            foreach (GridViewRow gridViewRow in treatmentGridView.Rows)
            {
                foreach (TableCell tableCell in gridViewRow.Cells)
                {
                    PdfPCell pdfCell = new PdfPCell(new Phrase(tableCell.Text));
                    pdfPTable.AddCell(pdfCell);
                }
            }

            Document document = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);

            PdfWriter.GetInstance(document, Response.OutputStream);
            //PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream("test.pdf", FileMode.Create));

            Paragraph nationalID = new Paragraph(voterIDLabel.Text + " : " + voterIDTextBox.Text);
            Paragraph name       = new Paragraph("Name : " + nameTextBox.Text);
            //Paragraph centerName = new Paragraph(newCenter.Name);
            Paragraph address     = new Paragraph("Address : " + addressTextBox.Text);
            Paragraph age         = new Paragraph("Age : " + ageTextBox.Text);
            Paragraph dates       = new Paragraph("Date : " + dateCalender.SelectedDate.ToString());
            Paragraph doctor      = new Paragraph("Doctor : " + doctorDropDownList.SelectedItem.ToString());
            Paragraph service     = new Paragraph("Service Given : " + servicegivenTextBox.Text + " times.\n\n\n\n\n");
            Paragraph observation = new Paragraph("Observation : " + observationTextBox.Text);

            document.Open();
            document.Add(nationalID);
            document.Add(name);
            document.Add(address);
            //document.Add(centerName);
            document.Add(dates);
            document.Add(doctor);
            document.Add(observation);


            document.Add(age);
            document.Add(service);



            document.Add(pdfPTable);
            document.Close();

            Response.ContentType = "Application";
            Response.AppendHeader("content-disposition", "attachment;filename=PatientInfo.pdf");
            Response.Write(document);
            Response.Flush();
            Response.End();
            document.Close();


            treatmentList.RemoveAll(t => t.VoterID.Equals(voterIDTextBox.Text));

            Response.Redirect(Request.Path);
            Response.Redirect(Request.RawUrl);
            Response.Redirect(Request.Url.ToString());
        }
예제 #13
0
 public int SaveTreatmentGiven(TreatmentGiven aTreatmentGiven)
 {
     return(aTreatmentGivenGateway.SaveTreatmentGiven(aTreatmentGiven));
 }