public IGeneratorFactory FactoryClass(RecieptType type)
        {
            switch (type)
            {
            case RecieptType.Html:
                return(new HtmlRecieptGenerator());

            case RecieptType.Json:
                return(new JsonRecieptGenerator());

            default:
                throw new System.Exception("The type of reciept is not supported");
            }
        }
示例#2
0
        private void showReciept(RecieptType receipttype = RecieptType.COMPLETE)
        {
            textBox1.Text   = "";
            labelstaff.Text = Session.Username;
            labeldate.Text  = DateTime.Now.ToString("dd MMM yyyy / hh:mm tt");

            using (SqlConnection conn = new SqlConnection(Klinik3.Properties.Settings.Default.klinikConnectionString))
            {
                DataSet        dataset = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = new SqlCommand("calcCharge", conn);
                adapter.SelectCommand.Parameters.AddWithValue("@qid", qid);
                adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
                adapter.Fill(dataset);

                textBox1.AppendText("\t" + Klinik3.Properties.Resources.klinikname +
                                    "\r\n" + "\t" + Klinik3.Properties.Resources.klinikaddress.Replace("\\r\\n", "\r\n\t") + "\r\n");

                textBox1.AppendText(DataTableToString(dataset.Tables[0]));
                comboBoxpaymentty.Text = dataset.Tables[0].Rows[5].ItemArray[1].ToString();

                if (receipttype == RecieptType.COMPLETE)
                {
                    textBox1.AppendText(DataTableToString(dataset.Tables[1]));
                    textBox1.AppendText(DataTableToString(dataset.Tables[2]));
                }
                textBox1.AppendText(DataTableToString(dataset.Tables[3]));
                textBox1.AppendText(DataTableToString(dataset.Tables[4]));

                textBox1.AppendText(DataTableToString(dataset.Tables[5]));
                textBox1.AppendText(DataTableToString(dataset.Tables[6]));


                var     ttl = dataset.Tables[6];
                decimal val;
                if (decimal.TryParse(ttl.Rows[0].ItemArray[1].ToString(), out val))
                {
                    numericUpDownChg.Value = val;
                }
            }
        }