예제 #1
0
        protected void PopulateCorrectiveAction()
        {
            try
            {
                oDV = AdoUDIRS.GetCorrectiveAction();

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count > 0)
                {
                    chkCorrectiveAction.DataSource     = oDV;
                    chkCorrectiveAction.DataValueField = "Id";
                    chkCorrectiveAction.DataTextField  = "Title";
                    chkCorrectiveAction.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #2
0
        private void BindGridview(string refNumber, string incidentStatus, string isAnyPersonInjured, string isTreatmentProvided, string fromDate, string toDate, int personID)
        {
            try
            {
                oDV = AdoUDIRS.GET_InvestigationHistory_Search(refNumber, incidentStatus, isAnyPersonInjured, isTreatmentProvided, fromDate, toDate, personID);

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    lblMsg.Text = "No incident found.";
                    lblMsg.Attributes.Add("style", "font-size:40px; color:Red; font-weight:bold;");
                    gvVDQHistory.DataSource = null;
                    gvVDQHistory.DataBind();
                    return;
                }
                else if (oDV.Count > 0)
                {
                    gvVDQHistory.DataSource = oDV;
                    gvVDQHistory.DataBind();
                    lblMsg.Text = "";
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #3
0
        protected void PopulateTreatmentLocation()
        {
            try
            {
                oDV = AdoUDIRS.GetTreatmentLocation();

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count > 0)
                {
                    rblTreatmentPlace.DataSource     = oDV;
                    rblTreatmentPlace.DataValueField = "Id";
                    rblTreatmentPlace.DataTextField  = "Title";
                    rblTreatmentPlace.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #4
0
        public void BindGridview()
        {
            try
            {
                oDS = AdoUDIRS.GetAllInformation(IncidentID);

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count > 0)
                {
                    gvActionPlan.DataSource = oDS.Tables[3];
                    gvActionPlan.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
            //gvCommentsHistory.DataSource = dt;
            //gvCommentsHistory.DataBind();
        }
예제 #5
0
        protected void PopulateLocation()
        {
            try
            {
                oDV = AdoUDIRS.GetIncidentLocation();

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count > 0)
                {
                    ddlLocation.DataSource     = oDV;
                    ddlLocation.DataValueField = "Id";
                    ddlLocation.DataTextField  = "Longname";
                    ddlLocation.DataBind();
                    ddlLocation.Items.Insert(0, new ListItem("--Select--", "-1"));
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #6
0
        protected void PopulateOthers()
        {
            try
            {
                oDV = AdoUDIRS.GetOthersIncident();

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count > 0)
                {
                    //cbOthers.Text = oDV[0].Row["Title"].ToString();
                    chkOthers.DataSource     = oDV;
                    chkOthers.DataValueField = "Id";
                    chkOthers.DataTextField  = "Title";
                    chkOthers.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string personRoleID = string.Empty;
         if (Request.QueryString["vid"] != null)
         {
             if (Request.QueryString["vid"].ToString() != string.Empty)
             {
                 personRoleID = Cryptography.Decrypt(Request.QueryString["vid"].ToString(), "sblw-3hn8-sqoy19");
                 DataView dv = AdoUDIRS.ActivatePersonRole(personRoleID);
                 if (dv[0]["StatusMsg"] != null)
                 {
                     if (dv[0]["StatusMsg"].ToString() == "UpdatedSuccessfully")
                     {
                         // User activated successfully, Please click here to login.
                     }
                     else
                     {
                         //Failed to activate the user
                     }
                 }
             }
         }
     }
 }
예제 #8
0
        protected void InsertInvestigation()
        {
            //string strIncidentID = "1";
            string strPersonID = string.Empty;

            try
            {
                if (UDIRSHelper.PersonDetails != null)
                {
                    strPersonID = UDIRSHelper.PersonDetails.Id.ToString();
                }
                else
                {
                    //redirect to login
                }
                BuildIncidentInvestigation();
                if (PreviousIncidentStatus == ddlStatus.SelectedValue && txtComments.Text == string.Empty && PreviousIncidentComment != string.Empty)
                {
                    txtComments.Text = PreviousIncidentComment;
                }

                // @PersonID ,      @IncidentID,       @IncidentSubInvestigationCausesIDs,     @OtherInvestigation,  @IncidentStatus,      @Comments)
                oDV = AdoUDIRS.InvestigationData(strPersonID, IncidentID, sbInvestigationSubCategoryIDs.ToString(), txtOthers.Text.Trim(), ddlStatus.SelectedValue, txtComments.Text.Trim());
                // string RefId = oDV.ToTable().Rows[0]["IncidentID"].ToString();
                if (oDV == null)
                {
                    Label lbl = (Label)Page.Master.FindControl("lblMessage");
                    Message.Failure("Failed to save incident data.", lbl); ///// Pass label saleem
                    return;
                }
                else
                {
                    DataTable dt = oDV.ToTable();
                    //RefId = oDV.Table.Rows[0]["IncidentID"].ToString();
                    //Session["IncidentID"] = RefId;
                    Label lbl = (Label)Page.Master.FindControl("lblMessage");

                    //--Response.Redirect("~/Web/ThankYou.aspx", true);
                    //Message.Success("Incident data saved Successfullyssssssssssss", lbl); ///// Pass label saleem
                }
                if (AdoUDIRS.BlnError)
                {
                }
                else if (oDV.Count == 0)
                {
                }
                else if (oDV.Count > 0)
                {
                    //RefId = oDV.ToTable().Rows[0]["IncidentID"].ToString();
                    //Session["PersonID"] = RefId;
                }
            }
            catch (Exception ex)
            {
                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                Message.Failure("Error 221, sorry, an error occured, " + AdoUDIRS.StrError, lbl); ///// Pass label saleem
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #9
0
        private void InsertActionPlan()
        {
            StringBuilder sb   = new StringBuilder();
            string        str  = string.Empty;
            Label         lbl  = null;
            TextBox       txt1 = null;
            TextBox       txt2 = null;
            DropDownList  ddl  = null;

            foreach (GridViewRow row in gvActionPlan.Rows)
            {
                lbl  = (Label)row.Cells[0].FindControl("lblID");
                txt1 = (TextBox)row.Cells[0].FindControl("txtAction");
                txt2 = (TextBox)row.Cells[0].FindControl("txtDeadline");
                ddl  = (DropDownList)row.Cells[0].FindControl("ddlCompleted");
                if (lbl != null && txt1 != null && txt2 != null && ddl != null)
                {
                    if (lbl.Text != string.Empty || txt1.Text != string.Empty || txt2.Text != string.Empty || ddl.SelectedValue != "-1")
                    {
                        sb.Append(lbl.Text + "|$|");
                        sb.Append(txt1.Text + "|$|");
                        sb.Append(txt2.Text + "|$|");
                        sb.Append(ddl.SelectedValue + "|#|");
                    }
                }
            }
            str = sb.ToString();
            if (str.LastIndexOf("|#|") > -1)
            {
                str = str.Substring(0, str.Length - 3);
            }
            if (str != string.Empty)
            {
                oDV = AdoUDIRS.DoActionPlan(IncidentID, str.ToString(), "|#|", "|$|");
            }

            Response.Redirect("~/Web/ThankYou.aspx", true);

            /*
             *
             * using (SqlConnection connection = new SqlConnection(GetConnectionString()))
             * {
             *  connection.Open();
             *  using (SqlCommand cmd = new SqlCommand(sb.ToString(), connection))
             *  {
             *      cmd.CommandType = CommandType.Text;
             *      cmd.ExecuteNonQuery();
             *  }
             * }
             * lblMessage.Text = "Records successfully saved!";
             */
        }
예제 #10
0
        protected void InsertIncident(string fileName)
        {
            try
            {
                BuildNatureIncident();
                BuildCorrectiveAction();
                string strRoleID = string.Empty, strPersonID = string.Empty;
                strRoleID   = UDIRSHelper.PersonRoleDetails.Where(p => p.Shortname == "USE" || p.Shortname == "Other").Select(s => s.RolesID).Single().ToString();
                strPersonID = UDIRSHelper.PersonDetails.Id.ToString();
                String combinedDateTime;
                //string selectedval = HiddenField1.Value;
                combinedDateTime = txtDate.Text + " " + ddlHours.Text + ":" + ddlMinutes.Text;

                oDV = AdoUDIRS.IncidentData(strRoleID, ddlLocation.SelectedValue, rblTreatmentPlace.SelectedValue, combinedDateTime, txtOtherlocation.Text.Trim(), txtIncidentDesc.Text.Trim(), rblInjured.SelectedValue, txtInjuryDesc.Text.Trim(), rblTreatmentProvided.SelectedValue, txtCorrectiveActionDesc.Text.Trim(), txtAdditionalInformationDesc.Text.Trim(), fileName, sbIncidentSubCategoryIDs.ToString(), txtOthers.Text.Trim(), strCorActionIDs, strPersonID, "PE", strHistorycomments);

                if (oDV == null)
                {
                    Label lbl = (Label)Page.Master.FindControl("lblMessage");
                    Message.Failure("Failed to save incident data.", lbl); ///// Pass label saleem
                    return;
                }
                else
                {
                    DataTable dt = oDV.ToTable();
                    //RefId = oDV.Table.Rows[0]["IncidentID"].ToString();
                    //Session["IncidentID"] = RefId;
                    Label lbl = (Label)Page.Master.FindControl("lblMessage");

                    Response.Redirect("~/Web/ThankYou.aspx", true);
                    //Message.Success("Incident data saved Successfullyssssssssssss", lbl); ///// Pass label saleem
                }
                if (AdoUDIRS.BlnError)
                {
                }
                else if (oDV.Count == 0)
                {
                }
                else if (oDV.Count > 0)
                {
                    //RefId = oDV.ToTable().Rows[0]["IncidentID"].ToString();
                    //Session["PersonID"] = RefId;
                }
            }
            catch (Exception ex)
            {
                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                Message.Failure("Error 221, sorry, an error occured, " + AdoUDIRS.StrError, lbl); ///// Pass label saleem
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #11
0
        protected void BindGridview()
        {
            /*
             * SqlConnection con = new SqlConnection("Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB");
             * con.Open();
             * SqlCommand cmd = new SqlCommand("select * from UserDetails", con);
             *
             * SqlDataAdapter da = new SqlDataAdapter(cmd);
             * con.Close();
             * DataSet ds = new DataSet();
             * da.Fill(ds);
             * gvHistory.DataSource = ds;
             * gvHistory.DataBind();
             */


            try
            {
                if (UDIRSHelper.PersonDetails != null)
                {
                    oDV = AdoUDIRS.GET_IncidentsForPerson(UDIRSHelper.PersonDetails.Id.ToString());
                }
                else
                {
                    //redirect to logon page
                }
                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    lblMsg.Text = "No Incident Reported.";
                    lblMsg.Attributes.Add("style", "font-size:40px; color:Red; font-weight:bold;");
                    return;
                }
                else if (oDV.Count > 0)
                {
                    gvHistory.DataSource = oDV;
                    gvHistory.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #12
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string Email = txtEmailID.Text.ToLower().Trim();

            if ((Email.Contains("@iau.edu.sa") || Email.EndsWith("@uod.edu.sa")))
            {
                lblRMsg.Attributes.CssStyle.Add("float", "right");
                lblRMsg.Text      = "Sorry! University Email address can not be used.";
                lblRMsg.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                DataView oDV = new DataView();
                oDV = AdoUDIRS.Registration(txtEmailID.Text.Trim(), txtRpwd.Text.Trim(), txtFirstname.Text.Trim(), txtLastname.Text.Trim(),
                                            txtContact.Text.Trim(), rdoGender.SelectedItem.Value);
                if (AdoUDIRS.BlnError)
                {
                    lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                }
                else
                {
                    if (oDV.Table.Rows.Count > 0)
                    {
                        if (oDV[0].Row["PersonRoleID"] != null)
                        {
                            if (oDV[0].Row["PersonRoleID"].ToString() == "0")
                            {
                                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                Message.Success("User Already exist", lbl);//User Already exist
                            }
                            else
                            {
                                SendEmail(oDV[0].Row["PersonRoleID"].ToString());
                            }
                        }
                    }
                    else
                    {
                        Label lbl = (Label)Page.Master.FindControl("lblMessage");
                        Message.Success("Try again after some time.", lbl);// try again after some time.
                    }
                }
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oDV = AdoUDIRS.GetHealthSafety();
            string fruits = "";

            for (int i = 0; i < oDV.Count; i++)
            {
            }

            //oDV = AdoUDIRS.Regist("Visitor", "*****@*****.**", "j789rt", "Saleem", "Abdul", "23326666",
            //                      "05341039", "*****@*****.**", "Male", "");


            if (AdoUDIRS.BlnError)
            {
                lblMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }

            // Sub_cat.Text = oDV[0]["Title"].ToString();
        }
예제 #14
0
        protected void LoadSession()
        {
            try
            {
                //oDV = AdoUDIRS.GetIncidentHistory();
                oDV = AdoUDIRS.GetReferenceNumber();

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDV.Count == 0)
                {
                    return;
                }
                else if (oDV.Count > 0)
                {
                    string sValue = oDV.ToTable().Rows[0]["RefNumber"].ToString();
                    lblRefID.Text = sValue;
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
            if (UDIRSHelper.PersonDetails != null)
            {
                if (UDIRSHelper.PersonDetails.Fullname != null)
                {
                    lblName.Text = UDIRSHelper.PersonDetails.Fullname;
                }
            }
            else
            {
                //redirect to home or logout
            }

            //lblRefID.Text = ReferenceId;
        }
예제 #15
0
        private bool DeleteActionPlanByID(string actionPlanID)
        {
            oDV = AdoUDIRS.DeleteActionPlanByID(actionPlanID);

            if (oDV == null)
            {
                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                Message.Failure("Failed to delete action plan data.", lbl); ///// Pass label saleem
                return(false);
            }
            else
            {
                DataTable dt = oDV.ToTable();
                //RefId = oDV.Table.Rows[0]["IncidentID"].ToString();
                //Session["IncidentID"] = RefId;
                Label lbl = (Label)Page.Master.FindControl("lblMessage");

                //--Response.Redirect("~/Web/ThankYou.aspx", true);
                Message.Success("Action plan deleted successfully.", lbl); ///// Pass label saleem
                return(true);
            }
        }
예제 #16
0
        private void LoadAllData()
        {
            try
            {
                oDS = AdoUDIRS.GetAllInformation(IncidentID);

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count > 0)
                {
                    string mystring = string.Empty;
                    foreach (DataRow dr in oDS.Tables[0].Rows)
                    {
                        if (dr["NatureOfIncident"] != null)
                        {
                            mystring += dr["NatureOfIncident"] + ", ".ToString();
                        }
                    }
                    if (mystring.IndexOf(',') > 0)
                    {
                        mystring = mystring.Substring(0, mystring.Length - 2);
                    }
                    lblNature.Text = mystring;

                    string myAction = string.Empty;
                    foreach (DataRow dr in oDS.Tables[1].Rows)
                    {
                        if (dr["Suggestion"] != null)
                        {
                            myAction += dr["Suggestion"] + ", ".ToString();
                        }
                    }
                    if (myAction.IndexOf(',') > 0)
                    {
                        myAction = myAction.Substring(0, myAction.Length - 2);
                    }
                    lblSuggestion.Text = myAction;

                    lblDateTime.Text     = oDS.Tables[2].Rows[0]["IncidentDate"].ToString();
                    lblIncidentDesc.Text = oDS.Tables[2].Rows[0]["IncidentDescription"].ToString();
                    lblInjuryDesc.Text   = oDS.Tables[2].Rows[0]["InjuryDescription"].ToString();
                    lblTypeTeatment.Text = oDS.Tables[2].Rows[0]["TreatmentLocation"].ToString();
                    lblAction.Text       = oDS.Tables[2].Rows[0]["ActionDescription"].ToString();
                    lblAddtional.Text    = oDS.Tables[2].Rows[0]["AdditionalInfo"].ToString();
                    lblReference.Text    = oDS.Tables[2].Rows[0]["RefNumber"].ToString();


                    string myfactors = string.Empty;
                    foreach (DataRow dr in oDS.Tables[4].Rows)
                    {
                        if (dr["IncidentInvestigation"] != null)
                        {
                            myfactors += dr["IncidentInvestigation"] + ", ".ToString();
                        }
                    }
                    if (myfactors.IndexOf(',') > 0)
                    {
                        myfactors = myfactors.Substring(0, myfactors.Length - 2);
                    }
                    lblFactors.Text = myfactors;


                    /* -- Action Taken to prevent
                     * string myprevent = string.Empty;
                     * foreach (DataRow dr in oDS.Tables[3].Rows)
                     *  if (dr["ActionDescription"] != null)
                     *      myprevent += dr["ActionDescription"] + ", ".ToString();
                     * if (myprevent.IndexOf(',') > 0)
                     *  myprevent = myprevent.Substring(0, myprevent.Length - 2);
                     * lblToPrevent.Text = myprevent;
                     * */
                    // -- Display Status in Lable

                    slblStatus = oDS.Tables[2].Rows[0]["Incident_Status"].ToString();


                    if (slblStatus == "PE")
                    {
                        lblStatus.Text = "Pending";
                    }
                    else if (slblStatus == "IP")
                    {
                        lblStatus.Text = "In Progress";
                    }
                    else if (slblStatus == "EV")
                    {
                        lblStatus.Text = "Escalate to VDQ";
                    }
                    else if (slblStatus == "CL")
                    {
                        lblStatus.Text = "Closed";
                    }
                    else if (slblStatus == "RP")
                    {
                        lblStatus.Text = "RMO Pending";
                    }


                    sLocation = oDS.Tables[2].Rows[0]["UnitName"].ToString();
                    if (sLocation == "Other")
                    {
                        lblLocation.Text = oDS.Tables[2].Rows[0]["OtherLocation"].ToString();
                    }
                    else
                    {
                        if (oDS.Tables[2].Rows[0]["UnitName"] != null)
                        {
                            lblLocation.Text = oDS.Tables[2].Rows[0]["UnitName"].ToString();
                        }
                    }
                    string sInjured = oDS.Tables[2].Rows[0]["PersonInjured"].ToString();
                    if (sInjured == "Y")
                    {
                        lblPersonInjured.Text = "Yes";
                    }
                    else
                    {
                        lblPersonInjured.Text = "NO";
                    }
                    string sProvided = oDS.Tables[2].Rows[0]["TreatmentProvided"].ToString();
                    if (sInjured == "Y")
                    {
                        lblTreatmentProvided.Text = "Yes";
                    }
                    else
                    {
                        lblTreatmentProvided.Text = "NO";
                    }
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }
예제 #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     oDV = AdoUDIRS.GetHealthSafety();
 }
예제 #18
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            try
            {
                UserName = txtUserName.Text.ToLower().Trim();
                Password = txtPassword.Text.Trim();
                if (UserName.Contains("@iau.edu.sa") || UserName.Contains("@uod.edu.sa") || !UserName.Contains('@'))
                {
                    #region Active Directory Login
                    if (IsUserExist())
                    {
                        string FullName = string.Empty, Email = string.Empty, Phone = string.Empty, Mobile = string.Empty, NationalID = string.Empty;
                        nsWebServices.GetUser[] oArray;
                        oArray = GetUserDetails();
                        if (oArray != null)
                        {
                            if (oArray[0].ID != null && oArray[0].ID != string.Empty)
                            {
                                #region Person details from webservice
                                NationalID = oArray[0].ID;
                                if (oArray[0].FullName != null)
                                {
                                    FullName = oArray[0].FullName;
                                }
                                if (oArray[0].Email != null)
                                {
                                    Email = oArray[0].Email;
                                }
                                if (oArray[0].Phone != null)
                                {
                                    Phone = oArray[0].Phone;
                                }
                                if (oArray[0].Mobile != null)
                                {
                                    Mobile = oArray[0].Mobile;
                                }
                                #endregion
                                DataSet dSet = new DataSet();
                                dSet = AdoUDIRS.AddUpdateUserDetailsByNationalID(NationalID, FullName, Email, Phone, Mobile);
                                if (dSet != null)
                                {
                                    if (dSet.Tables[0] != null)
                                    {
                                        if (dSet.Tables[0].Rows.Count > 0)
                                        {
                                            SetPersonDetails(dSet.Tables[0]);
                                        }
                                        else
                                        {
                                            Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                            Message.Success("PersonRoles does not exist/Database error", lbl);//Person does not exist/Database error
                                        }
                                        #region Set PersonRoleDetails Entity
                                        if (dSet.Tables[1] != null)
                                        {
                                            if (dSet.Tables[1].Rows.Count > 0)
                                            {
                                                SetPersonRoleDetails(dSet.Tables[1]);
                                                Response.Redirect("~/Web/Home.aspx", true);
                                            }
                                        }
                                        else
                                        {
                                            Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                            Message.Failure("PersonRoles does not exist/Database error", lbl); ///// Pass label saleem//PersonRoles does not exist/Database error
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                        Message.Failure("PersonRoles does not exist/Database error", lbl);//Person does not exist/Database error
                                    }
                                }
                                else
                                {
                                    Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                    Message.Failure("PersonRoles does not exist/Database error", lbl);//Person does not exist/Database error
                                }
                            }
                            else
                            {
                                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                Message.Failure("Your NationalID not found, Please contact [email protected] or 31111.", lbl);//Message: Your NationalID not found, Please contact [email protected] or 31111.
                            }
                        }
                        else
                        {
                            Label lbl = (Label)Page.Master.FindControl("lblMessage");
                            Message.Failure("Server not responding, Please try after some time.", lbl);//Message: Server not responding, Please try after some time.
                        }
                    }
                    else
                    {
                        Label lbl = (Label)Page.Master.FindControl("lblMessage");
                        Message.Failure("Incorrect login credentials", lbl);//Message: incorrect login credentials
                    }
                    #endregion
                }
                else
                {
                    #region Other Login
                    DataSet dSet = new DataSet();
                    dSet = AdoUDIRS.CheckAndGetDataForOthersLogin(UserName);
                    if (dSet != null)
                    {
                        if (dSet.Tables[0] != null)
                        {
                            if (dSet.Tables[0].Rows.Count > 0)
                            {
                                SetPersonDetails(dSet.Tables[0]);
                            }
                            else
                            {
                                return;
                                //Person does not exist/Database error
                            }
                            #region Set PersonRoleDetails Entity
                            if (dSet.Tables[1] != null)
                            {
                                if (dSet.Tables[1].Rows.Count > 0)
                                {
                                    SetPersonRoleDetails(dSet.Tables[1]);
                                    Response.Redirect("~/Web/Home.aspx", true);
                                }
                            }
                            else
                            {
                                Label lbl = (Label)Page.Master.FindControl("lblMessage");
                                Message.Success("PersonRoles does not exist/Database error", lbl);//PersonRoles does not exist/Database error
                            }
                            #endregion
                        }
                        else
                        {
                            Label lbl = (Label)Page.Master.FindControl("lblMessage");
                            Message.Success("Incorrect Username/Password", lbl);//Incorrect Username/Password
                        }
                    }
                    else
                    {
                        Label lbl = (Label)Page.Master.FindControl("lblMessage");
                        Message.Success("Incorrect Username/Password", lbl);//Incorrect Username/Password
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #19
0
        private void LoadAllData()
        {
            try
            {
                oDS = AdoUDIRS.GetAllInformation(IncidentID);

                if (AdoUDIRS.BlnError)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count == 0)
                {
                    //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
                    return;
                }
                else if (oDS.Tables.Count > 0)
                {
                    string mystring = string.Empty;

                    foreach (DataRow dr in oDS.Tables[0].Rows)
                    {
                        if (dr["NatureOfIncident"] != null)
                        {
                            mystring += dr["NatureOfIncident"] + ", ".ToString();
                        }
                    }
                    if (mystring.IndexOf(',') > 0)
                    {
                        mystring = mystring.Substring(0, mystring.Length - 2);
                    }
                    lblNature.Text = mystring;

                    string myAction = string.Empty;
                    foreach (DataRow dr in oDS.Tables[1].Rows)
                    {
                        if (dr["Suggestion"] != null)
                        {
                            myAction += dr["Suggestion"] + ", ".ToString();
                        }
                    }
                    if (myAction.IndexOf(',') > 0)
                    {
                        myAction = myAction.Substring(0, myAction.Length - 2);
                    }
                    lblSuggestion.Text = myAction;

                    lblName.Text         = oDS.Tables[2].Rows[0]["Fullname"].ToString();
                    lblContact.Text      = oDS.Tables[2].Rows[0]["Mobile"].ToString();
                    lblEmail.Text        = oDS.Tables[2].Rows[0]["WorkEmail"].ToString();
                    lblDateTime.Text     = oDS.Tables[2].Rows[0]["IncidentDate"].ToString();
                    lblIncidentDesc.Text = oDS.Tables[2].Rows[0]["IncidentDescription"].ToString();
                    lblInjuryDesc.Text   = oDS.Tables[2].Rows[0]["InjuryDescription"].ToString();
                    lblTypeTeatment.Text = oDS.Tables[2].Rows[0]["TreatmentLocation"].ToString();
                    lblAction.Text       = oDS.Tables[2].Rows[0]["ActionDescription"].ToString();
                    lblAddtional.Text    = oDS.Tables[2].Rows[0]["AdditionalInfo"].ToString();
                    lblReference.Text    = oDS.Tables[2].Rows[0]["RefNumber"].ToString();
                    //lblPersonInjured.Text = oDS.Tables[2].Rows[0]["PersonInjured"].ToString();
                    if (ddlStatus.Items.FindByValue(oDS.Tables[2].Rows[0]["Incident_Status"].ToString()) != null)
                    {
                        ddlStatus.SelectedValue = oDS.Tables[2].Rows[0]["Incident_Status"].ToString();
                        PreviousIncidentStatus  = ddlStatus.SelectedValue;
                    }
                    if (oDS.Tables[2].Rows[0]["Comments"] != null && oDS.Tables[2].Rows[0]["Comments"].ToString() != string.Empty)
                    {
                        PreviousIncidentComment = oDS.Tables[2].Rows[0]["Comments"].ToString();
                    }
                    // ____________________________________ Working Retrieve Checkboxlist _____________________________________________
                    if (oDS.Tables[4].Rows.Count > 0)
                    {
                        BindRMOCheckboxlist();
                        DisableCheckBoxList();
                    }
                    // ____________________________________ Working Retrieve Checkboxlist _____________________________________________
                    if (oDS.Tables[3].Rows.Count > 0)
                    {
                        BindActionPlan(oDS.Tables[3]);
                    }
                    else
                    {
                        SetInitialRow();
                    }


                    sLocation = oDS.Tables[2].Rows[0]["UnitName"].ToString();
                    if (sLocation == "Other")
                    {
                        lblLocation.Text = oDS.Tables[2].Rows[0]["OtherLocation"].ToString();
                    }
                    else
                    {
                        if (oDS.Tables[2].Rows[0]["UnitName"] != null)
                        {
                            lblLocation.Text = oDS.Tables[2].Rows[0]["UnitName"].ToString();
                        }
                    }
                    string sInjured = oDS.Tables[2].Rows[0]["PersonInjured"].ToString();
                    if (sInjured == "Y")
                    {
                        lblPersonInjured.Text = "Yes";
                    }
                    else
                    {
                        lblPersonInjured.Text = "NO";
                    }
                    string sProvided = oDS.Tables[2].Rows[0]["TreatmentProvided"].ToString();
                    if (sInjured == "Y")
                    {
                        lblTreatmentProvided.Text = "Yes";
                    }
                    else
                    {
                        lblTreatmentProvided.Text = "NO";
                    }
                }
            }
            catch (Exception ex)
            {
                //lblRMsg.Text = "Error 40, sorry, an error occured, " + AdoUDIRS.StrError;
            }
        }