예제 #1
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;
            }
        }