private TreeNode getTreeNode(EquEquipmentType typeInstance) { return(new TreeNode(typeInstance.Name, typeInstance.Id) { Expanded = new bool?(true) }); }
private void BindChildNode(TreeNode parentNode) { System.Collections.Generic.List <EquEquipmentType> list = ( from t in this.equTypeSer where t.ParentId == parentNode.Value orderby t.Code select t).ToList <EquEquipmentType>(); if (list.Count <EquEquipmentType>() > 0) { using (System.Collections.Generic.List <EquEquipmentType> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { EquEquipmentType current = enumerator.Current; TreeNode treeNode = new TreeNode(); treeNode.Text = current.Name; treeNode.Value = current.Id; if (base.Request["id"] == treeNode.Value) { treeNode.Select(); } parentNode.ChildNodes.Add(treeNode); this.BindChildNode(treeNode); } return; } } if (!string.IsNullOrEmpty(this.noChildIdList)) { this.noChildIdList += ","; } this.noChildIdList += parentNode.Value; }
private EquEquipmentType GetModel(EquEquipmentType type) { string text = string.Empty; text = string.Format("{0:D3}", System.Convert.ToInt32(this.txtEquipmentNo.Text.Trim())); string code = this.parentCode + text; string name = this.txtEquipmentName.Text.Trim(); if (type == null) { type = new EquEquipmentType(); type.Id = this.id; if (string.IsNullOrEmpty(this.parentId)) { type.ParentId = null; } else { type.ParentId = this.parentId; } } type.Code = code; type.No = System.Convert.ToInt32(text); type.Name = name; return(type); }
private TreeNode getTreeNode(EquEquipmentType typeInstance) { return(new TreeNode(typeInstance.Name, string.Format("{0}#{1}", typeInstance.Id, "设备类型节点")) { Expanded = new bool?(true) }); }
private void InitPage() { if (!string.IsNullOrEmpty(this.id)) { EquEquipmentType byId = this.equTypeSer.GetById(this.id); if (byId != null) { this.txtEquipmentName.Text = byId.Name; this.txtEquipmentNo.Text = byId.No.ToString(); } } }
private void getTypeId() { string typeName = string.Empty; switch (this.equEnum) { case EquStyleEnum.EquGrap: typeName = "抓扬式挖泥船"; break; case EquStyleEnum.EquCutter: typeName = "绞吸式挖泥船"; break; case EquStyleEnum.EquTrailing: typeName = "耙吸式挖泥船"; break; case EquStyleEnum.EquBarge: typeName = "自航泥驳"; break; case EquStyleEnum.EquLoader: typeName = "装载机"; break; case EquStyleEnum.EquExcvavtor: typeName = "挖掘机"; break; case EquStyleEnum.EquAirAndDrill: typeName = "空压机-钻孔机"; break; case EquStyleEnum.EquMix: typeName = "搅拌运输车"; break; case EquStyleEnum.EquDump: typeName = "自卸车"; break; } EquEquipmentType equEquipmentType = ( from equTypeInfo in this.equType where equTypeInfo.Name.Equals(typeName) select equTypeInfo).FirstOrDefault <EquEquipmentType>(); if (equEquipmentType != null) { this.typeId = equEquipmentType.Id; } }
protected void btnDel_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(); EquEquipmentService source = new EquEquipmentService(); foreach (GridViewRow gridViewRow in this.gvwEquipmentType.Rows) { CheckBox checkBox = gridViewRow.FindControl("chkBox") as CheckBox; if (checkBox.Checked) { list.Add(checkBox.ToolTip); } } try { foreach (string equTypeId in list) { System.Collections.Generic.List <EquEquipmentType> list2 = ( from t in this.equTypeSer where t.ParentId == equTypeId select t).ToList <EquEquipmentType>(); if (list2.Count > 0) { base.RegisterScript("top.ui.show('请先删除子项!')"); return; } System.Collections.Generic.List <EquEquipment> list3 = ( from es in source where es.TypeId == equTypeId select es).ToList <EquEquipment>(); if (list3.Count > 0) { base.RegisterScript("top.ui.show('请先删除对应的设备!')"); return; } EquEquipmentType byId = this.equTypeSer.GetById(equTypeId); this.equTypeSer.Delete(byId); } base.RegisterScript("window.location.href='../../Equ/Type/EquipmentTypeList.aspx?id=" + this.trvwEquipmentType.SelectedValue + "'"); } catch { base.RegisterScript("top.ui.show('删除失败!')"); } }
private void getEquTypeNodes(string typeId, TreeNode parentNode) { System.Collections.Generic.IList <EquEquipmentType> targetType = this.getTargetType(false, typeId); if (targetType != null && targetType.Count > 0) { using (System.Collections.Generic.IEnumerator <EquEquipmentType> enumerator = targetType.GetEnumerator()) { while (enumerator.MoveNext()) { EquEquipmentType current = enumerator.Current; TreeNode treeNode = this.getTreeNode(current); this.getEquTypeNodes(current.Id, treeNode); parentNode.ChildNodes.Add(treeNode); } return; } } this.addEquipmentNode(typeId, parentNode); }
protected override void OnInit(System.EventArgs e) { if (!string.IsNullOrEmpty(base.Request["parentId"])) { this.parentId = base.Request["parentId"]; EquEquipmentType equEquipmentType = ( from t in this.equTypeSer where t.Id == this.parentId select t).FirstOrDefault <EquEquipmentType>(); this.parentCode = equEquipmentType.Code; } if (!string.IsNullOrEmpty(base.Request["id"])) { this.id = base.Request["id"].ToString(); } else { this.id = System.Guid.NewGuid().ToString(); } base.OnInit(e); }
private void BindEquInfo() { new ResResourceService(); EquEquipmentTypeService equEquipmentTypeService = new EquEquipmentTypeService(); EquEquipment byId = this.equSer.GetById(this.id); this.lblEquCode.Text = byId.EquCode; this.lblEquName.Text = byId.EquName; EquEquipmentType byId2 = equEquipmentTypeService.GetById(byId.TypeId); if (byId2 != null) { this.lblEquTypeName.Text = byId2.Name; } if (byId.SupplierId.HasValue) { XPMBasicContactCorpService xPMBasicContactCorpService = new XPMBasicContactCorpService(); XPMBasicContactCorp byId3 = xPMBasicContactCorpService.GetById(byId.SupplierId.Value); if (byId3 != null) { this.lblCorpName.Text = byId3.CorpName; } } this.lblFactoryNumber.Text = byId.FactoryNumber; this.lblFactoryDate.Text = this.ConvertToString(byId.FactoryDate); this.lblPurchaseDate.Text = this.ConvertToString(byId.PurchaseDate); this.lblDepreciationRate.Text = byId.DepreciationRate.ToString("0.000"); this.lblPeriodicVertification.Text = byId.PeriodicVertification; this.lblDurableYear.Text = byId.DurableYear; this.lblPurchasePrice.Text = byId.PurchasePrice.ToString("0.000"); this.lblState.Text = this.GetStateOrProperty("EquState", byId.State); this.lblEquProperty.Text = this.GetStateOrProperty("EquProperty", byId.EquProperty); this.lblReceiptNo.Text = byId.ReceiptNo; if (equEquipmentTypeService.IsShip(byId.TypeId)) { this.trShip.Style["Display"] = "Block"; this.lblShipLength.Text = byId.ShipLength; this.lblShipWidth.Text = byId.ShipWidth; this.lblShipCapacity.Text = byId.ShipCapaticy; EquShipTechnicalParasService equShipTechnicalParasService = new EquShipTechnicalParasService(); System.Collections.Generic.IList <EquShipTechnicalParas> equShipTechParasByEquId = equShipTechnicalParasService.GetEquShipTechParasByEquId(this.id); if (equShipTechParasByEquId == null || equShipTechParasByEquId.Count <= 0) { goto IL_352; } if (equShipTechParasByEquId.Count == 1) { this.lblOtherShipInfo.Text = equShipTechParasByEquId.First <EquShipTechnicalParas>().OtherShipInfo; } int num = 0; Label label = null; using (System.Collections.Generic.IEnumerator <EquShipTechnicalParas> enumerator = equShipTechParasByEquId.GetEnumerator()) { while (enumerator.MoveNext()) { EquShipTechnicalParas current = enumerator.Current; if (num == 0) { this.lblOtherShipInfo.Text = string.Format("参数{0}: {1}", (num + 1).ToString(), current.OtherShipInfo); label = (this.plOtherShips.FindControl("lblOtherShipInfo") as Label); } else { Literal literal = new Literal(); literal.Text = "<br />"; this.plOtherShips.Controls.Add(literal); Label label2 = new Label(); label2.ID = label.ID + num.ToString(); label2.Text = string.Format("参数{0}: {1}", num + 1, current.OtherShipInfo); this.plOtherShips.Controls.Add(label2); } num++; } goto IL_352; } } this.trShip.Style["Display"] = "None"; IL_352: this.lblMiddleInspectDate.Text = this.ConvertToString(byId.MiddleInspectDate); this.lblYearInspectDate.Text = this.ConvertToString(byId.YearInspectDate); this.lblOtherCredentials.Text = byId.OtherCredentials; this.lblAnnex.Text = FileView.FilesBind(1901, byId.Id); this.lblNotes.Text = byId.Note; }
private void BindEquInfo() { if (this.action == "edit") { new ResResourceService(); EquEquipment byId = this.equSer.GetById(this.id); this.txtEquipmentCode.Text = byId.EquCode; this.txtEquName.Text = byId.EquName; this.hfldEquTypeId.Value = byId.TypeId; EquEquipmentType byId2 = this.typeService.GetById(byId.TypeId); if (byId2 != null) { this.txtEquTypeName.Value = byId2.Name; } this.ddlProperty.SelectedValue = byId.EquProperty.ToString(); this.txtPurchasePrice.Text = byId.PurchasePrice.ToString("0.000"); this.txtDepreciationRate.Text = string.Format("{0}%", byId.DepreciationRate.ToString("0.000")); this.txtPurchaseDate.Text = (byId.PurchaseDate.HasValue ? byId.PurchaseDate.Value.ToString("yyyy-MM-dd") : string.Empty); this.txtDurableYear.Text = byId.DurableYear; this.txtFactoryNumber.Text = byId.FactoryNumber; this.ddlState.SelectedValue = byId.State.ToString(); if (byId.SupplierId.HasValue) { this.hfldCorpId.Value = byId.SupplierId.Value.ToString(); XPMBasicContactCorpService xPMBasicContactCorpService = new XPMBasicContactCorpService(); XPMBasicContactCorp byId3 = xPMBasicContactCorpService.GetById(byId.SupplierId.Value); if (byId3 != null) { this.txtCorpName.Value = byId3.CorpName; } } this.txtFactoryDate.Text = (byId.FactoryDate.HasValue ? byId.FactoryDate.Value.ToString("yyyy-MM-dd") : string.Empty); this.txtPeriodicVertification.Text = byId.PeriodicVertification; this.txtReceiptNo.Text = byId.ReceiptNo; if (this.typeService.IsShip(byId.TypeId)) { this.txtShipLength.Text = byId.ShipLength; this.txtShipWidth.Text = byId.ShipWidth; this.txtShipCapacity.Text = byId.ShipCapaticy; EquShipTechnicalParasService equShipTechnicalParasService = new EquShipTechnicalParasService(); System.Collections.Generic.IList <EquShipTechnicalParas> equShipTechParasByEquId = equShipTechnicalParasService.GetEquShipTechParasByEquId(this.id); if (equShipTechParasByEquId != null && equShipTechParasByEquId.Count > 0) { foreach (EquShipTechnicalParas current in equShipTechParasByEquId) { if (!string.IsNullOrEmpty(this.hfldOtherShipsInfo.Value.Trim())) { HiddenField expr_2CB = this.hfldOtherShipsInfo; expr_2CB.Value += "|"; } HiddenField expr_2E6 = this.hfldOtherShipsInfo; expr_2E6.Value += current.OtherShipInfo; } } } this.txtMiddleInspectDate.Text = (byId.MiddleInspectDate.HasValue ? byId.MiddleInspectDate.Value.ToString("yyyy-MM-dd") : string.Empty); this.txtYearInspectDate.Text = (byId.YearInspectDate.HasValue ? byId.YearInspectDate.Value.ToString("yyyy-MM-dd") : string.Empty); this.txtOtherCredentials.Text = byId.OtherCredentials; this.txtNotes.Text = byId.Note; this.SetShipInfoVisible(); } else { this.id = System.Guid.NewGuid().ToString(); } this.hdfEquId.Value = this.id; }
protected void btnSave_Click(object sender, System.EventArgs e) { string str = string.Empty; try { str = string.Format("{0:D3}", System.Convert.ToInt32(this.txtEquipmentNo.Text.Trim())); } catch { base.RegisterScript("top.ui.alert('设备类别编号必须是整数!')"); return; } try { string equCode = this.parentCode + str; string equName = this.txtEquipmentName.Text.Trim(); System.Collections.Generic.List <EquEquipmentType> list = ( from t in this.equTypeSer where t.Code == equCode select t).ToList <EquEquipmentType>(); System.Collections.Generic.List <EquEquipmentType> list2 = ( from t in this.equTypeSer where t.Name == equName select t).ToList <EquEquipmentType>(); if (!string.IsNullOrEmpty(base.Request["id"])) { EquEquipmentType byId = this.equTypeSer.GetById(this.id); if (byId.Code != equCode && list.Count > 0) { base.RegisterScript("top.ui.show('设备类别编号已存在,请重新定义!')"); } else { if (byId.Name != equName && list2.Count > 0) { base.RegisterScript("top.ui.show('设备类别名称已存在,请重新定义!')"); } else { EquEquipmentType model = this.GetModel(byId); this.equTypeSer.Update(model); string str2 = "/Equ/Type/EquipmentTypeList.aspx?id=" + this.parentId; string message = "top.ui.closeWin(); \ntop.ui.show( '更新成功'); \ntop.ui.reloadTab({url: '" + str2 + "'}); \n"; base.RegisterScript(message); } } } else { if (list.Count > 0) { base.RegisterScript("top.ui.show('设备类别编号已存在,请重新定义!')"); } else { if (list2.Count > 0) { base.RegisterScript("top.ui.show('设备类别名称已存在,请重新定义!')"); } else { EquEquipmentType model2 = this.GetModel(null); this.equTypeSer.Add(model2); string str3 = "/Equ/Type/EquipmentTypeList.aspx?id=" + base.Request["parentId"]; string message2 = "top.ui.closeWin(); \ntop.ui.show( '添加成功'); \ntop.ui.reloadTab({url: '" + str3 + "'}); \n"; base.RegisterScript(message2); } } } } catch { base.RegisterScript("top.ui.show('添加失败!')"); } }