/// <summary> /// Load genral attribute /// </summary> /// <param name="mAttributeSetInstanceId"></param> /// <param name="vadms_AttributeSet_ID"></param> /// <param name="windowNo"></param> /// <param name="ctx"></param> /// <returns></returns> public AttributesObjects LoadInit(int mAttributeSetInstanceId, int vadms_AttributeSet_ID, int windowNo, Ctx ctx, HttpServerUtilityBase objBase) { AttributesObjects obj = new AttributesObjects(); MGenAttributeSet aset = null; MGenAttribute[] attributes = null; // Get Model var _masi = new MGenAttributeSetInstance(ctx, mAttributeSetInstanceId, null); _masi.SetC_GenAttributeSet_ID(vadms_AttributeSet_ID); if (_masi == null) { // log.Severe("No Model for M_AttributeSetInstance_ID=" + _M_AttributeSetInstance_ID + ", M_Product_ID=" + _M_Product_ID); return(null); } /* set context to client side */ ctx.SetContext(windowNo, "C_GenAttributeSet_ID", _masi.GetC_GenAttributeSet_ID()); // Get Attribute Set aset = _masi.GetMGenAttributeSet(); // Product has no Attribute Set if (aset == null) { obj.IsReturnNull = true; obj.Error = "GenAttributeNoAttributeSet"; return(obj); } attributes = aset.GetCGenAttributes(false); for (int i = 0; i < attributes.Length; i++) { MGenAttribute a = attributes[i]; MGenAttributeInstance ins = a.GetCGenAttributeInstance(mAttributeSetInstanceId); MGenAttributeValue[] v = null; if (MGenAttribute.ATTRIBUTEVALUETYPE_List.Equals(a.GetAttributeValueType())) { v = a.GetMAttributeValues(); } attributesList[a] = new KeyValuePair <MGenAttributeInstance, MGenAttributeValue[]>(ins, v); } //Row 0 obj.tableStucture = "<table style='width: 100%;'><tr>"; for (int i = 0; i < attributes.Length; i++) { obj.tableStucture = AddAttributeLine(attributes[i], false, windowNo, obj, i); } // Attrribute Set Instance Description //Column 1 var label1 = Msg.Translate(ctx, "Description"); obj.tableStucture += "<td>"; obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id='description_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label1 + "</label>"; obj.tableStucture += "</td>"; //Column 2 obj.tableStucture += "<td>"; obj.tableStucture += "<input style='width: 100%;' readonly id='txtDescription_" + windowNo + "' value='" + (_masi.GetDescription()) + "' class='VIS_Pref_pass' type='text'>"; obj.tableStucture += "</td>"; obj.tableStucture += "</tr>"; //Add Ok and Cancel button //Last row obj.tableStucture += "<tr>"; obj.tableStucture += "<td style='text-align:right' colspan='2'>"; obj.tableStucture += "<button style='margin-bottom:0px;margin-top:0px; float:right' type='button' class='VIS_Pref_btn-2' style='float: right;' id='btnCancel_" + windowNo + "' role='button' aria-disabled='false'>" + Msg.GetMsg(ctx, "Cancel") + "</button>"; obj.tableStucture += "<button style='margin-bottom:0px;margin-top:0px; float:right; margin-right: 10px;' type='button' class='VIS_Pref_btn-2' style='float: right; margin-right: 10px;' id='btnOk_" + windowNo + "' role='button' aria-disabled='false'>" + Msg.GetMsg(ctx, "ok") + "</button>"; obj.tableStucture += "</td>"; obj.tableStucture += "</tr>"; obj.tableStucture += "</table>"; if (obj.ControlList != null) { if (obj.ControlList.Length > 1) { obj.ControlList = obj.ControlList.Substring(0, obj.ControlList.Length - 1); } ; } return(obj); }