Example #1
0
    void BindGrid()
    {
        try
        {
            List <ClientCase> ds           = ClientCaseBLL.GetListView();
            List <ClientCase> _clientCases = new List <ClientCase>();

            ////Filtration
            //for (int i = 0; i < ds.Count; i++)
            //{
            //    if (ds[i].PrescriptionStatus == state)
            //    {
            //        _clientCases.Add(ds[i]);
            //    }

            //}
            grd.DataSource = ds;
            grd.DataBind();
        }
        catch (Exception ex)
        {
            grd.EmptyDataText = ex.Message;
            grd.DataBind();
        }
    }
Example #2
0
 private void BindGrid()
 {
     try
     {
         //Client Grid
         ClientCase        _clientCase = ClientCaseBLL.GetItem(id);
         List <ClientCase> list        = new List <ClientCase>();
         list.Add(_clientCase);
         grd.DataSource = list;
         grd.DataBind();
     }
     catch (Exception ex)
     {
         grd.EmptyDataText = ex.Message;
         grd.DataBind();
     }
 }
Example #3
0
    private void BindGrid()
    {
        try
        {
            //Client Grid
            ClientCase        _clientCase = ClientCaseBLL.GetItem(id);
            List <ClientCase> list        = new List <ClientCase>();
            list.Add(_clientCase);
            grd.DataSource = list;
            grd.DataBind();

            //CD Grid
            Prescription presc = PrescriptionBLL.GetByCase(id);


            grdCd.DataSource = presc.PrescriptionCds;
            grdCd.DataBind();
            //Course Grid
            grdCourses.DataSource = presc.PrescriptionCourseses;
            grdCourses.DataBind();;
            //Sessions Grid
            grdSessions.DataSource = presc.PrescriptionSessions;
            grdSessions.DataBind();;
            //Report Bind
            txtFinalReport.Text = presc.Report;
            if (presc.Status == PrescriptionStatus.revised)
            {
                pnlRevised.Visible = true;
                txtComment.Text    = presc.ConfermedComment;
            }
        }
        catch (Exception ex)
        {
            grd.EmptyDataText = ex.Message;
            grd.DataBind();
        }
    }
Example #4
0
    void BindGrid()
    {
        try
        {
            List <ClientCase> ds           = ClientCaseBLL.GetListView();
            List <ClientCase> _clientCases = new List <ClientCase>();

            //Filtration
            for (int i = 0; i < ds.Count; i++)
            {
                if (ds[i].PrescriptionStatus != PrescriptionStatus.onhold)
                {
                    _clientCases.Add(ds[i]);
                }
            }
            grd.DataSource = _clientCases;
            grd.DataBind();
        }
        catch (Exception ex)
        {
            grd.EmptyDataText = ex.Message;
            grd.DataBind();
        }
    }
