protected void Load_Crew_Medical_History() { int FleetCode = 0; int Vessel_ID = 0; int CrewID = UDFLib.ConvertToInteger(Request.QueryString["CrewID"]); int Case_Type = 0; int Status = 1; int PAGE_SIZE = 1000; int PAGE_INDEX = 1; int SelectRecordCount = 0; string SortBy = (ViewState["SORTBY"] == null) ? null : (ViewState["SORTBY"].ToString()); int? SortDirection = null; if (ViewState["SORTDIRECTION"] != null) { SortDirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_Crew_MedHistory.Get_Crew_MedHistory(FleetCode, Vessel_ID, CrewID, Case_Type, Status, null, GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, SortBy, SortDirection); GridView_MedicalHistory.DataSource = dt; GridView_MedicalHistory.DataBind(); BLL_Crew_CrewDetails objCrew = new BLL_Crew_CrewDetails(); DataTable dst = objCrew.Get_CrewPersonalDetailsByID(CrewID); if (dst.Rows[0]["Staff_Code"].ToString().Trim().Length == 0) { imgAdd_MedHistory.Visible = false; } }
protected void btnSaveCostItem_Click(object sender, EventArgs e) { try { string js; if (txtExp_Date.Text.Trim().Length == 0) { js = "alert('Date is not Valid!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true); js = "showModal('dvPopupCostItem');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "updated1", js, true); UpdatePanel2.Update(); return; } else { try { DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtExp_Date.Text)); } catch { js = "alert('Enter valid Date" + TodayDateFormat + "')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "scripts", js, true); js = "showModal('dvPopupCostItem');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script2", js, true); UpdatePanel2.Update(); return; } } if (txtDesc.Text.ToString().Length == 0 || ddlExpType.SelectedIndex <= 0 || ddlLocalCurr.SelectedIndex == 0 || txtLocalAmt.Text.Trim().Length == 0) { js = "showModal('dvPopupCostItem');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "updated1", js, true); UpdatePanel2.Update(); return; } int Vessel_ID = UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]); int Office_ID = UDFLib.ConvertToInteger(Request.QueryString["Office_ID"]); int Cost_Item_ID = BLL_Crew_MedHistory.INSERT_Med_Cost_Item(UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID, UDFLib.ConvertToDefaultDt(Convert.ToString(txtExp_Date.Text)), txtDesc.Text, UDFLib.ConvertToInteger(ddlExpType.SelectedValue), UDFLib.ConvertToInteger(ddlLocalCurr.SelectedValue), UDFLib.ConvertDecimalToNull(txtLocalAmt.Text), UDFLib.ConvertDecimalToNull(txtUSDAmt.Text), GetSessionUserID()); Upload_CostItemAttachments(Cost_Item_ID); Load_Crew_MedHistory_Details(UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID); string hidemodal = String.Format("hideModal('divadd')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } finally { Session["MedicalCostItemAttachments"] = null; } }
protected void Load_Med_History_CostItem_Types() { DataTable dtType = BLL_Crew_MedHistory.Get_Crew_MedHistory_CostItem_Types(GetSessionUserID()); ddlExpType.DataSource = dtType; ddlExpType.DataTextField = "COST_TYPE"; ddlExpType.DataValueField = "COST_TYPE_ID"; ddlExpType.DataBind(); ddlExpType.Items.Insert(0, new ListItem("- SELECT -", "0")); }
protected void btnUploadAttachments_Click(object sender, EventArgs e) { lblMsg.Text = ""; try { int Case_ID = UDFLib.ConvertToInteger(hdnCaseID.Value); int Vessel_ID = UDFLib.ConvertToInteger(hdnVesselId.Value); int Office_ID = UDFLib.ConvertToInteger(hdnOfficeId.Value); DataTable dt = new DataTable(); dt = objUploadFilesize.Get_Module_FileUpload("CWF_"); if (dt.Rows.Count > 0) { string datasize = dt.Rows[0]["Size_KB"].ToString(); if (UploadAttachments.HasFile) { if (UploadAttachments.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024) { //if (UploadAttachments.FileName.Length > 0) //{ Guid GUID = Guid.NewGuid(); long SIZE_BYTES = UploadAttachments.PostedFile.ContentLength; if (SIZE_BYTES > 0 && Case_ID > 0) { string File_Path = GUID + System.IO.Path.GetExtension(UploadAttachments.FileName); UploadAttachments.PostedFile.SaveAs(Server.MapPath("~/Uploads/MedHistory/" + File_Path)); int FileID = BLL_Crew_MedHistory.INSERT_Crew_MedHistory_Attachment(Case_ID, Vessel_ID, Office_ID, UploadAttachments.FileName.Replace("&", "_"), File_Path, SIZE_BYTES, GetSessionUserID()); } DataTable dtAtt = BLL_Crew_MedHistory.Get_Crew_MedHistory_Attachments(Case_ID, Vessel_ID, Office_ID, GetSessionUserID()); rptAttachments.DataSource = dtAtt; rptAttachments.DataBind(); } else { lblMsg.Text = datasize + " KB File size exceeds maximum limit"; } } } else { string js2 = "alert('Upload size not set!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert9", js2, true); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void rptCostItems_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { int ID = UDFLib.ConvertToInteger(e.CommandArgument); int Vessel_ID = UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]); int Office_ID = UDFLib.ConvertToInteger(Request.QueryString["Office_ID"]); BLL_Crew_MedHistory.DELETE_Med_Cost_Item(ID, UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID, GetSessionUserID()); Load_Crew_MedHistory_Details(UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID); } }
public string Get_MedHistory_Followups(int Case_ID, int Vessel_ID, int Office_ID, int UserID) { DataTable dt = BLL_Crew_MedHistory.Get_Crew_MedHistory_Followups(Case_ID, Vessel_ID, Office_ID, UserID); return(UDFLib.CreateHtmlTableFromDataTable(dt, new string[] { "Date", "From", "Message" }, new string[] { "Date_Of_Creation", "CreatedBy", "Followup_Text" }, new string[] { }, "CrewQuery-Followup-table", "CrewQuery-Followup-DataHeder", "CrewQuery-Followup-Data")); }
protected void rptAttachments_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { int ID = UDFLib.ConvertToInteger(e.CommandArgument); int Case_ID = UDFLib.ConvertToInteger(hdnCaseID.Value); int Vessel_ID = UDFLib.ConvertToInteger(hdnVesselId.Value); int Office_ID = UDFLib.ConvertToInteger(hdnOfficeId.Value); BLL_Crew_MedHistory.DELETE_Crew_MedHistory_Attachment(ID, Case_ID, Vessel_ID, Office_ID, GetSessionUserID()); DataTable dtAtt = BLL_Crew_MedHistory.Get_Crew_MedHistory_Attachments(Case_ID, Vessel_ID, Office_ID, GetSessionUserID()); rptAttachments.DataSource = dtAtt; rptAttachments.DataBind(); } }
public string Get_Med_CostItem_Attachments(int Cost_Item_ID, int Case_ID, int Vessel_ID, int Office_ID, int UserID) { DataTable dt = BLL_Crew_MedHistory.Get_Med_CostItem_Attachments(Cost_Item_ID, Case_ID, Vessel_ID, Office_ID, UserID); UDCHyperLink aLink = new UDCHyperLink("DocURL", "", new string[] { }, new string[] { }, "_blank"); Dictionary <string, UDCHyperLink> dicLink = new Dictionary <string, UDCHyperLink>(); dicLink.Add("Attachment_Name", aLink); return(UDFLib.CreateHtmlTableFromDataTable(dt, new string[] { "Attachments" }, new string[] { "Attachment_Name" }, dicLink, new Dictionary <string, UDCToolTip>(), new string[] { "left" }, "CrewQuery-Attachments-table", "CrewQuery-Attachments-DataHeder", "CrewQuery-Attachments-Data")); }
protected void btnSaveFollowUp_Click(object sender, EventArgs e) { try { int Case_ID = UDFLib.ConvertToInteger(Request.QueryString["ID"]); int Vessel_ID = UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]); int Office_ID = UDFLib.ConvertToInteger(Request.QueryString["Office_ID"]); int Res = BLL_Crew_MedHistory.INSERT_Crew_MedHistory_FollowUp(Case_ID, Vessel_ID, Office_ID, txtFollowUp.Text, GetSessionUserID()); if (Res > 0) { string js = "alert('FollowUp added!!)"; ScriptManager.RegisterStartupScript(this, this.GetType(), "initscript1", js, true); txtFollowUp.Text = ""; Load_Crew_MedHistory_Details(Case_ID, Vessel_ID, Office_ID); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void Load_Crew_MedHistory_Details(int Case_ID, int Vessel_ID, int Office_ID) { DataSet ds = BLL_Crew_MedHistory.Get_Crew_MedHistory_Details(Case_ID, Vessel_ID, Office_ID, GetSessionUserID()); try { if (ds.Tables[0].Rows.Count > 0) { txtDate_Of_Creation.Text = UDFLib.ConvertUserDateFormat(Convert.ToString(ds.Tables[0].Rows[0]["Case_Date"])); ddlStatus.SelectedValue = ds.Tables[0].Rows[0]["StatusID"].ToString(); ddlType.SelectedValue = ds.Tables[0].Rows[0]["CASE_TYPE_ID"].ToString(); txtDetails.Text = ds.Tables[0].Rows[0]["CASE_DETAIL"].ToString(); ddlVoyages.SelectedValue = ds.Tables[0].Rows[0]["VoyageID"].ToString(); lblDate_Of_Creation.Text = UDFLib.ConvertUserDateFormat(Convert.ToString(ds.Tables[0].Rows[0]["CASE_DATE"])); lblToDate.Text = UDFLib.ConvertUserDateFormat(Convert.ToString(ds.Tables[0].Rows[0]["CASE_TO_DATE"])); lblStatus.Text = ds.Tables[0].Rows[0]["CASE_STATUS"].ToString(); lblType.Text = ds.Tables[0].Rows[0]["CASE_TYPE"].ToString(); lblDetails.Text = ds.Tables[0].Rows[0]["CASE_DETAIL"].ToString(); lblVoyageName.Text = ds.Tables[0].Rows[0]["Voyage_Name"].ToString(); pnlCostItems.Visible = true; pnlFollowups.Visible = true; } } catch { } rptCostItems.DataSource = ds.Tables[1]; rptCostItems.DataBind(); rptFollowUps.DataSource = ds.Tables[2]; rptFollowUps.DataBind(); rptAttachments.DataSource = ds.Tables[3]; rptAttachments.DataBind(); }
protected void Upload_CostItemAttachments(int Cost_Item_ID) { try { // User can save file to File System, database or in session state if (Session["MedicalCostItemAttachments"] != null) { Dictionary <string, Byte[]> Files = Session["MedicalCostItemAttachments"] as Dictionary <string, Byte[]>; int Case_ID = UDFLib.ConvertToInteger(hdnCaseID.Value); int Vessel_ID = UDFLib.ConvertToInteger(hdnVesselId.Value); int Office_ID = UDFLib.ConvertToInteger(hdnOfficeId.Value); foreach (KeyValuePair <string, Byte[]> file in Files) { Byte[] fileBytes = file.Value; string FileName = file.Key; int SIZE_BYTES = fileBytes.Length; Guid GUID = Guid.NewGuid(); string FilPath = Path.Combine(Server.MapPath("~/Uploads/MedHistory/"), GUID.ToString() + Path.GetExtension(FileName)); string Attach_Name = Path.GetFileName(FileName); string Attach_Path = GUID.ToString() + Path.GetExtension(FileName); FileStream fileStream = new FileStream(FilPath, FileMode.Create, FileAccess.ReadWrite); fileStream.Write(fileBytes, 0, fileBytes.Length); fileStream.Close(); int FileID = BLL_Crew_MedHistory.INSERT_Med_Cost_Item_Attachment(Case_ID, @Cost_Item_ID, Vessel_ID, Office_ID, Attach_Name.Replace("&", "_"), Attach_Path, SIZE_BYTES, GetSessionUserID()); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { try { int Res = 0; int Case_ID = UDFLib.ConvertToInteger(hdnCaseID.Value); int CrewID = UDFLib.ConvertToInteger(Request.QueryString["CrewID"]); int Vessel_ID = UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]); int Office_ID = UDFLib.ConvertToInteger(Request.QueryString["Office_ID"]); if (Case_ID > 0) { if (txtDetails.Text.Trim() == "") { string js1 = "alert('Please enter medical history details!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js1", js1, true); } else if (txtDate_Of_Creation.Text.Trim() == "") { string js2 = "alert('Please enter medical history date!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js2", js2, true); UpdatePanel1.Update(); } else { Res = BLL_Crew_MedHistory.UPDATE_Crew_MedHistory(Case_ID, UDFLib.ConvertToInteger(ddlVoyages.SelectedValue), CrewID, UDFLib.ConvertToInteger(ddlType.SelectedValue), UDFLib.ConvertToInteger(ddlStatus.SelectedValue), txtDetails.Text, UDFLib.ConvertToDefaultDt(txtDate_Of_Creation.Text), GetSessionUserID(), UDFLib.ConvertToDefaultDt(txtToDate.Text), Office_ID); if (Res > 0) { string js = "alert('Medical History updated!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "updated", js, true); txtFollowUp.Text = ""; Load_Crew_MedHistory_Details(Case_ID, Vessel_ID, Office_ID); } MultiView_MedHistory.ActiveViewIndex = 1; } } else { if (txtDetails.Text.Trim() == "") { string js1 = "alert('Please enter medical history details!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js1", js1, true); } else if (txtDate_Of_Creation.Text.Trim() == "") { string js2 = "alert('Please enter medical history date!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js2", js2, false); UpdatePanel1.Update(); } else { DataTable dtI = BLL_Crew_MedHistory.INSERT_Crew_MedHistory(UDFLib.ConvertToInteger(ddlVoyages.SelectedValue), CrewID, UDFLib.ConvertToInteger(ddlType.SelectedValue), UDFLib.ConvertToInteger(ddlStatus.SelectedValue), txtDetails.Text, UDFLib.ConvertToDefaultDt(txtDate_Of_Creation.Text), GetSessionUserID(), UDFLib.ConvertToDefaultDt(txtToDate.Text)); if (dtI.Rows.Count > 0) { int caseID = Convert.ToInt32(dtI.Rows[0][0].ToString()); int VesselID = Convert.ToInt32(dtI.Rows[0][1].ToString()); hdnCaseID.Value = Res.ToString(); Load_Crew_MedHistory_Details(caseID, VesselID, Office_ID); string js = "alert('Medical History added!!')"; ScriptManager.RegisterStartupScript(this, this.GetType(), "inserted", js, true); txtFollowUp.Text = ""; MultiView_MedHistory.ActiveViewIndex = 1; } } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }