private void Start() { if (ComboHolder == null) { for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).name == "ComboHolder") { ComboHolder = transform.GetChild(i).gameObject; break; } } } if (Collection == null) { Collection = GameObject.FindGameObjectWithTag("BendingSystem").GetComponent <ComboCollection>(); } if (EarthCombos.Length == 0) { EarthCombos = Collection.EarthCombos.ToArray(); } for (int i = 0; i < RockNames.Count; i++) { RockList.Add(RockNames[i], RockGameObjects[i]); } }
private void OnEnable() { combosUpdated = false; collection = GameObject.FindGameObjectWithTag("BendingSystem").GetComponent <ComboCollection>(); if (collection == null) { Debug.Log("Null"); } if (standardBackgroundColor == null) { standardBackgroundColor = GUI.backgroundColor; } if (standardColor == null) { standardColor = GUI.color; } if (AirCombos == null) { AirCombos = new List <ComboAir>(); } if (FireEditor == null) { AirEditor = CreateInstance("ComboAirEditor") as ComboAirEditor; } if (WaterCombos == null) { WaterCombos = new List <ComboWater>(); } if (WaterEditor == null) { WaterEditor = CreateInstance("ComboWaterEditor") as ComboWaterEditor; } if (EarthCombos == null) { EarthCombos = new List <ComboEarth>(); } if (EarthEditor == null) { EarthEditor = CreateInstance("ComboEarthEditor") as ComboEarthEditor; } if (FireCombos == null) { FireCombos = new List <ComboFire>(); } if (FireEditor == null) { FireEditor = CreateInstance("ComboFireEditor") as ComboFireEditor; } }
protected override ControlCollection CreateControlsInstance() { _items = new ComboCollection<ItemCuadroCombinado> { ItemsBase = base.Items }; _items.UpdateItems += UpdateItems; return base.CreateControlsInstance(); }
protected override ControlCollection CreateControlsInstance() { items = new ComboCollection<ComboBoxItem> { ItemsBase = base.Items }; items.UpdateItems += ItemsUpdateItems; return base.CreateControlsInstance(); }
public ActionResult LabourDetails(string fence, string bid, string id = "0") { int editBid = Int32.Parse(id); BILabour BiLabour = new BILabour(); bid = Convert.ToString(Session["BidId"]); fence = Convert.ToString(Session["FenceTypeID"]); //fence = "23"; //bid = "4062"; if (string.IsNullOrWhiteSpace(bid) || string.IsNullOrWhiteSpace(fence)) { return(View("detail/selectheight")); } ViewBag.FenceType = Convert.ToInt32(fence); ViewBag.BIDID = Convert.ToInt32(bid); //Load Main Labour Section List <LabourDetails> labourList = new List <Models.DBO.LabourDetails>(); List <LabourLabels> labourLabels = ProjectDAL.getLabourLabels(Convert.ToString(ViewBag.FenceType)); var LabourByBid = ProjectDAL.getLabourDetailsByBid(bid); if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[0].Rows.Count > 0) { foreach (var item in labourLabels) { List <LabourDdls> labourDdls = new List <LabourDdls>(); if (item.ElemLabelText.ToLower().Contains("dig")) { labourDdls = ProjectDAL.getLabourDetails(null, item.FieldLbrTypeID, bid); } else { labourDdls = ProjectDAL.getLabourDetails(Convert.ToString(ViewBag.FenceType), item.FieldLbrTypeID, bid); } var selectedData = LabourByBid.Tables[0].AsEnumerable().Where(i => i.Field <Int32>("FieldLbrTypeID") == item.FieldLbrTypeID); if (selectedData.Count() > 0) { foreach (DataRow labour in selectedData) { LabourDetails labourDetails = new Models.DBO.LabourDetails(); int selectedLabour = labour != null?labour.Field <int>("FieldLbrDtlsID") : 0; labourDetails.UOM = labour != null?labour.Field <string>("FieldLbrUom") : string.Empty; labourDetails.Quantity = Convert.ToInt32(labour != null ? labour.Field <decimal>("Qty") : 0); labourDetails.labourDdlForUI = new SelectList(labourDdls, "FieldLbrDtlsID", "FieldLbrDesc", selectedLabour); labourDetails.BIDID = labour != null?labour.Field <int>("BIDID") : ViewBag.BIDID; labourDetails.labourLabel = item.ElemLabelText; labourDetails.BIDLaborItemsID = labour != null?labour.Field <int>("BIDLaborItemsID") : 0; labourList.Add(labourDetails); } } else { LabourDetails labourDetails = new Models.DBO.LabourDetails(); labourDetails.labourDdlForUI = new SelectList(labourDdls, "FieldLbrDtlsID", "FieldLbrDesc"); labourDetails.BIDID = ViewBag.BIDID; labourDetails.labourLabel = item.ElemLabelText; labourList.Add(labourDetails); } } } else { foreach (var item in labourLabels) { List <LabourDdls> labourDdls = new List <LabourDdls>(); if (item.ElemLabelText.ToLower().Contains("dig")) { labourDdls = ProjectDAL.getLabourDetails(null, item.FieldLbrTypeID, bid); } else { labourDdls = ProjectDAL.getLabourDetails(Convert.ToString(ViewBag.FenceType), item.FieldLbrTypeID, bid); } LabourDetails labourDetails = new Models.DBO.LabourDetails(); labourDetails.BIDID = ViewBag.BIDID; labourDetails.labourLabel = item.ElemLabelText; labourDetails.labourDdlForUI = new SelectList(labourDdls, "FieldLbrDtlsID", "FieldLbrDesc"); labourList.Add(labourDetails); } } BiLabour.LabourDetails = labourList; //Load for all dropdowns in Labour except MainLabour DataSet labourCombos = ProjectDAL.getComboForLabourSections(bid); List <LabourDetails> addnList = new List <Models.DBO.LabourDetails>(); List <LabourDdls> additionalDropdown = ComboCollection.AdditionalLabourCombo(labourCombos.Tables[0]); var mainlabourids = LabourByBid.Tables[0].AsEnumerable().Select(i => i.Field <Int32>("FieldLbrTypeID")).ToArray(); var additionalLabourids = LabourByBid.Tables[0].AsEnumerable().Select(i => i.Field <int>("FieldLbrTypeID")).Except(mainlabourids); //Extras for Additional Labour int extraLabour = 5; if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[0].Rows.Count > 0) { //foreach (var ids in additionalLabourids) //{ var selectedData = LabourByBid.Tables[0].AsEnumerable().Where(i => i.Field <Int32>("FieldLbrTypeID") == 24); if (selectedData.Count() > 0) { foreach (DataRow labour in selectedData) { LabourDetails labourDetails = new Models.DBO.LabourDetails(); int selectedLabour = labour != null?labour.Field <int>("FieldLbrDtlsID") : 0; labourDetails.UOM = labour != null?labour.Field <string>("FieldLbrUom") : string.Empty; labourDetails.Quantity = Convert.ToInt32(labour != null ? labour.Field <decimal>("Qty") : 0); labourDetails.labourDdlForUI = new SelectList(additionalDropdown, "FieldLbrDtlsID", "FieldLbrDesc", labour.Field <int>("FieldLbrDtlsID")); labourDetails.BIDID = labour != null?labour.Field <int>("BIDID") : ViewBag.BIDID; labourDetails.labourLabel = labourDetails.labourLabel = "Extras"; labourDetails.BIDLaborItemsID = labour != null?labour.Field <int>("BIDLaborItemsID") : 0; addnList.Add(labourDetails); } } //} } extraLabour = extraLabour - addnList.Count; for (int i = 0; i < extraLabour; i++) { LabourDetails labourDetails = new Models.DBO.LabourDetails(); labourDetails.BIDID = ViewBag.BIDID; labourDetails.labourLabel = "Extras"; labourDetails.labourDdlForUI = new SelectList(additionalDropdown, "FieldLbrDtlsID", "FieldLbrDesc"); addnList.Add(labourDetails); } BiLabour.AddlnLabourDetails = addnList; BiLabour.ReviewLabourDetails = new List <ReviewLabour>(); if (LabourByBid.Tables.Count > 4 && LabourByBid.Tables[5].Rows.Count > 0) { foreach (var item in LabourByBid.Tables[5].AsEnumerable()) { var source = new ReviewLabour(); source.BIDID = Convert.ToString(item["BIDID"]); source.FieldLbrDtlsID = Convert.ToString(item["FieldLbrDtlsID"]); source.FieldLbrDesc = Convert.ToString(item["FieldLbrDesc"]); source.Qty = Convert.ToInt32(item["Qty"]); source.MhsEa = Convert.ToDecimal(item["MhsEa"]); source.MhsTotal = Convert.ToDecimal(item["MhsTotal"]); source.CrewPayEa = Convert.ToDecimal(item["CrewPayEa"]); source.CrewPayTotal = Convert.ToDecimal(item["CrewPayTotal"]); source.SubPayEa = Convert.ToDecimal(item["SubPayEa"]); source.SubPayTotal = Convert.ToDecimal(item["SubPayTotal"]); BiLabour.ReviewLabourDetails.Add(source); } } //Load for all combos var postTypes = ComboCollection.PostTypesCombo(labourCombos.Tables[1]); var concreteType = ComboCollection.ConcreteTypesCombo(labourCombos.Tables[2]); var roundFactors = ComboCollection.RoundFactorCombo(); var othercost = ComboCollection.OtherCostCombo(labourCombos.Tables[3]); var crewsize = ComboCollection.CrewSizeCombo(labourCombos.Tables[4]); var equipcost = ComboCollection.EquipmentCostsCombos(labourCombos.Tables[5]); BiLabour.ConcreteDetails = new List <BID07_Concrete>(); if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[1].Rows.Count > 0) { foreach (var item in LabourByBid.Tables[1].AsEnumerable()) { var source = new BID07_Concrete(); source.BIDID = Convert.ToInt32(item["BIDID"]); source.CONCID = Convert.ToInt32(item["CONCID"]); source.PstTypId = Convert.ToString(item["PstTypId"]); source.ConcreteType = Convert.ToString(item["ConcreteType"]); source.HoleQty = Convert.ToInt32(item["HoleQty"]); source.HoleDia = Convert.ToInt32(item["HoleDia"]); source.HoleDepth = Convert.ToInt32(item["HoleDepth"]); source.RoundFactor = Convert.ToInt32(item["RoundFactor"]); source.PostTypeDdlForUI = new SelectList(postTypes, "PstTypID", "PostType", source.PstTypId); source.ConcreteTypeDdlForUI = new SelectList(concreteType, "PartNum", "PartDescription", source.ConcreteType); source.RoundFactorDdlForUI = new SelectList(roundFactors, "Value", "Text", source.RoundFactor); BiLabour.ConcreteDetails.Add(source); } } else { BiLabour.ConcreteDetails.Add(new BID07_Concrete { BIDID = ViewBag.BIDID, PostTypeDdlForUI = new SelectList(postTypes, "PstTypID", "PostType"), ConcreteTypeDdlForUI = new SelectList(concreteType, "PartNum", "PartDescription"), RoundFactorDdlForUI = new SelectList(roundFactors, "Value", "Text") }); } BiLabour.BidOtherCosts = new List <BID08_OtherCosts>(); if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[2].Rows.Count > 0) { foreach (var item in LabourByBid.Tables[2].AsEnumerable()) { var source = new BID08_OtherCosts { BIDID = Convert.ToInt32(item["BIDID"]), OtherCostID = Convert.ToInt32(item["OtherCostID"]), OtherCostTypeID = Convert.ToInt32(item["OtherCostTypeID"]), Qty = Convert.ToDecimal(item["Qty"]), Cost = Convert.ToDecimal(item["Cost"]), OtherCostTypeDdlForUI = new SelectList(othercost, "OtherCostTypeID", "OtherCostType", Convert.ToInt32(item["OtherCostTypeID"])) }; BiLabour.BidOtherCosts.Add(source); } } else { BiLabour.BidOtherCosts.Add(new BID08_OtherCosts { BIDID = ViewBag.BIDID, OtherCostTypeDdlForUI = new SelectList(othercost, "OtherCostTypeID", "OtherCostType") }); } BiLabour.BidCrewProfile = new List <BID06_CrewProfile>(); if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[3].Rows.Count > 0) { foreach (var item in LabourByBid.Tables[3].AsEnumerable()) { var source = new BID06_CrewProfile { BIDID = Convert.ToInt32(item["BIDID"]), BIDDefineCrewID = Convert.ToInt32(item["BIDDefineCrewID"]), CrewPositionID = Convert.ToInt32(item["CrewPositionID"]), HeadCount = Convert.ToInt32(item["HeadCount"]), CrewPositionDdlForUI = new SelectList(crewsize, "CrewPositionID", "CrewPosition", Convert.ToInt32(item["CrewPositionID"])) }; BiLabour.BidCrewProfile.Add(source); } } else { BiLabour.BidCrewProfile.Add(new BID06_CrewProfile { BIDID = ViewBag.BIDID, CrewPositionDdlForUI = new SelectList(crewsize, "CrewPositionID", "CrewPosition") }); } BiLabour.BidEquipmentBurden = new List <BID09_EquipmentBurden>(); if (LabourByBid.Tables.Count > 0 && LabourByBid.Tables[4].Rows.Count > 0) { foreach (var item in LabourByBid.Tables[4].AsEnumerable()) { var source = new BID09_EquipmentBurden { BIDID = Convert.ToInt32(item["BIDID"]), EquipBurdID = Convert.ToInt32(item["EquipBurdID"]), EquipCostID = Convert.ToInt32(item["EquipCostID"]), Qty = Convert.ToInt32(item["Qty"]), EquipCostDdlForUI = new SelectList(equipcost, "EquipCostID", "EquipName", Convert.ToInt32(item["EquipCostID"])) }; BiLabour.BidEquipmentBurden.Add(source); } } else { BiLabour.BidEquipmentBurden.Add(new BID09_EquipmentBurden { BIDID = ViewBag.BIDID, EquipCostDdlForUI = new SelectList(equipcost, "EquipCostID", "EquipName") }); } return(View(BiLabour)); }
private void OnGUI() { if (collection == null) { collection = GameObject.FindGameObjectWithTag("BendingSystem").GetComponent <ComboCollection>(); } LoadLists(); if (!combosUpdated) { UpdateOldCombos(); } drawTopMenu(); GUI.backgroundColor = standardBackgroundColor; EditorGUILayout.BeginHorizontal("box"); showBackground = false; if (bendingTypeIdx == 0) { if (AirCombos.Count > 0) { showBackground = true; } } else if (bendingTypeIdx == 1) { if (WaterCombos.Count > 0) { showBackground = true; } } else if (bendingTypeIdx == 2) { if (EarthCombos.Count > 0) { showBackground = true; } } else if (bendingTypeIdx == 3) { if (FireCombos.Count > 0) { showBackground = true; } } if (showBackground) { GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f); EditorGUILayout.BeginVertical("box", GUILayout.MaxWidth(250)); scrollPos = GUILayout.BeginScrollView(scrollPos, false, true); drawSidebar(); EditorGUILayout.EndScrollView(); EditorGUILayout.EndVertical(); GUI.backgroundColor = standardBackgroundColor; } GUILayout.Space(20); if (selectedAirCombo != null || selectedWaterCombo != null || selectedEarthCombo != null || selectedFireCombo != null) { GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f, 1); EditorGUILayout.BeginVertical("box"); drawSelectedComboPart(); EditorGUILayout.EndVertical(); GUI.backgroundColor = standardBackgroundColor; } EditorGUILayout.EndHorizontal(); SaveLists(); }