protected void Button1_Click(object sender, EventArgs e)
        {
            string str = TextBox1.Text;

            Label1.Text = ("Result");
            Label2.Text = ("You have Entered");
            Label5.Text = (":");
            Label8.Text = str.ToString();
            string str1 = str.Replace(" ", "").Replace("`", "").Replace("~", "").Replace("!", "")
                          .Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "")
                          .Replace("&", "").Replace("*", "").Replace("(", "").Replace(")", "").Replace("-", "")
                          .Replace("_", "").Replace("=", "").Replace("+", "").Replace("{", "").Replace("}", "")
                          .Replace("|", "").Replace("[", "").Replace("]", "").Replace(":", "").Replace(";", "")
                          .Replace("'", "").Replace(",", "").Replace(".", "").Replace("/", "").Replace("?", "")
                          .Replace(">", "").Replace("<", "").Replace("1", "").Replace("2", "").Replace("3", "")
                          .Replace("4", "").Replace("5", "").Replace("6", "").Replace("7", "").Replace("8", "")
                          .Replace("9", "").Replace("0", "");
            string str2 = str1.ToUpper();
            string str3 = str2.Replace("A", "1").Replace("B", "2").Replace("C", "3").Replace("D", "4").Replace("E", "5").Replace("F", "8")
                          .Replace("G", "3").Replace("H", "5").Replace("I", "1").Replace("J", "1").Replace("K", "2").Replace("L", "3")
                          .Replace("M", "4").Replace("N", "5").Replace("O", "7").Replace("P", "8").Replace("Q", "1").Replace("R", "2")
                          .Replace("S", "3").Replace("T", "4").Replace("U", "6").Replace("V", "6").Replace("W", "6").Replace("X", "5")
                          .Replace("Y", "1").Replace("Z", "7");
            string word1 = str3.ToString();
            string a     = word1.Select(c => c - '0').Sum().ToString();

            Label3.Text = ("Sum Of Charecters");
            Label6.Text = (":");
            Label9.Text = a.ToString();
            string w = Label9.ToString();
            string s = w.ToString();
            string b = a.Select(c => c - '0').Sum().ToString();

            for (int i = 0; i < b.Length; i++)
            {
                string p = b.Select(c => c - '0').Sum().ToString();
                Label10.Text = p.ToString();
            }
            Label4.Text = ("Summed Value");
            Label7.Text = (":");
        }
예제 #2
0
        protected void patientSaveButton_Click(object sender, EventArgs e)
        {
            DateTime localDate   = DateTime.Now;
            var      dateAndTime = DateTime.Now;
            var      date        = dateAndTime.Date;


            aPatient.PatientName = patientNameTextBox.Text;
            aPatient.DateofBirth = dateOfBirthTextBox.Text;
            aPatient.MobileNo    = mobileNoTextBox.Text;
            aPatient.BillNo      = "Bill No-" + localDate.ToString("yyMMddHHmmss");
            aPatient.TotalFee    = Convert.ToDouble(totalFeeTextBox.Text);
            aPatient.DateofIssue = date.ToString("yyyy-MM-dd");
            aPatient.Status      = "N";



            patientAddButton.Enabled  = false;
            patientSaveButton.Enabled = false;

            timeLabel.Text = aPatientManager.SavePatient(aPatient);

            aPatient.PatientId = aPatientManager.GetPatientId(aPatient.BillNo);

            List <Patient> myPatient1 = (List <Patient>)ViewState["List"];

            timeLabel.Text = aPatientManager.InsertTestRequest(myPatient1, aPatient.PatientId);



            //pdf
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter   swr    = new StringWriter();
            HtmlTextWriter htmlwr = new HtmlTextWriter(swr);

            patientGridView.AllowPaging = false;
            List <Patient> myPatient = GetGridViewListForPatient1();

            patientGridView.DataSource = myPatient;
            patientGridView.DataBind();



            Label10.Text = " " + aPatient.BillNo + "";
            Label7.Text  = "NAME : " + patientNameTextBox.Text + "------";
            Label8.Text  = "Date of Birth : " + dateOfBirthTextBox.Text + "------";
            Label9.Text  = "Mobile Number : " + mobileNoTextBox.Text + "";

            Label11.Text = "_______________________________________________________________________________";
            Label12.Text = " ...................................................................................................Total Fee :" + totalFeeTextBox.Text + "";
            Label13.Text = "Issued Date: " + aPatient.DateofIssue + "........................................................................................\n";


            Label13.RenderControl(htmlwr);
            Label10.RenderControl(htmlwr);
            Label7.RenderControl(htmlwr);
            Label8.RenderControl(htmlwr);
            Label9.RenderControl(htmlwr);


            //ShowGridViewForPatient();
            //timeLabel.RenderControl(htmlwr);

            patientGridView.RenderControl(htmlwr);
            Label11.RenderControl(htmlwr);
            Label12.RenderControl(htmlwr);

            patientSaveButton.Enabled = false;

            StringReader srr = new StringReader(swr.ToString());

            Document   pdfdoc     = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfdoc);

            PdfWriter.GetInstance(pdfdoc, Response.OutputStream);
            pdfdoc.Open();
            htmlparser.Parse(srr);
            pdfdoc.Close();
            Response.Write(pdfdoc);
            Response.End();
        }