protected void btnAddCatrgory_Click(object sender, EventArgs e) { string FileName = null; int Parent = Convert.ToInt32(hfNode.Value); int Type = 2; int Id = 0; if (txtCategoryName.Text.Trim() == "") { string js1 = "alert('Name is mandatory.');showModal('dvCategory');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "showModalJS", js1, true); return; } if (Session["Mode"].ToString() == "NEW") { Id = 0; } if (Session["Mode"].ToString() == "EDIT") { Id = Convert.ToInt32(hfNode.Value); } if (Session["Mode"] != null) { BLL_LMS_Training.INSUPD_VESSEL_VIDEOS(Id, Type, txtCategoryName.Text, null, FileName, Parent, Convert.ToInt32(Session["USERID"])); string js = "hideModal('dvCategory');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true); Session["FileName"] = null; Session["Mode"] = null; } }
protected void btnExport_Click(object sender, ImageClickEventArgs e) { try { DataTable dt = BLL_LMS_Training.GET_VESSEL_VIDEOS(null); dt.DefaultView.RowFilter = "FileName IS NOT NULL"; DataView dv = dt.DefaultView; List <String> lFileList = new List <string>(); foreach (DataRow item in dv.ToTable().Rows) { lFileList.Add(item["FileName"].ToString()); } if (lFileList.Count > 0) { string lDownlodFileName = BLL_LMS_Training.RAR(Server.MapPath("~/Uploads/VesselVideos"), lFileList); ResponseHelper.Redirect("~/Uploads/VesselVideos/" + lDownlodFileName, "blank", ""); } } catch (Exception) { string js1 = "alert('Videos Not Found.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "showModalJS", js1, true); return; } //string[] HeaderCaptions = { "Module Name", "Original File Name", "New File Name" }; //string[] DataColumnsName = { "text", "OriginalFileName", "FileName", }; //GridViewExportUtil.ShowExcel(dv.ToTable(), HeaderCaptions, DataColumnsName, "Vessel_Videos_File_List", "Rename your local files with file names as given below", ""); }
public void BindVesselDDL() { try { StringBuilder sbFilterFlt = new StringBuilder(); string VslFilter = ""; foreach (DataRow dr in DDLFleet.SelectedValues.Rows) { sbFilterFlt.Append(dr[0]); sbFilterFlt.Append(","); } DataTable dtVessel = BLL_LMS_Training.Get_VesselList(0, 0, 0, Convert.ToInt32(Session["USERCOMPANYID"]), "", Convert.ToInt32(Session["USERCOMPANYID"])); if (sbFilterFlt.Length > 1) { sbFilterFlt.Remove(sbFilterFlt.Length - 1, 1); VslFilter = string.Format("fleetCode in (" + sbFilterFlt.ToString() + ")"); dtVessel.DefaultView.RowFilter = VslFilter; } DDLVessel.DataSource = dtVessel; DDLVessel.DataTextField = "Vessel_name"; DDLVessel.DataValueField = "Vessel_id"; DDLVessel.DataBind(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserAccessValidation(); hdfProgram_Id.Value = Request.QueryString["Program_Id"]; bindProgramcategory(); if (UDFLib.ConvertToInteger(hdfProgram_Id.Value) > 0) { DataTable dtProgramDetails = BLL_LMS_Training.Get_ProgramDescriptionbyId(Convert.ToInt32(hdfProgram_Id.Value)); if (dtProgramDetails.Rows.Count > 0) { txtProgramName.Text = Convert.ToString(dtProgramDetails.Rows[0]["PROGRAM_Name"]); txtProgramDescription.Text = Convert.ToString(dtProgramDetails.Rows[0]["PROGRAM_DESCRIPTION"]); txtDuration.Text = Convert.ToString(dtProgramDetails.Rows[0]["DURATION"]); ddlProgramCategory.SelectedValue = Convert.ToString(dtProgramDetails.Rows[0]["PROGRAM_CATEGORY_ID"]); ViewState["OrgType"] = dtProgramDetails.Rows[0]["PROGRAM_CATEGORY_ID"]; ddlProgramCategory.Enabled = false; hdfProgramCategory.Value = ddlProgramCategory.SelectedValue; if (UDFLib.ConvertStringToNull(dtProgramDetails.Rows[0]["PROGRAM_TYPE"]) == "JIBETRAINING") { rdbVideo.Checked = true; } else { rdbTraining.Checked = true; } IsProgram_Scheduled = Convert.ToString(dtProgramDetails.Rows[0]["PROGRAM_SCHEDULED"]); } } else { btnNewChapter.Visible = false; } BindItemTreeView(); } // use javascript to open the add new chapter if program id is not null else create program and open chapter page if (UDFLib.ConvertToInteger(hdfProgram_Id.Value) > 0) { btnNewChapter.OnClientClick = "Show_Chapter_Details(null); return false"; btnNewChapter.Enabled = true; } if (IsProgram_Scheduled == "Y") { txtProgramName.Enabled = false; txtProgramDescription.Enabled = false; txtDuration.Enabled = false; ddlProgramCategory.Enabled = false; rdbVideo.Enabled = false; rdbTraining.Enabled = false; btnSaveProgram.Visible = false; btnNewChapter.Visible = false; } }
public void BindHistory() { if (ddlSyncDate.SelectedIndex <= 0) { chkHistory.Checked = false; btnDownloadSelected.Visible = true; return; } try { int is_Fetch_Count = ucCustomPagerProgram_List.isCountRecord; DateTime?HISDate = Convert.ToDateTime(ddlSyncDate.SelectedValue); DataSet ds_ProgramList_Scheduled = BLL_LMS_Training.GET_Programs_To_Sync_His(ucCustomPagerProgram_List.CurrentPageIndex, ucCustomPagerProgram_List.PageSize, HISDate, ref is_Fetch_Count); gvProgram_ListDetails.DataSource = ds_ProgramList_Scheduled.Tables[0]; gvProgram_ListDetails.DataBind(); ucCustomPagerProgram_List.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerProgram_List.BuildPager(); } catch (Exception) { chkHistory.Checked = false; btnDownloadSelected.Visible = true; return; } }
protected void btnNewChapter_Click(object sender, EventArgs e) { if (UDFLib.ConvertToInteger(txtDuration.Text) <= 0 && UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue) != 4) { string msgmodal = String.Format("alertm('dur')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", msgmodal, true); return; } if (UDFLib.ConvertToInteger(hdfProgram_Id.Value) == 0) { string lProgramType = "VESSELTRAINING"; if (rdbVideo.Checked) { lProgramType = "JIBETRAINING"; } hdfProgramCategory.Value = ddlProgramCategory.SelectedValue; hdfProgram_Id.Value = BLL_LMS_Training.Ins_Program_Details(null, UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue), txtProgramName.Text.Trim(), txtProgramDescription.Text.Trim(), UDFLib.ConvertIntegerToNull(txtDuration.Text.Trim()), lProgramType, Convert.ToInt32(Session["USERID"]), 1).ToString(); } String msgretv = String.Format("OpenPopupWindowBtnID('POP__ChapterDetails', 'Chapter Details','LMS_Chapter_Details.aspx?Chapter_ID=&Program_ID=" + hdfProgram_Id.Value + "&ProgramCategory=" + UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue) + "', 'popup', 840, 1000, null, null, false, false, true, false,'" + btnSearch.ClientID + "')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgret6v", msgretv, true); }
protected void btnSaveProgram_Click(object sender, EventArgs e) { string msgmodal; if (UDFLib.ConvertToInteger(txtDuration.Text) <= 0 && UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue) != 4) { msgmodal = String.Format("alertm('dur')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", msgmodal, true); return; } string lProgramType = "VESSELTRAINING"; if (rdbVideo.Checked) { lProgramType = "JIBETRAINING"; } hdfProgramCategory.Value = ddlProgramCategory.SelectedValue; hdfProgram_Id.Value = BLL_LMS_Training.Ins_Program_Details(UDFLib.ConvertIntegerToNull(hdfProgram_Id.Value), UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue), txtProgramName.Text.Trim(), txtProgramDescription.Text.Trim(), UDFLib.ConvertIntegerToNull(txtDuration.Text.Trim()), lProgramType, Convert.ToInt32(Session["USERID"]), 1).ToString(); BindItemTreeView(); if (UDFLib.ConvertIntegerToNull(hdfProgram_Id.Value) != null) { btnNewChapter.Visible = true; } ddlProgramCategory.Enabled = false; msgmodal = String.Format("alertm('sav')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", msgmodal, true); }
/* * Delete chapter if training is not sceduled. * The pageSize passed in GET_Program_List is -1 as it lists all program in table LMS_DTL_TRAINING_PROGRAM * * */ protected void btnDelete_Click(object sender, EventArgs e) { try { string IsProgram_Scheduled = string.Empty; int is_Fetch_Count = 1; DataTable dt = BLL_LMS_Training.GET_Program_List("", null, 1, -1, ref is_Fetch_Count).Tables[0]; if (dt.Rows.Count > 0) { DataRow[] dr = dt.Select("PROGRAM_ID='" + Convert.ToInt32(Request.QueryString["Program_Id"]) + "'"); if (dr.Length > 0) { if (dr[0].ItemArray[2].ToString() != "" && dr[0].ItemArray[3].ToString() != "") { string js = String.Format("alert('Chapter can not be deleted as Training schedule has already been planned for this chapter.'); " + "parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(this, this.GetType(), "ReloadParent", js, true); } else { int Result = BLL_LMS_Training.Del_TRAINING_CHAPTER(UDFLib.ConvertToInteger(ViewState["Chapter_Id"]), Convert.ToInt32(Session["USERID"])); // Response.Redirect("LMS_Chapter_Details.aspx"); string js = String.Format("alert('Chapter Deleted Successfully'); " + "parent.ReloadParent_ByButtonID();"); ScriptManager.RegisterStartupScript(this, this.GetType(), "ReloadParent", js, true); } } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int Vessel_Id = Convert.ToInt32(Request.QueryString["Vessel_Id"]); lblVessel.Text = Convert.ToString(Request.QueryString["Vessel_Short_Name"]); lblProgramName.Text = BLL_LMS_Training.Get_ProgramDescriptionbyId(Convert.ToInt32(Request.QueryString["Program_Id"])).Rows[0]["PROGRAM_Name"].ToString(); lblProgramDescription.Text = BLL_LMS_Training.Get_ProgramDescriptionbyId(Convert.ToInt32(Request.QueryString["Program_Id"])).Rows[0]["PROGRAM_DESCRIPTION"].ToString(); ds_TrgPrgDetails = BLL_LMS_Training.GET_Program_Summary(Convert.ToInt32(Request.QueryString["Program_Id"]), Convert.ToInt32(Request.QueryString["SCHEDULE_ID"]), Convert.ToInt32(Request.QueryString["Office_Id"]), Vessel_Id); lblRemarks.Text = ds_TrgPrgDetails.Tables[3].Rows[0]["Remarks"].ToString(); if (ds_TrgPrgDetails.Tables[3].Rows[0]["TRG_START_DATE"].ToString().Trim() != "") { lblTrgStDate.Text = UDFLib.ConvertDateToNull(ds_TrgPrgDetails.Tables[3].Rows[0]["TRG_START_DATE"].ToString()).Value.ToString("dd/MMM/yyyy"); } if (ds_TrgPrgDetails.Tables[3].Rows[0]["TRG_END_DATE"].ToString().Trim() != "") { lblTrgEnDate.Text = UDFLib.ConvertDateToNull(ds_TrgPrgDetails.Tables[3].Rows[0]["TRG_END_DATE"].ToString()).Value.ToString("dd/MMM/yyyy"); } if (ds_TrgPrgDetails.Tables[3].Rows[0]["Program_Category_Id"].ToString() == "4") { btndrillactivity.Visible = true; } else { btndrillactivity.Visible = false; } dtResourceItem = ds_TrgPrgDetails.Tables[1]; dtAttendees = ds_TrgPrgDetails.Tables[2]; gvTrainingProgram_Details.DataSource = ds_TrgPrgDetails.Tables[0]; gvTrainingProgram_Details.DataBind(); } //string msg1 = String.Format("$('.sailingInfo').SailingInfo();"); //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgshowdetails", msg1, true); }
protected void BindTrainerlist() { DataSet ds = BLL_LMS_Training.GET_Chapter_Trainer(UDFLib.ConvertToInteger(ViewState["Chapter_Id"])); gvTrainerRank.DataSource = ds; gvTrainerRank.DataBind(); }
protected void FillFBMNumber() { DataTable dt_FBM_Number = BLL_LMS_Training.GET_FBM_Number(); ddlFBMNumber.DataSource = dt_FBM_Number; ddlFBMNumber.DataBind(); ViewState["dt_FBM_Number"] = dt_FBM_Number; }
protected void btnSave_Click(object sender, EventArgs e) { BLL_LMS_Training.Update_Traing_ITem(Convert.ToInt32(ViewState["ItemID"]), ddlMenuLink.SelectedIndex < 0 ? null : ddlMenuLink.SelectedValue); String msgretv = String.Format("hideModal('divUrl');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgret6v", msgretv, true); BindTrainingItems(); }
protected void chkLstSelectVessel_DataBound(object sender, EventArgs e) { Dictionary <string, bool> VesselSelectedStates = (Dictionary <string, bool>)ViewState["VesselSelectedStates"]; int lVessel_ID = 0; for (int i = 0; i < chkLstSelectVessel.Items.Count; i++) { chkLstSelectVessel.Items[i].Selected = VesselSelectedStates[chkLstSelectVessel.Items[i].Value]; if (lVessel_ID == 0) { if (VesselSelectedStates[chkLstSelectVessel.Items[i].Value]) { lVessel_ID = Convert.ToInt32(chkLstSelectVessel.Items[i].Value); } } } if (lVessel_ID != 0) { DataTable dtMonths = BLL_LMS_Training.GET_EVALUATIONMONTHS(Convert.ToInt32(ViewState["Program_Id"]), lVessel_ID); DataTable dtRules = BLL_LMS_Training.GET_EVALUATIONRULES(Convert.ToInt32(ViewState["Program_Id"]), lVessel_ID); foreach (ListItem li in lstSelectedMonth.Items) { li.Selected = false; } //foreach (ListItem li in lstSelectedRules.Items) //{ // li.Selected = false; //} foreach (DataRow dr in dtMonths.Rows) { foreach (ListItem li in lstSelectedMonth.Items) { if (li.Value == dr["monthno"].ToString() && dr["active_status"].ToString() == "1") { li.Selected = true; } } } ddlDays.SelectedIndex = -1; foreach (DataRow dr in dtRules.Rows) { //foreach (ListItem li in lstSelectedRules.Items) //{ // if (li.Value == dr["Days"].ToString() && dr["active_status"].ToString() == "1") // li.Selected = true; //} if (UDFLib.ConvertIntegerToNull(dr["Days"].ToString()) <= 92 && dr["active_status"].ToString() == "1") { ddlDays.SelectedValue = dr["Days"].ToString(); } } } }
protected void btnDeleteItem_Click(object sender, EventArgs e) { int Id = Convert.ToInt32(hfNode.Value); BLL_LMS_Training.DEL_VESSEL_VIDEOS(Id, Convert.ToInt32(Session["USERID"])); string js = "hideModal('dvItem');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true); }
private Boolean Check_Duplicate_AttachmentFile(string AttachmentFile, string ITEM_NAME, ref string ITEM_PATH, ref int IsItemExist) { Boolean Result = false; if (BLL_LMS_Training.Check_Duplicate_AttachmentFile(AttachmentFile, ITEM_NAME, ref ITEM_PATH, ref IsItemExist) == 1) { Result = true; } return(Result); }
public void BindTrainingItems() { int is_Fetch_Count = ucCustomPagerAllStatus.isCountRecord; DataTable dt = BLL_LMS_Training.Get_ChapterDetails_List(null, UDFLib.ConvertStringToNull(txtSearchItemName.Text.Trim()), UDFLib.ConvertStringToNull(ddlItemType.SelectedIndex == 0 ? null : ddlItemType.SelectedItem.Text), ucCustomPagerAllStatus.CurrentPageIndex, ucCustomPagerAllStatus.PageSize, ref is_Fetch_Count).Tables[0]; gvTrainingItems.DataSource = dt; gvTrainingItems.DataBind(); ucCustomPagerAllStatus.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerAllStatus.BuildPager(); }
public void bindProgramcategory() { DataTable dt = BLL_LMS_Training.Get_Program_Category(); ddlProgramCategory.DataSource = dt; ddlProgramCategory.DataTextField = "Prg_Cat_Name"; ddlProgramCategory.DataValueField = "Prg_Cat_Id"; ddlProgramCategory.DataBind(); ddlProgramCategory.SelectedIndex = 2; }
protected void BindProgramItemInGrid() { string SearchProgramName = UDFLib.ConvertStringToNull(txtProgramName.Text); int is_Fetch_Count = ucCustomPagerProgram_List.isCountRecord; DataSet ds_ProgramList_Scheduled = BLL_LMS_Training.GET_Program_List(SearchProgramName, UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue), ucCustomPagerProgram_List.CurrentPageIndex, ucCustomPagerProgram_List.PageSize, ref is_Fetch_Count); gvProgram_ListDetails.DataSource = ds_ProgramList_Scheduled; gvProgram_ListDetails.DataBind(); ucCustomPagerProgram_List.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerProgram_List.BuildPager(); }
public void bindProgramcategory() { DataTable dt = BLL_LMS_Training.Get_Program_Category(); ddlProgramCategory.DataSource = dt; ddlProgramCategory.DataTextField = "Prg_Cat_Name"; ddlProgramCategory.DataValueField = "Prg_Cat_Id"; ddlProgramCategory.DataBind(); ddlProgramCategory.Items.Insert(0, new ListItem("--SELECT--", null)); ddlProgramCategory.SelectedIndex = 0; }
public void BindPrograms() { int is_Fetch_Count = ucCustomPagerProgram_List.isCountRecord; DataSet ds_ProgramList_Scheduled = BLL_LMS_Training.Get_Programs_To_Sync(ucCustomPagerProgram_List.CurrentPageIndex, ucCustomPagerProgram_List.PageSize, ref is_Fetch_Count); gvProgram_ListDetails.DataSource = ds_ProgramList_Scheduled.Tables[0]; gvProgram_ListDetails.DataBind(); ucCustomPagerProgram_List.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerProgram_List.BuildPager(); }
public void BindTrainingItems() { int is_Fetch_Count = ucCustomPagerAllStatus.isCountRecord; DataTable dt = BLL_LMS_Training.Get_Training_Items_List(UDFLib.ConvertStringToNull(txtSearchItemName.Text), ucCustomPagerAllStatus.CurrentPageIndex, ucCustomPagerAllStatus.PageSize, ref is_Fetch_Count, Convert.ToInt32(Session["USERID"].ToString())); dtlItemList.DataSource = dt; dtlItemList.DataBind(); ucCustomPagerAllStatus.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerAllStatus.BuildPager(); BindItemTreeView(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillItemType(); string IsProgram_Scheduled = null; Session["vsAttachmentData"] = null; Session["vsAttachmentFileName"] = null; DataTable dtChapterItemList = new DataTable(); dtChapterItemList.Columns.Add("ChapterItemId", typeof(int)); dtChapterItemList.PrimaryKey = new DataColumn[] { dtChapterItemList.Columns["ChapterItemId"] }; ViewState["dtChapterItemList"] = dtChapterItemList; ViewState["Chapter_Id"] = Request.QueryString["Chapter_Id"]; UserAccessValidation(); BindChapterItem(); BindTrainerlist(); DataTable dt = BLL_LMS_Training.Get_ProgramDescriptionbyId(Convert.ToInt32(Request.QueryString["Program_Id"])); if (dt.Rows.Count > 0) { lblProgramName.Text = dt.Rows[0]["PROGRAM_Name"].ToString(); IsProgram_Scheduled = dt.Rows[0]["Program_Scheduled"].ToString(); } if (UDFLib.ConvertIntegerToNull(ViewState["Chapter_Id"]) != null) { txtChapterName.Text = BLL_LMS_Training.Get_ChapterDescriptionbyId(Convert.ToInt32(ViewState["Chapter_Id"])); btnDelete.Enabled = true; } else { btnDelete.Enabled = false; } if (IsProgram_Scheduled == "Y") { txtChapterName.Enabled = false; btnDelete.Enabled = false; // btnAddNewItem.Enabled=false; // gvItemList.Enabled =false; gvTrainerRank.Enabled = false; //btnsaveandclose.Enabled =false; //btnCancel.Enabled = false; } if (UDFLib.ConvertIntegerToNull(Request.QueryString["ProgramCategory"]) == 4) { gvTrainerRank.Enabled = false; } } }
protected void Load_MonthsAndRules_ForVessel(int Program_Id, int Vessel_Id) { try { DataTable dtMonths = BLL_LMS_Training.GET_EVALUATIONMONTHS(Convert.ToInt32(ViewState["Program_Id"]), Vessel_Id); DataTable dtRules = BLL_LMS_Training.GET_EVALUATIONRULES(Convert.ToInt32(ViewState["Program_Id"]), Vessel_Id); foreach (ListItem li in lstSelectedMonth.Items) { li.Selected = false; } //foreach (ListItem li in lstSelectedRules.Items) //{ // li.Selected = false; //} foreach (DataRow dr in dtMonths.Rows) { foreach (ListItem li in lstSelectedMonth.Items) { if (li.Value == dr["monthno"].ToString() && dr["active_status"].ToString() == "1") { li.Selected = true; } } } foreach (DataRow dr in dtRules.Rows) { //foreach (ListItem li in lstSelectedRules.Items) //{ // if (li.Value == dr["Days"].ToString() && dr["active_status"].ToString() == "1") // li.Selected = true; //} if (UDFLib.ConvertIntegerToNull(dr["Days"].ToString()) <= 92) { ddlDays.SelectedValue = dr["Days"].ToString(); } } if (dtRules.Rows.Count == 0) { ddlDays.SelectedIndex = -1; } } catch { } }
protected void onDelete(object source, CommandEventArgs e) { int Result = BLL_LMS_Training.Del_Training_Items(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session["USERID"])); if (Result == 1) { String msgretv = String.Format("alert('Item deleted successfully.')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgret6v", msgretv, true); BindTrainingItems(); } else { String msgretv = String.Format("alert('Item can not be deleted because it has been assigned to program.')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgret6v", msgretv, true); } }
public void BindFleetDLL() { try { Int32 UserCompanyID = Convert.ToInt32(Session["USERCOMPANYID"].ToString()); Int32 VesselManager = UDFLib.ConvertToInteger(Session["VesselManager"]); DataTable FleetDT = BLL_LMS_Training.GetFleetList(UserCompanyID, VesselManager); DDLFleet.DataSource = FleetDT; DDLFleet.DataTextField = "Name"; DDLFleet.DataValueField = "code"; DDLFleet.DataBind(); } catch (Exception ex) { } }
protected void DownloadFiles(object sender, EventArgs e) { try { System.IO.StreamWriter excelDoc; string hdnRank = hdnCrewRank.Value.ToString(); hdnRank = hdnRank.Replace("/", "_"); hdnRank = hdnRank.Replace(" ", "_"); excelDoc = new System.IO.StreamWriter(System.IO.Path.Combine(Server.MapPath("~") + @"\" + "Uploads/Temp/", "CrewDetails_" + hdnRank + "_" + hdnFirstName.Value.ToString().Replace(" ", "_") + "_" + hdnStaffCode.Value.ToString() + ".xls")); string data = hdnCrewDetails.Value.ToString(); data = data.Replace("\"", "'"); excelDoc.Write(data); excelDoc.Close(); excelDoc.Dispose(); string zipFile = ""; List <string> zips = new List <string>(); zips.Add("CrewDetails_" + hdnRank + "_" + hdnFirstName.Value.ToString().Replace(" ", "_") + "_" + hdnStaffCode.Value.ToString() + ".xls"); foreach (GridViewRow row in grdCrewDoc.Rows) { if ((row.FindControl("chkSelect") as CheckBox).Checked) { string[] args = ((row.FindControl("lblFilePath") as Label).Text).Split(';'); string filePath = args[0]; string DestPath = Server.MapPath("~") + "\\Uploads\\Temp\\" + UDFLib.ReplaceSpecialCharacter(args[1]) + args[2]; File.Copy(filePath, DestPath, true); zips.Add(UDFLib.ReplaceSpecialCharacter(args[1]) + args[2]); } } if (zips.Count > 0) { zipFile = BLL_LMS_Training.RAR((Server.MapPath("~") + @"\" + "Uploads\\Temp\\"), zips); string DownloadFileName = hdnStaffCode.Value.ToString() + "_" + hdnFirstName.Value.ToString().Replace(" ", "_") + "_" + hdnRank + "_" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "_" + DateTime.Now.Hour + "h" + DateTime.Now.Minute + "m" + DateTime.Now.Second + "s" + ".rar"; if (File.Exists(Server.MapPath("~") + @"\" + "Uploads\\Temp\\" + zipFile)) { File.Move((Server.MapPath("~") + @"\" + "Uploads\\Temp\\" + zipFile), Server.MapPath("~") + @"\" + "Uploads\\Temp\\" + DownloadFileName); ResponseHelper.Redirect("~/Uploads/Temp/" + DownloadFileName, "blank", ""); } } } catch { } }
protected void ProgramDelete(object source, CommandEventArgs e) { int count = 0; BLL_LMS_Training.Del_TrainingProgram_Chk(Convert.ToInt32(e.CommandArgument.ToString()), ref count); if (count > 0) { string js = "alert('System cannot delete already scheduled program.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true); return; } else { int Result = BLL_LMS_Training.Del_TrainingProgram(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session["USERID"])); } BindProgramItemInGrid(); }
public void VideosAccessValidation() { int CurrentUserID = GetSessionUserID(); try { if (CurrentUserID != 1) { string exist = BLL_LMS_Training.Validate_SeaStaff(Convert.ToInt32(Session["USERID"].ToString())); if (exist == "0") { UserAccessValidation(); } } } catch (Exception) { } }
protected void Bind_Vessel_List() { DataTable dtVessel = BLL_LMS_Training.Get_VesselList(Convert.ToInt32(ViewState["Program_Id"]), 0, 0, Convert.ToInt32(Session["USERCOMPANYID"]), "", Convert.ToInt32(Session["USERCOMPANYID"])); Dictionary <string, bool> VesselSelectedStates = new Dictionary <string, bool>(); foreach (DataRow row in dtVessel.Rows) { VesselSelectedStates[row["Vessel_ID"].ToString()] = Convert.ToBoolean(row["Selected"]); } ViewState["VesselSelectedStates"] = VesselSelectedStates; chkLstSelectVessel.DataSource = dtVessel; chkLstSelectVessel.DataBind(); chkLstSelectVessel.Items.Insert(0, new ListItem("SELECT ALL", null)); string js = "LoadAfterCheckBox();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true); }
protected void BindProgramItemInGrid() { string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); string sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = ViewState["SORTDIRECTION"].ToString(); } int is_Fetch_Count = ucCustomPagerProgram_List.isCountRecord; DataSet ds_ProgramList_Scheduled = BLL_LMS_Training.Get_Scheduled_Program_List((DataTable)DDLFleet.SelectedValues, (DataTable)DDLVessel.SelectedValues, UDFLib.ConvertStringToNull(txtProgramName.Text.Trim()), UDFLib.ConvertDateToNull(txtDuedateFrom.Text.Trim()), UDFLib.ConvertDateToNull(txtDuedateTo.Text), UDFLib.ConvertIntegerToNull(ddlProgramCategory.SelectedValue), ucCustomPagerProgram_List.CurrentPageIndex, ucCustomPagerProgram_List.PageSize, sortbycoloumn, sortdirection, ref is_Fetch_Count); gvProgram_ListDetails.DataSource = ds_ProgramList_Scheduled; gvProgram_ListDetails.DataBind(); if (ucCustomPagerProgram_List.isCountRecord == 1) { ucCustomPagerProgram_List.CountTotalRec = is_Fetch_Count.ToString(); ucCustomPagerProgram_List.BuildPager(); } }