/// <summary> /// Date Created: 14/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Vehicle Type Capacity in ListView /// </summary> private void BindServiceTypeDurationListView(int iContractID, Int16 iLoadType) { List <ContractServiceTypeDuration> listServiceTypeDuration = new List <ContractServiceTypeDuration>(); if (iLoadType == 0) { if (Session["ContractSafeguardTypeDuration"] != null) { listServiceTypeDuration = (List <ContractServiceTypeDuration>)Session["ContractSafeguardTypeDuration"]; } } else { SafeguardBLL.ServiceTypeGet(iContractID, GlobalCode.Field2Int(uoHiddenFieldVendorId.Value), true, 1); if (Session["ContractSafeguardTypeDuration"] != null) { listServiceTypeDuration = (List <ContractServiceTypeDuration>)Session["ContractSafeguardTypeDuration"]; } } uoListViewServiceTypeDuration.DataSource = listServiceTypeDuration; uoListViewServiceTypeDuration.DataBind(); }
/// <summary> /// Date Created: 14/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Seaport in ListView /// List of Seaport in Contract /// </summary> private void BindSeaportListView(int iVendorID, Int16 iLoadType) { List <Seaport> list = new List <Seaport>(); uoListViewSeaport.DataSource = null; if (iLoadType == 0) { if (Session["VendorSeaportExists"] != null) { list = (List <Seaport>)Session["VendorSeaportExists"]; uoListViewSeaport.DataSource = list; } } else { SafeguardBLL.SafeguardVendorsSeaportGet(0, GlobalCode.Field2TinyInt(uoDropDownListSeaportFilter.SelectedValue), uoTextBoxSeaportFilter.Text.Trim(), true, 1); if (Session["VendorSeaportExists"] != null) { list = (List <Seaport>)Session["VendorSeaportExists"]; uoListViewSeaport.DataSource = list; } } uoListViewSeaport.DataBind(); }
//protected void uoSafeguardContractList_ItemDeleting(object sender, ListViewDeleteEventArgs e) //{ //} #endregion #region Functions /// <summary> /// Date Created: 18/08/2011 /// Created By: Gabriel Oquialda /// (description) Get vendor vehicle contract List<ContractVehicle> /// --------------------------------------------------- /// Date Modified: 16/Aug/2013 /// Modified By: Josephine Gad /// (description) Change DataTable to void and put it in Session /// </summary> /// </summary> public void GetVendorSafeguardContractList() { //DataView dv = null; ////DataTable dt = BLL.ContractBLL.vendorVehicleGetContractList(uoTextBoxVehicle.Text, GlobalCode.Field2String(Session["UserName"])); //DataTable dt = BLL.ContractBLL.GetVendorVehicleBranchContractByBranchID(Request.QueryString["vmId"]); //if (dt.Rows.Count > 0) //{ // ucLabelVehicle.Text = dt.Rows[0]["colVendorBranchNameVarchar"].ToString() + " Contract List"; // dv = (DataView)dt.DefaultView; // dv.Sort = upDropDownListSort.SelectedValue + " desc"; // //dv.Sort = upDropDownListSort.SelectedValue + ", colVendorBranchNameVarchar"; //", CONTRACTNAME"; // uoSafeguardContractList.DataSource = dv; // uoSafeguardContractList.DataBind(); //} List <ContractSafeguard> list = new List <ContractSafeguard>(); list = SafeguardBLL.GetVendorSafeguardBranchContractByBranchID(GlobalCode.Field2String(Request.QueryString["vmId"])); if (list.Count > 0) { ucLabelSafeguard.Text = list[0].SafeguardName + " Contract List"; } else { ucLabelSafeguard.Text = "Contract List"; } uoSafeguardContractList.DataSource = list; uoSafeguardContractList.DataBind(); }
/// Date Created: 12/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Airport and Seaport private void BindServiceType(int iContractID, Int16 iLoadType) { List <ServiceType> listServiceType = new List <ServiceType>(); //List<ContractSafeguardTypeDuration> listVehicleTypeCapacity = new List<ContractSafeguardTypeDuration>(); if (iLoadType == 0) { SafeguardBLL.ServiceTypeGet(iContractID, GlobalCode.Field2Int(uoHiddenFieldVendorId.Value), false, 0); } BindSafeguardTypeDropDown(0, iLoadType); BindServiceTypeDurationListView(0, iLoadType); }
/// <summary> /// Date Created: 14/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Vehicle Type Capacity in ListView /// </summary> private void BindSafeguardTypeDropDown(int iContractID, Int16 iLoadType) { List <ServiceType> listServiceType = new List <ServiceType>(); //List<ContractServiceTypeDuration> listServiceTypeDuration = new List<ContractServiceTypeDuration>(); //if (Session["ContractSafeguardTypeDuration"] != null) //{ // listServiceTypeDuration = (List<ContractServiceTypeDuration>)Session["ContractSafeguardTypeDuration"]; //} if (iLoadType == 0) { if (Session["ServiceType"] != null) { listServiceType = (List <ServiceType>)Session["ServiceType"]; } } else { SafeguardBLL.ServiceTypeGet(iContractID, GlobalCode.Field2Int(uoHiddenFieldVendorId.Value), false, 1); if (Session["ServiceType"] != null) { listServiceType = (List <ServiceType>)Session["ServiceType"]; } } //listServiceType.RemoveAll(a => listServiceType.Exists(b => a.ServiceTypeName == listServiceTypeDuration[])); //if (listServiceType.Count > 0) //{ // for (int i = 0; i < listServiceTypeDuration.Count; i++) // { // listServiceTypeDuration.RemoveAll(a => listServiceTypeDuration.Exists(b => a.ServiceType == listServiceType[i].ServiceTypeName)); // } //} listServiceType = listServiceType.OrderBy(a => a.ServiceTypeName).ToList(); uoDropDownListServiceType.Items.Clear(); uoDropDownListServiceType.DataSource = listServiceType; uoDropDownListServiceType.DataTextField = "ServiceTypeName"; uoDropDownListServiceType.DataValueField = "ServiceTypeID"; uoDropDownListServiceType.DataBind(); uoDropDownListServiceType.Items.Insert(0, new ListItem("--Select Service Type--", "0")); }
/// <summary> /// Date Created: 23/08/2011 /// Created By: Marco Abejar /// (description) Load all details /// </summary> protected void Page_Load(object sender, EventArgs e) { //Label SFStatus = (Label)Master.FindControl("uclabelStatus"); //SFStatus.Visible = false; if (GlobalCode.Field2String(Session["UserName"]) == "") { Response.Redirect("~/Login.aspx"); } Session["strPrevPage"] = Request.RawUrl; if (!IsPostBack) { uoHiddenFieldContractID.Value = GlobalCode.Field2Int(Request.QueryString["cID"]).ToString(); uoHiddenFieldVendorId.Value = Request.QueryString["vmId"]; uoHiddenFieldUserName.Value = GlobalCode.Field2String(Session["UserName"]); int iContractID = GlobalCode.Field2Int(uoHiddenFieldContractID.Value); if (iContractID > 0) { SafeguardBLL.GetVendorSafeguardContractByContractID(uoHiddenFieldContractID.Value, uoHiddenFieldVendorId.Value, 0); } else { Session["ContractServiceDetailsAmt"] = null; Session["ContractSafeguardAttachment"] = null; } BindCurrency(); BindSafeguardBranch(iContractID); if (iContractID == 0) { BindServiceType(0, 0); } else { BindServiceType(iContractID, 0); BindAttachmentListView(iContractID, 0); } textChangeToUpperCase(uoDropDownListServiceType); BindServiceTypeDuration(); BindContractServiceDetailsList(); } Session["UserName"] = uoHiddenFieldUserName.Value; uoButtonAddService.Text = uoHiddenFieldDetail.Value == "0" ? "Add" : "Save"; }
/// <summary> /// Date Created: 12/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Seaport in Drop Down List /// List of Seaport to be added in Contract /// </summary> private void BindSeaportDroDown(int iVendorID, Int16 iLoadType) { List <Seaport> list = new List <Seaport>(); uoDropDownListSeaport.Items.Clear(); if (iLoadType == 0) { if (Session["VendorSeaportNOTExists"] != null) { list = (List <Seaport>)Session["VendorSeaportNOTExists"]; uoDropDownListSeaport.DataSource = list; uoDropDownListSeaport.DataTextField = "SeaportName"; uoDropDownListSeaport.DataValueField = "SeaportID"; uoDropDownListSeaport.DataBind(); } } else { SafeguardBLL.SafeguardVendorsSeaportGet(iVendorID, GlobalCode.Field2TinyInt(uoDropDownListSeaportFilter.SelectedValue), uoTextBoxSeaportFilter.Text.Trim(), false, 1); if (Session["VendorSeaportNOTExists"] != null) { list = (List <Seaport>)Session["VendorSeaportNOTExists"]; uoDropDownListSeaport.DataSource = list; uoDropDownListSeaport.DataTextField = "SeaportName"; uoDropDownListSeaport.DataValueField = "SeaportID"; uoDropDownListSeaport.DataBind(); } } if (list.Count == 1) { if (uoDropDownListSeaport.Items.FindByValue(list[0].SeaportID.ToString()) != null) { uoDropDownListSeaport.SelectedValue = list[0].SeaportID.ToString(); } } uoDropDownListSeaport.Items.Insert(0, new ListItem("--Select Seaport--", "0")); }
/// Date Created: 12/Aug/2013 /// Created By: Josephine Gad /// (description) Bind Airport and Seaport private void BindAirportSeaport(int iVendorID, Int16 iLoadType) { //if (iVendorID == 0) //{ //VendorMaintenanceBLL.VehicleVendorsAirportGet(0, // GlobalCode.Field2TinyInt(uoDropDownListAirportFilter.SelectedValue), // uoTextBoxAirportFilter.Text.Trim(), // false, 0); SafeguardBLL.SafeguardVendorsSeaportGet(iVendorID, GlobalCode.Field2TinyInt(uoDropDownListSeaportFilter.SelectedValue), uoTextBoxSeaportFilter.Text.Trim(), false, 0); //} //BindAirportDroDown(iContractID, iLoadType); //BindAirportListView(iContractID, iLoadType); BindSeaportDroDown(iVendorID, iLoadType); BindSeaportListView(iVendorID, iLoadType); }
/// <summary> /// Date Created: 27/07/2011 /// Created By: Gabriel Oquialda /// (description) Save new vendor /// ------------------------------------------- /// Date Modified: 05/Aug/2013 /// Created By: Josephine Gad /// (description) Change endorMaintenanceBLL.vendorMaintenanceInsert to endorMaintenanceBLL.VehicleVendorsSave /// Add Audit Trail in the same script /// Remove the separate Audit Trail /// </summary> protected void uoButtonSave_Click(object sender, EventArgs e) { DataTable dt = null; try { string strLogDescription; string strFunction = "uoButtonSave_Click"; DateTime currentDate = CommonFunctions.GetCurrentDateTime(); if (GlobalCode.Field2Int(uoHiddenFieldSafeguardVendorIdInt.Value) == 0) { strLogDescription = "Safeguard vendor added."; } else { strLogDescription = "Safeguard vendor updated."; } string vendorPrimaryId = GlobalCode.Field2Int(uoHiddenFieldSafeguardVendorIdInt.Value).ToString();//(Session["vendorPrimaryId"].ToString() == null) ? "0" : Session["vendorPrimaryId"].ToString(); dt = new DataTable(); dt.Columns.Add("VehicleTypeID", typeof(int)); //DataRow r; //HiddenField hiddenFieldVehicleTypeID; //foreach (ListViewItem item in uoListViewVehicleType.Items) //{ // r = dt.NewRow(); // hiddenFieldVehicleTypeID = (HiddenField)item.FindControl("uoHiddenFieldVehicleTypeID"); // r[0] = GlobalCode.Field2Int(hiddenFieldVehicleTypeID.Value); // dt.Rows.Add(r); //} DataTable dtSeaport = null; List <Seaport> listSeaport = GetSeaportList(); var lSeaport = (from a in listSeaport select new { SeaportID = a.SeaportID }).ToList(); dtSeaport = getDataTable(lSeaport); SafeguardBLL.SafeguardVendorsSave(GlobalCode.Field2Int(vendorPrimaryId), uoTextBoxVendorName.Text, GlobalCode.Field2Int(uoDropDownListCountry.SelectedValue), GlobalCode.Field2Int(uoDropDownListCity.SelectedValue), uoTextBoxContactNo.Text, uoTextBoxFaxNo.Text, uoTextBoxContactPerson.Text, uoTextBoxVendorAddress.Text, uoTextBoxEmailCc.Text, uoTextBoxEmailTo.Text, uoTextBoxWebsite.Text, GlobalCode.Field2String(Session["UserName"]), strLogDescription, strFunction, Path.GetFileName(Request.Path), CommonFunctions.GetDateTimeGMT(currentDate), DateTime.Now, dt, dtSeaport); OpenParentPage(); } catch (Exception ex) { AlertMessage(ex.Message); } finally { if (dt != null) { dt.Dispose(); } } }
/// <summary> /// Date Created: 01/08/2011 /// Created By: Gabriel Oquialda /// (decription) Loads vendor information /// ----------------------------------------------- /// Date Created: 01/08/2011 /// Created By: Gabriel Oquialda /// (decription) Loads vendor information /// ----------------------------------------------- /// Date Modifed: 06/Aug/2013 /// Created By: Josephine Gad /// (decription) Load Vendor using VendorMaintenanceBLL.VehicleVendorsGetByID /// Use Sessions instead of DataTable /// </summary> private void vendorInfoLoad(Int16 iLoadType) { if (Request.QueryString["vmId"].ToString() != "0") { SafeguardBLL.SafeguardVendorsGetByID(GlobalCode.Field2Int(uoHiddenFieldSafeguardVendorIdInt.Value), iLoadType); List <VendorSafeguardDetails> listSafeguardDetails = new List <VendorSafeguardDetails>(); if (Session["SafeguardVendorDetails"] != null) { listSafeguardDetails = (List <VendorSafeguardDetails>)Session["SafeguardVendorDetails"]; if (listSafeguardDetails.Count > 0) { uoTextBoxCity.Text = GlobalCode.Field2String(Session["SafeguardVendorCityFilter"]); uoTextBoxVendorName.Text = listSafeguardDetails[0].VendorName; uoTextBoxVendorAddress.Text = listSafeguardDetails[0].Address; uoTextBoxWebsite.Text = listSafeguardDetails[0].Website; uoTextBoxEmailTo.Text = listSafeguardDetails[0].EmailTo; uoTextBoxEmailCc.Text = listSafeguardDetails[0].EmailCC; vendorCountryLoad(); if (uoDropDownListCountry.Items.FindByValue(GlobalCode.Field2String(listSafeguardDetails[0].CountryID)) != null) { uoDropDownListCountry.SelectedValue = GlobalCode.Field2String(listSafeguardDetails[0].CountryID); } vendorCityLoad(0, uoDropDownListCountry.SelectedValue); if (uoDropDownListCity.Items.FindByValue(GlobalCode.Field2String(listSafeguardDetails[0].CityID)) != null) { uoDropDownListCity.SelectedValue = GlobalCode.Field2String(listSafeguardDetails[0].CityID); } uoTextBoxContactNo.Text = listSafeguardDetails[0].ContactNo; uoTextBoxContactPerson.Text = listSafeguardDetails[0].ContactPerson; uoTextBoxFaxNo.Text = listSafeguardDetails[0].FaxNo; //BindVendorTypeList(0); //BindVehicleTypeList(0); } } else { uoTextBoxCity.Text = ""; uoTextBoxVendorName.Text = ""; uoTextBoxVendorAddress.Text = ""; uoTextBoxWebsite.Text = ""; uoTextBoxEmailTo.Text = ""; uoTextBoxEmailCc.Text = ""; vendorCountryLoad(); vendorCityLoad(0, uoDropDownListCountry.SelectedValue); uoTextBoxContactNo.Text = ""; uoTextBoxContactPerson.Text = ""; uoTextBoxFaxNo.Text = ""; //uoListViewVehicleType.DataSource = null; //uoListViewVehicleType.DataBind(); //BindVehicleTypeList(1); } } else { uoTextBoxCity.Text = ""; uoTextBoxVendorName.Text = ""; uoTextBoxVendorAddress.Text = ""; uoTextBoxWebsite.Text = ""; uoTextBoxEmailTo.Text = ""; uoTextBoxEmailCc.Text = ""; vendorCountryLoad(); vendorCityLoad(0, uoDropDownListCountry.SelectedValue); uoTextBoxContactNo.Text = ""; uoTextBoxContactPerson.Text = ""; uoTextBoxFaxNo.Text = ""; //uoListViewVehicleType.DataSource = null; //uoListViewVehicleType.DataBind(); //BindVehicleTypeList(1); } }
/// Date Modified: 12/Aug/2013 /// Modified By: Josephine Gad /// (description) Bind all details in 1 function /// use list instead of DataTable /// /// /// </summary> private void BindSafeguardBranch(int iContractID) { //DataTable dt = new DataTable(); try { if (iContractID == 0) { SafeguardBLL.SafeguardVendorsGetByID(GlobalCode.Field2Int(Request.QueryString["vmId"]), 0); List <VendorSafeguardDetails> listVehicleDetails = new List <VendorSafeguardDetails>(); if (Session["SafeguardVendorDetails"] != null) { listVehicleDetails = (List <VendorSafeguardDetails>)Session["SafeguardVendorDetails"]; if (listVehicleDetails.Count > 0) { uoTextBoxContractTitle.Text = listVehicleDetails[0].VendorName + " Contract"; //uoTextBoxVendorBranch.Text = listVehicleDetails[0].VendorName; //uoTextBoxCountry.Text = listVehicleDetails[0].VendorSafeguardDetails; //uoTextBoxCity.Text = listVehicleDetails[0].CityName; } } } else { List <ContractSafeguardDetails> list = new List <ContractSafeguardDetails>(); list = (List <ContractSafeguardDetails>)Session["SafeguardVendorDetails"]; if (list.Count > 0) { uoTextBoxContractTitle.Text = list[0].ContractName; //uoTextBoxVendorBranch.Text = list[0].VehicleName; //uoTextBoxCountry.Text = list[0].CountryName; //uoTextBoxCity.Text = list[0].CityName; uoTextBoxRemarks.Text = list[0].Remarks; if (list[0].ContractDateStart != null) { uoTextBoxContractStartDate.Text = list[0].ContractDateStart; } if (list[0].ContractDateEnd != null) { uoTextBoxContractEndDate.Text = list[0].ContractDateEnd; } if (list[0].RCCLAcceptedDate != null) { uoTextBoxRCCLDateAccepted.Text = list[0].RCCLAcceptedDate; } if (list[0].VendorAcceptedDate != null) { uoTextBoxVendorDateAccepted.Text = list[0].VendorAcceptedDate; } uotextboxRCCLRep.Text = list[0].RCCLPersonnel; uotextboxVendorRep.Text = list[0].VendorPersonnel; uoDropDownListCurrency.SelectedValue = GlobalCode.Field2String(list[0].CurrencyID); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Date Created: 18/08/2011 /// Created By: Gabriel Oquialda /// (description) Get vendor vehicle contract detail /// </summary> public void vendorSafeguardGetContractDetail() { DataTable dt = null; DataTable dtLV = null; DataTable dtSR = null; try { if (uoHiddenFieldContractId.Value == "") { uoHiddenFieldContractId.Value = "0"; } SafeguardBLL.GetVendorSafeguardContractByContractID(uoHiddenFieldContractId.Value, uoHiddenFieldBranchId.Value, 0); List <ContractSafeguardDetails> listDetails = new List <ContractSafeguardDetails>(); listDetails = (List <ContractSafeguardDetails>)Session["SafeguardVendorDetails"]; dt = getDataTable(listDetails); if (dt.Rows.Count > 0) { ucLabelContractStatus.Text = dt.Rows[0]["ContractStatus"].ToString(); //uoTextBoxVendorCode.Text = dt.Rows[0]["BranchID"].ToString(); uotextboxRCCLRep.Text = dt.Rows[0]["RCCLPersonnel"].ToString(); uotextboxVendorRep.Text = dt.Rows[0]["VendorPersonnel"].ToString(); uoTextBoxTelNo.Text = dt.Rows[0]["ContactNo"].ToString(); uoTextBoxEmailTo.Text = dt.Rows[0]["EmailTo"].ToString(); uoTextBoxEmailCc.Text = dt.Rows[0]["EmailCc"].ToString(); uoTextBoxContractTitle.Text = dt.Rows[0]["ContractName"].ToString(); string strContractStartDate = (dt.Rows[0]["ContractDateStart"].ToString().Length > 0) ? String.Format("{0:MM/dd/yyyy HH:mm}", Convert.ToDateTime(dt.Rows[0]["ContractDateStart"].ToString())) : ""; string strContractEndDate = (dt.Rows[0]["ContractDateEnd"].ToString().Length > 0) ? String.Format("{0:MM/dd/yyyy HH:mm}", Convert.ToDateTime(dt.Rows[0]["ContractDateEnd"].ToString())) : ""; uoTextBoxContractStartDate.Text = strContractStartDate; uoTextBoxContractEndDate.Text = strContractEndDate; uoTextBoxRemarks.Text = dt.Rows[0]["Remarks"].ToString(); List <ContractServiceDetailsAmt> list = new List <ContractServiceDetailsAmt>(); list = GetContractSafeguardDetailsList(); uoGridViewVehicle.DataSource = getDataTable(list);; uoGridViewVehicle.DataBind(); } } catch (Exception ex) { throw ex; } finally { if (dt != null) { dt.Dispose(); } if (dtLV != null) { dtLV.Dispose(); } if (dtSR != null) { dtSR.Dispose(); } } }
private void ViewAttachment() { _contractSafeguardAttachments = SafeguardBLL.GetSafeguardContractAttachment(Convert.ToInt32(uoHiddenFieldContractId.Value)); uoGridViewHotelContractAttachment.DataSource = _contractSafeguardAttachments; uoGridViewHotelContractAttachment.DataBind(); }