protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            Interventions interventions = new Interventions();
            Domain domain = new Domain();
            int DomainIOD = domain.GetDomainOIDByDomainName(DropDownListDomain.SelectedItem.ToString());
            interventions.DomainOID = DomainIOD;

          //int  strInterventionOID = interventions.GetInterventionOIDByInterventionName(DropDownListIntervention .SelectedItem .ToString ());
            interventions.InterventionName = txtIntervention .Text;
            if (DomainIOD != null && txtIntervention.Text != null&&txtIntervention.Text !="")
            {
                interventions.AddDomainInterventions();
                Label1.Text = "Successfuly Saved";
            }
            else
            {
                Label1.Text = "Not Saved";
            }
        }

        catch (Exception ex)
        {

        }
    }
Example #2
0
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if((string.IsNullOrEmpty(TextBoxLatestAction.Value)) || (string.IsNullOrEmpty(TextBoxLatestContact.Value)))
            {
                LabelStatus.Text = "Please Enter Action and Contact Date";
                return;
            }

            int studentid = 0;
            bool isNew = false;
            int roid = Convert.ToInt32(ViewState["riskOID"].ToString());
            RiskCalculation rcal = new RiskCalculation();
            Interventions interventions = new Interventions();
            interventions = interventions.GetInterventionByRiskOID(roid);
            rcal = rcal.GetAssessmentOIDByRiskOID(roid);

            if (interventions == null)
            {
                isNew = true;
                interventions = new Interventions();
            }
            int aoid = rcal.AssessmentOID;
            interventions.AssessmentOID = aoid;
            int strInterventionOID = interventions.GetInterventionOIDByInterventionName(DropDownListIntervention.SelectedItem.ToString());
            interventions.InterventionOID = strInterventionOID;
            Domain domain = new Domain();
            int DomainIOD = domain.GetDomainOIDByDomainName(DropDownListDomain.SelectedItem.ToString());
            interventions.DomainOID = DomainIOD;
            User user = new User();
            int UserIOD = user.GetUserOIDByUserName(DropDownListAdvocate.SelectedItem.ToString());
            //int UserIOD = 1;
            interventions.UserOID = UserIOD;
            interventions.RiskOID = roid;
            //Student student = new Student();
            //int StudentOID = student.GetStudentOIDByStudentBannerID(studentid);
            interventions.StudentOID = studentid;
            interventions.LatestActionDate = TextBoxLatestAction.Value.ToString();
            interventions.LatestContact = TextBoxLatestContact.Value.ToString();

            interventions.CreatedBy = (Session["CurrentUser"] != null) ? ((User)Session["CurrentUser"]).UserOID : 0;

            if (CheckBoxListLeft.Items[0].Selected)
            {
                interventions.Urgent = 1;

            }
            else
            {
                interventions.Urgent = 0;
            }
            if (CheckBoxListLeft.Items[1].Selected)
            {
                interventions.Internal = 1;
            }
            else
            {
                interventions.Internal = 0;
            }

            if (CheckBoxListLeft.Items[2].Selected)
            {
                interventions.Prescribed = 1;
            }
            else
            {
                interventions.Prescribed = 0;
            }

            if (CheckBoxListLeft.Items[3].Selected)
            {
                interventions.Participating = 1;
            }
            else
            {
                interventions.Participating = 0;
            }
            if (CheckBoxListLeft.Items[4].Selected)
            {
                interventions.Completed = 1;
            }
            else
            {
                interventions.Completed = 0;
            }

            if (CheckBoxListRight.Items[0].Selected)
            {
                interventions.Email = 1;
            }
            else
            {
                interventions.Email = 0;
            }
            if (CheckBoxListRight.Items[1].Selected)
            {
                interventions.Telephone = 1;
            }
            else
            {
                interventions.Telephone = 0;
            }
            if (CheckBoxListRight.Items[2].Selected)
            {
                interventions.InPerson = 1;
            }
            else
            {
                interventions.InPerson = 0;
            }
            if (CheckBoxListRight.Items[3].Selected)
            {
                interventions.HandOff = 1;
            }
            else
            {
                interventions.HandOff = 0;
            }
            if (CheckBoxTesting.Checked == true)
            {
                interventions.Testing = 1;
            }
            else
            {
                interventions.Testing = 0;
            }
            interventions.Comment = TextBoxContactNotes.Text.Trim();
            if (isNew)
            {
                if (interventions.AddInterventions() > 0)
                {
                    LabelStatus.Text = "Saved Successfully.";
                }
                else
                {
                    LabelStatus.Text = "Save Failed.";
                }
            }
            else
            {
                if (interventions.UpdateInterventions())
                {
                    LabelStatus.Text = "Update Successfully.";
                }
                else
                {
                    LabelStatus.Text = "Update Failed.";
                }
            }

        }

        catch (Exception ex)
        {
            LabelStatus.Text = "Not Saved";
        }
    }
