Esempio n. 1
0
        public static ClientCase GetByClient(int clientId)
        {
            ClientCase    clntCase = null;
            SqlConnection con;

            using (SqlDataReader dr = DataManager.GetDataReader("ESystem_ClientCaseGetByClient", out con,
                                                                DataManager.CreateParameter("@ClientId", SqlDbType.Int, clientId)))
            {
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        clntCase = FillDataRecord(dr);
                    }
                }


                else
                {
                    throw new Exception("No Data");
                }
                con.Close();
            }
            return(clntCase);
        }
Esempio n. 2
0
        public static int Insert(ClientCase clntCase)
        {
            object o = DataManager.ExecuteScalar("ESystem_ClientCaseInsert",
                                                 DataManager.CreateParameter("@ClientId", SqlDbType.Int, clntCase.ClientId),
                                                 DataManager.CreateParameter("@CaseNumber", SqlDbType.NVarChar, clntCase.CaseNumber),
                                                 DataManager.CreateParameter("@CaseStatus", SqlDbType.Int, clntCase.CaseStatus),
                                                 DataManager.CreateParameter("@dateTime", SqlDbType.DateTime, clntCase.dateTime)
                                                 );

            return(Convert.ToInt32(o));
        }
Esempio n. 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();
     }
     catch (Exception ex)
     {
         grd.EmptyDataText = ex.Message;
         grd.DataBind();
     }
 }
Esempio n. 4
0
        public static ClientCase GetItem(int id)
        {
            ClientCase   clientCase = ClientCaseDAL.GetItem(id);
            Client       client     = ClientBLL.GetItem(clientCase.ClientId);
            Prescription presc      = PrescriptionBLL.GetByCase(clientCase.CaseId);

            try
            {
                Relatives rel = RelativesBLL.GetItem(clientCase.ClientId);
                clientCase.ClientRelName = rel.ClientRelName;
            }
            catch (Exception)
            {
            }
            clientCase.FullName           = client.FullName;
            clientCase.Mob                = client.Mob;
            clientCase.Gender             = client.Gender;
            clientCase.PrescriptionStatus = presc.Status;

            //Prescription

            return(clientCase);
        }
Esempio n. 5
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();
        }
    }
Esempio n. 6
0
        private static ClientCase FillDataRecord(IDataRecord myDataRecord)
        {
            ClientCase clientCase = new ClientCase();

            clientCase.CaseId   = myDataRecord.GetInt32(myDataRecord.GetOrdinal("CaseId"));
            clientCase.ClientId = myDataRecord.GetInt32(myDataRecord.GetOrdinal("ClientId"));


            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("CaseNumber")))
            {
                clientCase.CaseNumber = myDataRecord.GetString(myDataRecord.GetOrdinal("CaseNumber"));
            }
            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("CaseStatus")))
            {
                clientCase.CaseStatus = (CaseStatus)myDataRecord.GetInt32(myDataRecord.GetOrdinal("CaseStatus"));
            }
            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("dateTime")))
            {
                clientCase.dateTime = myDataRecord.GetDateTime(myDataRecord.GetOrdinal("dateTime"));
            }


            return(clientCase);
        }
Esempio n. 7
0
 public static int UpdateByCase(ClientCase clientCase)
 {
     clientCase.CaseId = ClientCaseDAL.Update(clientCase);
     return(clientCase.CaseId);
 }
Esempio n. 8
0
 public static int Insert(ClientCase clientCase)
 {
     clientCase.CaseId = ClientCaseDAL.Insert(clientCase);
     return(clientCase.CaseId);
 }
Esempio n. 9
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);
        }
    }