protected void RadComboShipmentKey_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { int id = int.Parse(this.RadComboShipmentKey.SelectedValue.Split(',')[0]); int shipmentid = int.Parse(this.RadComboShipmentKey.SelectedValue.Split(',')[1]); if (id > 0 && shipmentid > 0) { ViewState["DistributorClientAddress"] = id; ViewState["ShipmentID"] = shipmentid; DistributorClientAddressBO objDistributorClientAddress = new DistributorClientAddressBO(); objDistributorClientAddress.ID = id; objDistributorClientAddress.GetObject(); ShipmentModeBO objShipmentMode = new ShipmentModeBO(); objShipmentMode.ID = shipmentid; objShipmentMode.GetObject(); this.txtShipTo.Text = objDistributorClientAddress.CompanyName; this.txtShipmentMode.Text = objShipmentMode.Name; string state = (objDistributorClientAddress.State != null) ? objDistributorClientAddress.Suburb : string.Empty; this.lblShipmentKeyAddress.Text = objDistributorClientAddress.CompanyName + " , " + objDistributorClientAddress.Address + " , " + objDistributorClientAddress.Suburb + " " + state + " , " + objDistributorClientAddress.objCountry.ShortName + " , " + objDistributorClientAddress.PostCode; this.populateInvoiceOrders(0, id, true, shipmentid, false); } }
private void PopulateDataGrid() { { // Hide Controls this.dvEmptyContent.Visible = false; this.dvDataContent.Visible = false; this.dvNoSearchResult.Visible = false; // Search text string searchText = this.txtSearch.Text.ToLower().Trim(); // Populate Items ShipmentModeBO objShipmentMode = new ShipmentModeBO(); List <ShipmentModeBO> lstShipmentMode = new List <ShipmentModeBO>(); if ((searchText != string.Empty) && (searchText != "search")) { lstShipmentMode = (from o in objShipmentMode.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList() where o.Name.ToLower().Contains(searchText) || (o.Description != null && o.Description.ToLower().Contains(searchText)) select o).ToList(); } else { lstShipmentMode = objShipmentMode.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList(); } if (lstShipmentMode.Count > 0) { this.RadGridShipmentMode.AllowPaging = (lstShipmentMode.Count > this.RadGridShipmentMode.PageSize); this.RadGridShipmentMode.DataSource = lstShipmentMode; this.RadGridShipmentMode.DataBind(); Session["ShipmentModeDetails"] = lstShipmentMode; this.dvDataContent.Visible = true; } else if ((searchText != string.Empty && searchText != "search")) { this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty); this.dvDataContent.Visible = true; this.dvNoSearchResult.Visible = true; } else { this.dvEmptyContent.Visible = true; this.btnAddShipmentMode.Visible = false; } this.RadGridShipmentMode.Visible = (lstShipmentMode.Count > 0); } }
private void ProcessForm(int shipmentmodeId, bool isDelete) { try { using (TransactionScope ts = new TransactionScope()) { ShipmentModeBO objShipmentMode = new ShipmentModeBO(this.ObjContext); if (shipmentmodeId > 0) { //Update Data objShipmentMode.ID = shipmentmodeId; objShipmentMode.GetObject(); objShipmentMode.Name = this.txtShipmentModeName.Text; objShipmentMode.Description = this.txtDescription.Text; if (isDelete) { objShipmentMode.Delete(); } } else { objShipmentMode.Name = this.txtShipmentModeName.Text; objShipmentMode.Description = this.txtDescription.Text; objShipmentMode.Add(); } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { //throw ex; } }
protected void RadGridShipmentMode_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is ShipmentModeBO) { ShipmentModeBO objShipmentMode = (ShipmentModeBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objShipmentMode.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objShipmentMode.ID.ToString()); //linkDelete.Visible = (objShipmentMode.OrdersWhereThisIsShipmentMode.Count == 0 || // objShipmentMode.ReservationsWhereThisIsShipmentMode.Count == 0); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "Order", "ShipmentMode", objShipmentMode.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; } } }