Example #3
0
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        try
        {

            if ((string.IsNullOrEmpty(TextBoxLatestAction.Value)) || (string.IsNullOrEmpty(TextBoxLatestContact.Value)))
            {
                LabelStatus.Text = "Please Enter Action and Contact Date";
                return;
            }

            Interventions interventions = new Interventions();

            //Changed by Babul 20111103
          //int  strInterventionOID = interventions.GetInterventionOIDByInterventionName(DropDownListIntervention.SelectedItem.ToString());
            int strInterventionOID = 0;
            if (DropDownListIntervention.SelectedIndex == -1)
            {
                strInterventionOID = 1;
            }
            else
            {
                strInterventionOID = interventions.GetInterventionOIDByInterventionName(DropDownListIntervention.SelectedItem.ToString());
            }
            //

           interventions.InterventionOID = strInterventionOID;
           Domain domain=new Domain ();
           int DomainIOD = domain.GetDomainOIDByDomainName(DropDownListDomain.SelectedItem.ToString());
           interventions.DomainOID = DomainIOD;
           User user = new User();
           int UserIOD = user.GetUserOIDByUserName(DropDownListAdvocate.SelectedItem.ToString());
           interventions.UserOID = UserIOD;

           if (ViewState["POID"] == null)
           {
               studentid = Session["StudentID"].ToString();
               Student student = new Student();
               int StudentOID = student.GetStudentOIDByStudentBannerID(studentid);
               interventions.StudentOID = StudentOID;
               ViewState["studentID"]=studentid;
           }
           else
           {
               interventions.StudentOID = Convert.ToInt32(ViewState["studentID"]);
           }
           //interventions.LatestActionDate = TextBoxLatestAction.Text.ToString();
           //interventions.LatestContact = TextBoxLatestContact.Text.ToString();
           interventions.LatestActionDate = TextBoxLatestAction.Value.ToString();
           interventions.LatestContact = TextBoxLatestContact.Value.ToString();
           interventions.CreatedBy = (Session["CurrentUser"] != null) ? ((User)Session["CurrentUser"]).UserOID : 0;
           if (CheckBoxListLeft.Items[0].Selected)
           {
               interventions.Urgent = 1;

           }
           else
           {
               interventions.Urgent = 0;
           }
           if (CheckBoxListLeft.Items[1].Selected)
           {
               interventions.Internal = 1;
           }
           else
           {
               interventions.Internal = 0;
           }

           if (CheckBoxListLeft.Items[2].Selected)
           {
               interventions.Prescribed = 1;
           }
           else
           {
               interventions.Prescribed = 0;
           }

           if (CheckBoxListLeft.Items[3].Selected)
           {
               interventions.Participating = 1;
           }
           else
           {
               interventions.Participating = 0;
           }
           if (CheckBoxListLeft.Items[4].Selected)
           {
               interventions.Completed = 1;
           }
           else
           {
               interventions.Completed = 0;
           }

           if (CheckBoxListRight.Items[0].Selected)
           {
               interventions.Email = 1;
           }
           else
           {
               interventions.Email = 0;
           }
           if (CheckBoxListRight.Items[1].Selected)
           {
               interventions.Telephone = 1;
           }
           else
           {
               interventions.Telephone = 0;
           }
           if (CheckBoxListRight.Items[2].Selected)
           {
               interventions.InPerson = 1;
           }
           else
           {
               interventions.InPerson = 0;
           }
           if (CheckBoxListRight.Items[3].Selected)
           {
               interventions.HandOff = 1;
           }
           else
           {
               interventions.HandOff = 0;
           }
           if (CheckBoxTesting.Checked == true)
           {
               interventions.Testing = 1;
           }
           else
           {
               interventions.Testing = 0;
           }
           interventions.Comment = TextBoxContactNotes.Text.Trim();
           interventions.RiskOID = 0;
           Assessment assment=new Assessment ();
           interventions.AssessmentOID = assment.GetAssessmentOIDByAssessmentName(ddlAssessment.SelectedItem.Text);
           if (ViewState["POID"] == null)
           {
               if (interventions.AddInterventions() > 0)
               {
                   LabelStatus.Text = "Saved Successfully.";
               }
               else
               {
                   LabelStatus.Text = "Save Failed.";
               }
               ViewState["POID"] = interventions.PrescriptionOID;

           }
           else
           {
               interventions.PrescriptionOID=Convert.ToInt32(ViewState["POID"].ToString());
               if (interventions.UpdateInterventions())
               {
                   LabelStatus.Text = "Update Successfully.";
               }
               else
               {
                   LabelStatus.Text = "Update Failed.";
               }
           }

            //Sending Email For Hand Off
           try
           {
               if (interventions.HandOff == 1)
               {
                   string toEmail = null;
                   if (ConfigurationManager.AppSettings["productionMode"].ToString() == "OFF")
                   {
                       toEmail = ConfigurationManager.AppSettings["toEmail"].ToString();
                   }
                   else
                   {

                       //Get Student Email Address By ID
                       studentid = Session["StudentID"].ToString();
                       Student stu = new Student();
                       stu = stu.GetStudentByStudentOID(studentid);
                       if (stu != null)
                       {
                           if (stu.EmailAddress != null)
                           {
                               toEmail = stu.EmailAddress;
                           }

                       }

                       //toEmail = ConfigurationManager.AppSettings["toEmail"].ToString();
                   }

                   #region Handoff Body
                   string  html = null ;
                   html += "<table style='width: 100%; '>";
                   html += "<tr><td colspan='4'> <h3>Handoff Details of " + DropDownListIntervention.SelectedItem.ToString() + " Intervention</h3></td></tr>";
                   html += "<tr><td >&nbsp;</td><td style='background-color:#727272;width:100px;'> Assessment</td><td>" + ddlAssessment.Text + "</td><td></td></tr>";
                   html += "<tr><td >&nbsp;</td><td style='background-color:#727272;width:100px;'> Domain</td><td>" + DropDownListDomain.SelectedItem.ToString() + "</td><td></td></tr>";
                   html += "<tr><td >&nbsp;</td><td style='background-color:#727272;width:100px;'> Intervention</td><td>" + DropDownListIntervention.SelectedItem.ToString() + "</td><td></td></tr>";
                   html += "<tr><td >&nbsp;</td><td > &nbsp;</td><td style='background-color:#727272; width:150px;'>User Name  </td><td>" + DropDownListAdvocate.SelectedItem.ToString() + "</td></tr>";
                   html += "<tr><td >&nbsp;</td><td > &nbsp;</td><td style='background-color:#727272; width:100px;'>Action Date </td><td>" + TextBoxLatestAction.Value.ToString();
                   html += "&nbsp;&nbsp;Prescribed&nbsp;";
                   if (interventions.Prescribed == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "&nbsp;Participating&nbsp;";
                   if (interventions.Participating == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "&nbsp;Internal&nbsp;";
                   if (interventions.Internal == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "&nbsp;Urgent&nbsp;";
                   if (interventions.Urgent == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "&nbsp;Completed&nbsp;";
                   if (interventions.Completed == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "</td></tr>";
                   html += "<tr><td >&nbsp;</td><td > &nbsp;</td><td style='background-color:#727272; width:100px;'>Contact Date </td><td>" + TextBoxLatestContact.Value.ToString();
                   html += "&nbsp;&nbsp;Email&nbsp;";
                   if (interventions.Email == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }
                   html += "&nbsp;&nbsp;Telephone&nbsp;";
                   if (interventions.Telephone == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }
                   html += "&nbsp;&nbsp;In Person&nbsp;";
                   if (interventions.InPerson == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }
                   html += "&nbsp;&nbsp;Hand-Off&nbsp;";
                   if (interventions.HandOff == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }
                   html += "&nbsp;&nbsp;Testing&nbsp;";
                   if (interventions.Testing == 1)
                   {
                       html += "<img alt='yes' src='../../images/tic-pic.png' />";
                   }
                   else
                   {
                       html += "<img alt='no' src='../../images/nonetic-pic.png' />";
                   }

                   html += "</td></tr>";
                   html += "<tr><td >&nbsp;</td><td > &nbsp;</td><td style='background-color:#727272; width:100px;'>Comments: </td><td>" + TextBoxContactNotes.Text;
                   html += "</table>";
                   #endregion

                   if (SendMail(toEmail, "You have got a Handoff", html))
                   {
                       LabelStatus.Text = "Eamil  Sent  .. Successfully";
                   }
                   else
                   {
                       LabelStatus.Text = "Eamil Not Sent  .. Please contact with admin ";
                   }
               }
           }
           catch (Exception ae)
           {
               LabelStatus.Text = "Eamil Not Sent  .. Please contact with admin ";
           }
            //End Sending Mail For Hand Off
        }

        catch (Exception ex)
        {

        }
    }