Esempio n. 1
0
        public static int Insert(PrescriptionSession prescriptionSession)
        {
            object o = DataManager.ExecuteScalar("ESystem_PrescriptionSessionInsert",
                                                 DataManager.CreateParameter("@prescId", SqlDbType.Int, prescriptionSession.PrescriptionId),
                                                 DataManager.CreateParameter("@sessionName", SqlDbType.NVarChar, prescriptionSession.SessionName),
                                                 DataManager.CreateParameter("@number", SqlDbType.Int, prescriptionSession.Number),
                                                 DataManager.CreateParameter("@comment", SqlDbType.NVarChar, prescriptionSession.Comment));

            return(Convert.ToInt32(o));
        }
Esempio n. 2
0
        private static PrescriptionSession FillDataRecord(IDataRecord myDataRecord)
        {
            PrescriptionSession prescriptionSession = new PrescriptionSession();

            prescriptionSession.PrescSessionId = myDataRecord.GetInt32(myDataRecord.GetOrdinal("PrescSessionId"));
            prescriptionSession.PrescriptionId = myDataRecord.GetInt32(myDataRecord.GetOrdinal("PrescriptionId"));
            prescriptionSession.SessionName    = myDataRecord.GetString(myDataRecord.GetOrdinal("SessionName"));

            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("Number")))
            {
                prescriptionSession.Number = myDataRecord.GetInt32(myDataRecord.GetOrdinal("Number"));
            }

            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("Comment")))
            {
                prescriptionSession.Comment = myDataRecord.GetString(myDataRecord.GetOrdinal("Comment"));
            }


            return(prescriptionSession);
        }
Esempio n. 3
0
        public static PrescriptionSession GetByPrescId(int id)
        {
            PrescriptionSession prescriptionSession = null;
            SqlConnection       con;

            using (SqlDataReader dr = DataManager.GetDataReader("ESystem_PrescriptionSessionSellectByPresc", out con,
                                                                DataManager.CreateParameter("@prescId", SqlDbType.Int, id)))
            {
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        prescriptionSession = FillDataRecord(dr);
                    }
                }
                else
                {
                    throw new Exception("No Data");
                }

                con.Close();
            }
            return(prescriptionSession);
        }
Esempio n. 4
0
    protected void btnUpdate_OnClick(object sender, EventArgs e)
    {
        using (TransactionScope trans = new TransactionScope())
        {
            #region Prescription

            //Objects Init
            Prescription        prsc        = PrescriptionBLL.GetByCase(id);
            PrescriptionSession prscSession = new PrescriptionSession();
            PrescriptionCD      prscCD      = new PrescriptionCD();
            PrescriptionCourses prscCourses = new PrescriptionCourses();

            //Lists for Delete purpose.
            List <PrescriptionSession> _prscSession = PrescriptionSessionBLL.GetListByPrescription(prsc.PrescriptionId);
            List <PrescriptionCourses> _prscCourse  = PrescriptionCoursesBLL.GetListByPrescription(prsc.PrescriptionId);
            List <PrescriptionCD>      _prscCd      = PrescriptionCdBLL.GetListByPrescription(prsc.PrescriptionId);


            #region Prescription Update

            prsc.CaseId = id;
            prsc.Report = txtFinalReport.Text;
            prsc.Status = PrescriptionStatus.revised;
            //Init prsc.ConfirmedComment
            prsc.ConfermedComment = txtComment.Text;
            Thread.Sleep(150);
            int prescriptionId = PrescriptionBLL.UpdateByCase(prsc);

            #endregion

            //Prescription CD

            #region Prescription CD
            foreach (PrescriptionCD item in _prscCd)
            {
                PrescriptionCdBLL.Delete(item);
            }

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

            #endregion

            //Prescription Courses lest

            #region Prescription Courses lest
            foreach (PrescriptionCourses item in _prscCourse)
            {
                PrescriptionCoursesBLL.Delete(item);
            }

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

            #endregion

            //Prescription Sessions

            #region Prescription Sessions

            foreach (PrescriptionSession item in _prscSession)
            {
                PrescriptionSessionBLL.Delete(item);
            }


            foreach (RepeaterItem sessionItem in repeatSessions.Items)
            {
                prscSession.PrescriptionId = prescription.PrescriptionId;

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

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


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

            #endregion


            #endregion
            trans.Complete();
            //session fore firing the jquery notify
            string message = "The case has been revised successfully";
            Response.Redirect("/Cases/view.aspx?message=" + message, false);
        }
    }
Esempio n. 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);
        }
    }
Esempio n. 6
0
 public static bool Delete(PrescriptionSession prescSession)
 {
     return(PrescriptionSessionDAL.Delete(prescSession.PrescSessionId));
 }
Esempio n. 7
0
 public static int UpdateByPresc(PrescriptionSession prescSession)
 {
     prescSession.PrescriptionId = PrescriptionSessionDAL.UpdateByPresc(prescSession);
     return(prescSession.PrescriptionId);
 }
Esempio n. 8
0
 public static int Insert(PrescriptionSession prescSession)
 {
     prescSession.PrescSessionId = PrescriptionSessionDAL.Insert(prescSession);
     return(prescSession.PrescriptionId);
 }