protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; int countrycode = 0; if (ddlSearchCountry.SelectedValue != "0") { countrycode = Convert.ToInt32(ddlSearchCountry.SelectedValue.ToString()); } string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_OPS_BunkerAnalysis.Get_LOTestingLabList(txtfilter.Text, countrycode, GetSessionUserID(), sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); string[] HeaderCaptions = { "ID", "Lab Name", "Country", "Address", "EMail", "Phone" }; string[] DataColumnsName = { "ID", "lab_Name", "Country_Name", "Address", "EMail", "Phone" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Labs", "Labs", ""); }
protected void Load_BunkerSampleAnalysis() { int FleetCode = UDFLib.ConvertToInteger(ddlFleet.SelectedValue); int Vessel_ID = UDFLib.ConvertToInteger(ddlVessel.SelectedValue); int Bunker_Supplier = 0; // UDFLib.ConvertToInteger(ddlBunkerSupplier.SelectedValue); int LabID = 0; int Status = UDFLib.ConvertToInteger(ddlStatus.SelectedValue); string DateFrom = txtDateFrom.Text; string DateTo = txtDateTo.Text; int PAGE_SIZE = ucCustomPager.PageSize; int PAGE_INDEX = ucCustomPager.CurrentPageIndex; int SelectRecordCount = ucCustomPager.isCountRecord; DataTable dt = BLL_OPS_BunkerAnalysis.Get_BunkerAnalysisReport(FleetCode, Vessel_ID, Bunker_Supplier, LabID, Status, DateFrom, DateTo, GetSessionUserID(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount); GridView_Bunker.DataSource = dt; GridView_Bunker.DataBind(); if (ucCustomPager.isCountRecord == 1) { ucCustomPager.CountTotalRec = SelectRecordCount.ToString(); ucCustomPager.BuildPager(); } }
public void Load_BunkerSupplierList() { DataTable dt = BLL_OPS_BunkerAnalysis.Get_BunkerSupplierList(GetSessionUserID()); ddlBunkerSupplier.DataSource = dt; ddlBunkerSupplier.DataBind(); }
public void Load_BunkerLabList() { DataTable dt = BLL_OPS_BunkerAnalysis.Get_BunkerTestingLabList(GetSessionUserID()); ddlLabList.DataSource = dt; ddlLabList.DataBind(); }
public void Load_LOLabList() { int rowcount = 0; DataTable dt = BLL_OPS_BunkerAnalysis.Get_LOTestingLabList("", 0, GetSessionUserID(), null, null, 0, 0, ref rowcount); ddlLabList.DataSource = dt; ddlLabList.DataBind(); }
protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { string Bunkering_Date = ""; string AirwayBill = ""; int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[0].ToString()); if (e.NewValues["Bunkering_Date"] != null) { Bunkering_Date = e.NewValues["Bunkering_Date"].ToString(); } int PortID = UDFLib.ConvertToInteger(e.NewValues["Bunkering_Port"].ToString()); int Bunker_SupplierID = UDFLib.ConvertToInteger(e.NewValues["Bunker_SupplierID"].ToString()); int LabID = UDFLib.ConvertToInteger(e.NewValues["LabID"].ToString()); int VesselID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[1].ToString()); if (e.NewValues["AirwayBill"] != null) { AirwayBill = e.NewValues["AirwayBill"].ToString(); } int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString()); DataSet ds = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysis(ID, VesselID, Bunkering_Date, PortID, Bunker_SupplierID, LabID, AirwayBill, Status, GetSessionUserID()); if (ds.Tables.Count > 0) { if (Status == 2) { if (ds.Tables.Count > 1) { foreach (DataRow item in ds.Tables[ds.Tables.Count - 1].Rows) { if (File.Exists(Server.MapPath("~/Uploads/BunkerAnalysis/") + item["File_Name"].ToString())) { if (!File.Exists(Server.MapPath("~/Uploads/Technical/") + item["File_Name"].ToString())) { File.Copy(Server.MapPath("~/Uploads/BunkerAnalysis/") + item["File_Name"].ToString(), Server.MapPath("~/Uploads/Technical/") + item["File_Name"].ToString()); } } } } } } else { string js = "alert('Not Updated !!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true); } GridView_Bunker.EditIndex = -1; Load_BunkerSampleAnalysis(); } catch { } }
protected void SendMail_Acknowledge(int Sample_ID) { int RetID = BLL_OPS_BunkerAnalysis.SendMail_AckSampleReceived(Sample_ID, GetSessionUserID()); if (RetID > 0) { ResponseHelper.Redirect("~/Crew/EmailEditor.aspx?Discard=1&ID=" + RetID.ToString(), "_blank", null); } }
protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Value.ToString()); int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString()); int SampleReceived = Convert.ToInt32((bool)e.NewValues["SampleReceived_ByLab"]); int RetVal = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysisStatus(ID, Status, SampleReceived, GetSessionUserID()); GridView_Bunker.EditIndex = -1; Load_BunkerSampleAnalysis(); } catch { } }
protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { GridViewRow row = (GridViewRow)GridView_Bunker.Rows[e.RowIndex]; string Bunkering_Date = ""; string AirwayBill = ""; int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[0].ToString()); if (e.NewValues["Bunkering_Date"] != null) { Bunkering_Date = e.NewValues["Bunkering_Date"].ToString(); } int PortID = UDFLib.ConvertToInteger(e.NewValues["Bunkering_Port"].ToString()); // int Bunker_SupplierID = UDFLib.ConvertToInteger(e.NewValues["Bunker_SupplierID"].ToString()); // int LabID = UDFLib.ConvertToInteger(e.NewValues["LabID"].ToString()); int Bunker_SupplierID = Convert.ToInt32(((DropDownList)row.FindControl("ddlBunkerSupplier")).SelectedValue); int LabID = Convert.ToInt32(((DropDownList)row.FindControl("ddlLabName")).SelectedValue); int VesselID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Values[1].ToString()); if (e.NewValues["AirwayBill"] != null) { AirwayBill = e.NewValues["AirwayBill"].ToString(); } int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString()); DataSet ds = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysis(ID, VesselID, Bunkering_Date, PortID, Bunker_SupplierID, LabID, AirwayBill, Status, GetSessionUserID()); if (ds.Tables.Count == 0) { string js = "alert('Not Updated !!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true); } GridView_Bunker.EditIndex = -1; Load_BunkerSampleAnalysis(); } catch { } }
protected void btnSave_Click(object sender, EventArgs e) { int res_id = 0; if (HiddenFlag.Value == "Add") { res_id = BLL_OPS_BunkerAnalysis.Insert_LO_Testing_Lab(txtLabName.Text.Trim(), txtAddress.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim(), int.Parse(ddlAddCountry.SelectedValue), GetSessionUserID()); } else { res_id = BLL_OPS_BunkerAnalysis.Update_LO_Testing_Lab(UDFLib.ConvertToInteger(Selected_ID.Value), txtLabName.Text.Trim(), txtAddress.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim(), UDFLib.ConvertToInteger(ddlAddCountry.SelectedValue), GetSessionUserID()); } if (res_id > 0) { Bind_LOTestingLabs(); string hidemodal = String.Format("hideModal('divadd')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true); } }
protected void onUpdate(object source, CommandEventArgs e) { HiddenFlag.Value = "Edit"; OperationMode = "Edit Lab"; DataTable dt = new DataTable(); Selected_ID.Value = e.CommandArgument.ToString(); dt = BLL_OPS_BunkerAnalysis.Get_LOTestingLabByID(UDFLib.ConvertToInteger(e.CommandArgument.ToString()), GetSessionUserID()); if (dt.Rows.Count > 0) { txtLabName.Text = dt.Rows[0]["LAB_NAME"].ToString(); txtAddress.Text = dt.Rows[0]["ADDRESS"].ToString(); txtEmail.Text = dt.Rows[0]["EMAIL"].ToString(); txtPhone.Text = dt.Rows[0]["PHONE"].ToString(); ddlAddCountry.SelectedValue = dt.Rows[0]["CountryID"].ToString(); string js = String.Format("showModal('divadd',false);"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Deptmodal", js, true); } }
protected void GridView_Bunker_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int ID = UDFLib.ConvertToInteger(GridView_Bunker.DataKeys[e.RowIndex].Value.ToString()); int Status = UDFLib.ConvertToInteger(e.NewValues["StatusID"].ToString()); int SampleReceived = Convert.ToInt32((bool)e.NewValues["SampleReceived_ByLab"]); int RetVal = BLL_OPS_BunkerAnalysis.UPDATE_BunkerAnalysisStatus(ID, Status, SampleReceived, GetSessionUserID()); if (RetVal == 0) { string js = "alert('Not Updated !!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "status", js, true); } GridView_Bunker.EditIndex = -1; Load_BunkerSampleAnalysis(); } catch { } }
public void Bind_LOTestingLabs() { int rowcount = ucCustomPagerItems.isCountRecord; int countrycode = 0; if (ddlSearchCountry.SelectedValue != "0") { countrycode = Convert.ToInt32(ddlSearchCountry.SelectedValue.ToString()); } string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_OPS_BunkerAnalysis.Get_LOTestingLabList(txtfilter.Text, countrycode, GetSessionUserID(), sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); GridView_Labs.DataSource = dt; GridView_Labs.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserAccessValidation(); string Sample_ID = GetQueryString("id"); string TypeID = GetQueryString("Type"); hdnSample_ID.Value = Sample_ID; hdnTypeID.Value = TypeID; if (TypeID == "1") { ddlType1.Items.Add(new ListItem("Lab Report", "1")); ddlType2.Items.Add(new ListItem("Lab Report", "1")); ddlType3.Items.Add(new ListItem("Lab Report", "1")); } else { ddlType1.Items.Add(new ListItem("BDN", "2")); ddlType1.Items.Add(new ListItem("Others", "3")); ddlType2.Items.Add(new ListItem("BDN", "2")); ddlType2.Items.Add(new ListItem("Others", "3")); ddlType3.Items.Add(new ListItem("BDN", "2")); ddlType3.Items.Add(new ListItem("Others", "3")); } if (Sample_ID != "") { DataTable dt = BLL_OPS_BunkerAnalysis.Get_BunkerSampleAttachments(UDFLib.ConvertToInteger(Sample_ID), UDFLib.ConvertToInteger(TypeID), GetSessionUserID()); string AttachmentName = ""; string FileName = ""; string UploadPath = ConfigurationManager.AppSettings["UploadPath"].ToString(); if (dt.Rows.Count == 1) { FileName = System.IO.Path.GetFileName(dt.Rows[0]["File_Name"].ToString()); AttachmentName = dt.Rows[0]["Attachment_Name"].ToString(); FileName = System.IO.Path.GetFileName(dt.Rows[0]["File_Name"].ToString()); HyperLink lnk = new HyperLink(); lnk.Text = AttachmentName + "<br>"; lnk.NavigateUrl = "../../" + UploadPath + "/BunkerAnalysis/" + FileName; lnk.Target = "_blank"; Panel1.Controls.Add(lnk); } else if (dt.Rows.Count > 1) { foreach (DataRow dr in dt.Rows) { AttachmentName = dr["Attachment_Name"].ToString(); FileName = System.IO.Path.GetFileName(dr["File_Name"].ToString()); HyperLink lnk = new HyperLink(); lnk.Text = AttachmentName + "<br>"; lnk.NavigateUrl = "../../" + UploadPath + "/BunkerAnalysis/" + FileName; lnk.Target = "_blank"; Panel1.Controls.Add(lnk); } } } } }
protected void lnkAddAttachment_Click(object sender, EventArgs e) { lblmsg1.Text = ""; lblmsg2.Text = ""; lblmsg3.Text = ""; string AttachmentName = ""; string FileName = ""; int AttachmentType; int RetVal = 0; int uploadedSuccessfully = 1; lblmsg1.Text = ""; int Sample_ID = UDFLib.ConvertToInteger(hdnSample_ID.Value); DataTable dt = new DataTable(); dt = objUploadFilesize.Get_Module_FileUpload("BNK_"); if (dt.Rows.Count > 0) { string datasize = dt.Rows[0]["Size_KB"].ToString(); if (FileUpload_1.HasFile) { if (FileUpload_1.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024) { AttachmentName = Path.GetFileName(FileUpload_1.FileName); AttachmentType = UDFLib.ConvertToInteger(ddlType1.SelectedValue); FileName = "BNK_" + Guid.NewGuid().ToString() + Path.GetExtension(AttachmentName); FileUpload_1.SaveAs(MapPath("~/Uploads/BunkerAnalysis/") + FileName); RetVal = BLL_OPS_BunkerAnalysis.Insert_BunkerSampleAttachment(Sample_ID, AttachmentType, AttachmentName.Replace(Path.GetExtension(AttachmentName), ""), FileName, GetSessionUserID()); lblmsg1.Text = "File Uploaded"; } else { lblmsg1.Text = datasize + " KB File size exceeds max limit"; uploadedSuccessfully = 0; } } if (FileUpload_2.HasFile) { if (FileUpload_2.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024) { AttachmentName = Path.GetFileName(FileUpload_2.FileName); AttachmentType = UDFLib.ConvertToInteger(ddlType2.SelectedValue); FileName = "BNK_" + Guid.NewGuid().ToString() + Path.GetExtension(AttachmentName); FileUpload_2.SaveAs(MapPath("~/Uploads/BunkerAnalysis/") + FileName); RetVal = BLL_OPS_BunkerAnalysis.Insert_BunkerSampleAttachment(Sample_ID, AttachmentType, AttachmentName.Replace(Path.GetExtension(AttachmentName), ""), FileName, GetSessionUserID()); lblmsg2.Text = "File Uploaded"; } else { lblmsg2.Text = datasize + " KB File size exceeds max limit"; uploadedSuccessfully = 0; } } if (FileUpload_3.HasFile) { if (FileUpload_3.PostedFile.ContentLength < Int32.Parse(dt.Rows[0]["Size_KB"].ToString()) * 1024) { AttachmentName = Path.GetFileName(FileUpload_3.FileName); AttachmentType = UDFLib.ConvertToInteger(ddlType3.SelectedValue); FileName = "BNK_" + Guid.NewGuid().ToString() + Path.GetExtension(AttachmentName); FileUpload_3.SaveAs(MapPath("~/Uploads/BunkerAnalysis/") + FileName); RetVal = BLL_OPS_BunkerAnalysis.Insert_BunkerSampleAttachment(Sample_ID, AttachmentType, AttachmentName.Replace(Path.GetExtension(AttachmentName), ""), FileName, GetSessionUserID()); lblmsg3.Text = "File Uploaded"; } else { lblmsg3.Text = datasize + " KB File size exceeds max limit"; uploadedSuccessfully = 0; // return; } } } else { string js2 = "alert('Upload size not set!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert9", js2, true); } if (uploadedSuccessfully == 1) { string js = ""; if (RetVal > 0) { js = "alert('Attachment Uploaded!!');"; } js += "window.parent.closeDiv('dvAttachments');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true); } }
protected void onDelete(object source, CommandEventArgs e) { int retval = BLL_OPS_BunkerAnalysis.Delete_LO_Testing_Lab(Convert.ToInt32(e.CommandArgument.ToString()), GetSessionUserID()); Bind_LOTestingLabs(); }