Example #5
0
    protected void btnSendToConfirm_OnClick(object sender, EventArgs e)
    {
        try
        {
            using (TransactionScope trans = new TransactionScope())
            {
                #region Objects

                //Client Object
                Client client = new Client();

                //Case object
                ClientCase clientCase = new ClientCase();

                //Session ibject
                Sessions        casesession      = new Sessions();
                SessionQuestion sessionQuestions = new SessionQuestion();

                //Prescription Object
                Prescription prsc = new Prescription();

                PrescriptionSession prescSession = new PrescriptionSession();
                PrescriptionCourses prscCourse   = new PrescriptionCourses();
                PrescriptionCD      prscCd       = new PrescriptionCD();

                #endregion

                #region CLient and relation data

                //Load the data into the object
                client.FirstName    = txtFName.Text;
                client.MiddleName   = txtMiddleName.Text;
                client.SurrName     = txtSurrName.Text;
                client.CreationDate = DateTime.Now;
                client.CreatedBy    = userName;
                client.IsActive     = IsActive.Active;
                client.Notes        = txtNotes.Text;
                //ClientDetail
                client.CLientId    = client.CLientId;
                client.City        = txtCity.Text;
                client.Country     = drpCountry.Text;
                client.Address     = txtAdress.Text;
                client.Telephone   = txtTelephone.Text;
                client.Mob         = txtMob.Text;
                client.DateOfBirth = Convert.ToDateTime(txtDateOf.Text);
                client.Gender      = drpGender.Text;
                if (HasArelation())
                {
                    client.HasArelation = HasRelations.yes;
                }
                else
                {
                    client.HasArelation = HasRelations.no;
                }
                client.CLientId = ClientBLL.Insert(client);
                Thread.Sleep(150);

                #region Relation Data

                if (HasArelation())
                {
                    Relatives relative = new Relatives();
                    relative.ClientId     = client.CLientId;
                    relative.CLientRelId  = Convert.ToInt32(drpClients.SelectedItem.Value);
                    relative.RelationName = txtRelName.Text;
                    Thread.Sleep(150);
                    RelativesBLL.Insert(relative);
                }

                #endregion

                #endregion


                #region Client case

                clientCase.ClientId   = client.CLientId;
                clientCase.CaseNumber = txtCaseNumber.Text;
                clientCase.CaseStatus = CaseStatus.opened;
                clientCase.dateTime   = DateTime.Now;
                Thread.Sleep(150);
                clientCase.CaseId = ClientCaseBLL.Insert(clientCase);

                #endregion

                #region Questions and answers

                //Session Insertion
                casesession.CaseId = clientCase.CaseId;
                casesession.Report = txtReport.Text;
                casesession.Notes  = string.Empty;

                //Session Questions Insertion
                Thread.Sleep(150);
                int sessionId = SessionBLL.Insert(casesession);
                foreach (RepeaterItem item in questionRepeater.Items)
                {
                    sessionQuestions.SessionId = sessionId;
                    Label lblQuestion = (Label)item.FindControl("lblQuestion");
                    sessionQuestions.Question = lblQuestion.Text;

                    TextBox txtAns = (TextBox)item.FindControl("txtAns");
                    sessionQuestions.Answer = "";
                    sessionQuestions.Answer = txtAns.Text;
                    if (txtAns != null)
                    {
                        SessionQuestionBLL.Insert(sessionQuestions);
                    }
                }

                #endregion

                #region Prescription

                #region Prescription Insertion

                prsc.CaseId = clientCase.CaseId;
                prsc.Report = txtFinalReport.Text;
                prsc.Status = PrescriptionStatus.onhold;
                //Init prsc.ConfirmedComment
                prsc.ConfermedComment = string.Empty;
                Thread.Sleep(150);
                int prescriptionId = PrescriptionBLL.Insert(prsc);

                #endregion

                //Prescription CD

                #region Prescription CD

                foreach (ListItem cdItem in lstCD.Items)
                {
                    if (cdItem.Selected)
                    {
                        prscCd.PrescriptionId = prescriptionId;
                        prscCd.CdName         = cdItem.Text;
                        prscCd.Note           = string.Empty;
                        PrescriptionCdBLL.Insert(prscCd);
                    }
                }

                #endregion

                //Prescription Coursesls

                #region Prescription Courseslst

                foreach (ListItem courseItem in lstCourses.Items)
                {
                    if (courseItem.Selected)
                    {
                        prscCourse.PrescriptionId = prescriptionId;
                        prscCourse.CourseName     = courseItem.Text;
                        prscCourse.Notes          = string.Empty;
                        PrescriptionCoursesBLL.Insert(prscCourse);
                    }
                }

                #endregion

                //Prescription Sessions

                #region Prescription Sessions

                foreach (RepeaterItem sessionItem in repeatSessions.Items)
                {
                    prescSession.PrescriptionId = prescriptionId;

                    CheckBox chkSession = (CheckBox)sessionItem.FindControl("chkCourse");

                    if (chkSession.Checked)
                    {
                        //Session Name
                        TextBox txtSessionName = (TextBox)sessionItem.FindControl("txtSessionName");
                        prescSession.SessionName = "";
                        prescSession.SessionName = txtSessionName.Text;
                        //Session Counter
                        TextBox txtCounter = (TextBox)sessionItem.FindControl("txtCounter");
                        prescSession.Number = Convert.ToInt32(txtCounter.Text);


                        TextBox txtComment = (TextBox)sessionItem.FindControl("txtComment");
                        prescSession.Comment = "";
                        prescSession.Comment = txtComment.Text;
                        PrescriptionSessionBLL.Insert(prescSession);
                    }
                }

                #endregion


                #endregion

                trans.Complete();
                //session fore firing the jquery notify
                string message = "CLient has been saved and waiting to be revised";
                Response.Redirect("/Clients/Clients.aspx?message=" + message, false);
            }
        }


        catch (Exception ex)
        {
            string message = ex.Message;
            Response.Redirect("/Clients/Clients.aspx?message=" + message, false);
        }
    }