Example #1
0
        /// <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);
        }
        //Dictionary<MAttribute, KeyValuePair<MAttributeInstance, MAttributeValue[]>> attributesList = new Dictionary<MAttribute, KeyValuePair<MAttributeInstance, MAttributeValue[]>>(4);

        public AttributesObjects LoadInit(int _M_AttributeSetInstance_ID, int _M_Product_ID, bool _productWindow, int windowNo, Ctx ctx, int AD_Column_ID, int window_ID, bool IsSOTrx, string IsInternalUse)
        {
            AttributesObjects obj = new AttributesObjects();

            MAttributeSet aset = null;

            MAttribute[] attributes = null;
            //	Get Model
            MAttributeSetInstance _masi = MAttributeSetInstance.Get(ctx, _M_AttributeSetInstance_ID, _M_Product_ID);
            MProduct _prd = new MProduct(ctx, _M_Product_ID, null);

            if (_masi == null)
            {
                obj.IsReturnNull = true;
                obj.Error        = "No Model for M_AttributeSetInstance_ID=" + _M_AttributeSetInstance_ID + ", M_Product_ID=" + _M_Product_ID;
                return(obj);
            }

            //	Get Attribute Set
            aset = _masi.GetMAttributeSet();
            //	Product has no Attribute Set
            if (aset == null)
            {
                obj.IsReturnNull = true;
                obj.Error        = "PAttributeNoAttributeSet";
                return(obj);
            }

            obj.MAttributeSetID = aset.Get_ID();

            //	Product has no Instance Attributes
            if (!_productWindow && !aset.IsInstanceAttribute())
            {
                obj.Error = "NPAttributeNoInstanceAttribute=";
                return(obj);
            }

            if (_productWindow)
            {
                attributes = aset.GetMAttributes(false);
            }
            else
            {
                attributes = aset.GetMAttributes(true);
            }

            //Row 0
            obj.tableStucture = "<table style='width: 100%;'><tr>";
            if (_productWindow)
            {
                for (int i = 0; i < attributes.Length; i++)
                {
                    obj.tableStucture = AddAttributeLine(attributes[i], _M_AttributeSetInstance_ID, true, false, windowNo, obj, i);
                }
            }
            else
            {
                var newEditContent = VAdvantage.Utility.Util.CleanMnemonic(Msg.GetMsg(ctx, "NewRecord"));
                if (_M_AttributeSetInstance_ID > 0)
                {
                    newEditContent = VAdvantage.Utility.Util.CleanMnemonic(Msg.GetMsg(ctx, "EditRecord"));
                }
                //column 1
                obj.tableStucture += "<td style = 'visibility: hidden;'>";
                obj.tableStucture += "<input type='checkbox' id='chkNewEdit_" + windowNo + "' ><label  class='VIS_Pref_Label_Font'>" + newEditContent + "</label>";
                obj.tableStucture += "</td>";

                //column 2
                obj.tableStucture += "<td>";
                obj.tableStucture += "<button type='button' style='margin-bottom: 10px;' id='btnSelect_" + windowNo + "' role='button' aria-disabled='false'><img style='float: left;' src='~/Areas/VIS/Images/base/Delete24.PNG' /><span style='float: left;margin-left: 5px;margin-right: 5px;' >" + VAdvantage.Utility.Util.CleanMnemonic(Msg.GetMsg(ctx, "SelectExisting")) + "</span></button>";
                obj.tableStucture += "</td>";
                obj.tableStucture += "</tr>";

                //Change 20-May-2015 Bharat
                var label = Msg.Translate(ctx, "AttrCode");
                obj.tableStucture += "<tr>";
                obj.tableStucture += "<td>";
                obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id=lot_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label + "</label>";
                obj.tableStucture += "</td>";
                //column 2
                obj.tableStucture += "<td>";
                obj.tableStucture += "<input  style='width: 100%;' id='txtAttrCode_" + windowNo + "' value='' class='VIS_Pref_pass' type='text'>";
                obj.tableStucture += "</td>";

                obj.tableStucture += "</tr>";

                //Row 1
                obj.tableStucture += "<tr>";
                //	All Attributes
                for (int i = 0; i < attributes.Length; i++)
                {
                    obj.tableStucture = AddAttributeLine(attributes[i], _M_AttributeSetInstance_ID, true, false, windowNo, obj, i);
                }
            }

            //	Lot
            if (!_productWindow && aset.IsLot())
            {
                //column 1
                var label = Msg.Translate(ctx, "Lot");
                obj.tableStucture += "<td>";
                obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id=lot_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label + "</label>";
                obj.tableStucture += "</td>";
                //column 2
                obj.tableStucture += "<td>";
                obj.tableStucture += "<input  style='width: 100%;' id='txtLotString_" + windowNo + "' value='" + _masi.GetLot() + "' class='VIS_Pref_pass' type='text'>";
                obj.tableStucture += "</td>";

                obj.tableStucture += "</tr>";

                //Row 1
                if (!IsSOTrx || IsInternalUse == "N" || window_ID == 191 || window_ID == 140)
                {
                    obj.tableStucture += "<tr>";
                    //column 1
                    label              = Msg.Translate(ctx, "M_Lot_ID");
                    obj.tableStucture += "<td>";
                    obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id=M_Lot_ID_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label + "</label>";
                    obj.tableStucture += "</td>";


                    String sql = "SELECT M_Lot_ID, Name "
                                 + "FROM M_Lot l "
                                 + "WHERE EXISTS (SELECT M_Product_ID FROM M_Product p "
                                 + "WHERE p.M_AttributeSet_ID=" + _masi.GetM_AttributeSet_ID()
                                 + " AND p.M_Product_ID=l.M_Product_ID)";

                    KeyNamePair[] data = DB.GetKeyNamePairs(sql, true);
                    //column 2
                    obj.tableStucture += "<td>";
                    obj.tableStucture += "<select style='width: 100%;margin-bottom: 10px;' id='cmbLot_" + windowNo + "'>";
                    obj.tableStucture += " <option selected value='" + 0 + "' > </option>";
                    for (int i = 1; i < data.Length; i++)
                    {
                        if (Convert.ToInt32(data[i].Key) == _masi.GetM_Lot_ID())
                        {
                            obj.tableStucture += " <option selected value='" + data[i].Key + "' >" + data[i].Name + "</option>";
                        }
                        else
                        {
                            obj.tableStucture += " <option value='" + data[i].Key + "' >" + data[i].Name + "</option>";
                        }
                    }

                    obj.tableStucture += "</select>";
                    obj.tableStucture += "</td>";
                    obj.tableStucture += "</tr>";


                    //Row 2
                    obj.tableStucture += "<tr>";

                    //	New Lot Button
                    if (_masi.GetMAttributeSet().GetM_LotCtl_ID() != 0)
                    {
                        if (MRole.GetDefault(ctx).IsTableAccess(MLot.Table_ID, false) && MRole.GetDefault(ctx).IsTableAccess(MLotCtl.Table_ID, false))
                        {
                            if (!_masi.IsExcludeLot(AD_Column_ID, IsSOTrx))//_windowNoParent
                            {
                                //column 1
                                obj.tableStucture += "<td></td>";
                                //column 2
                                obj.tableStucture += "<td>";
                                obj.tableStucture += "<button type='button' style='margin-bottom: 10px;' id='btnLot_" + windowNo + "' role='button' aria-disabled='false'><span >" + VAdvantage.Utility.Util.CleanMnemonic(Msg.GetMsg(ctx, "New")) + "</span></button>";
                                obj.tableStucture += "</td>";

                                obj.tableStucture += "</tr>";
                                //Row 3
                                obj.tableStucture += "<tr>";
                            }
                        }
                    }
                }
                //mZoom = new System.Windows.Forms.ToolStripMenuItem(Msg.GetMsg(Env.GetContext(), "Zoom"), Env.GetImageIcon("Zoom16.gif"));
                //mZoom.Click += new EventHandler(mZoom_Click);
                //ctxStrip.Items.Add(mZoom);
            }

            //	SerNo
            if (!_productWindow && aset.IsSerNo())
            {
                //column 1
                var label = Msg.Translate(ctx, "SerNo");
                obj.tableStucture += "<td>";
                obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id=SerNo_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label + "</label>";
                obj.tableStucture += "</td>";

                //column 2
                // txtSerNo.Text = _masi.GetSerNo();
                obj.tableStucture += "<td>";
                obj.tableStucture += "<input style='width: 100%;'  id='txtSerNo_" + windowNo + "' value='" + _masi.GetSerNo() + "' class='VIS_Pref_pass' type='text'>";
                obj.tableStucture += "</td>";

                obj.tableStucture += "</tr>";

                //Row 1
                obj.tableStucture += "<tr>";

                //	New SerNo Button
                if (_masi.GetMAttributeSet().GetM_SerNoCtl_ID() != 0)
                {
                    if (MRole.GetDefault(ctx).IsTableAccess(MSerNoCtl.Table_ID, false))
                    {
                        if (!_masi.IsExcludeSerNo(AD_Column_ID, IsSOTrx))//_windowNoParent
                        {
                            //column 1
                            obj.tableStucture += "<td></td>";
                            obj.tableStucture += "<td>";
                            obj.tableStucture += "<button type='button' style='margin-bottom: 10px;' id='btnSerNo_" + windowNo + "' role='button' aria-disabled='false'><span >" + VAdvantage.Utility.Util.CleanMnemonic(Msg.GetMsg(ctx, "New")) + "</span></button>";
                            obj.tableStucture += "</td>";
                        }

                        obj.tableStucture += "</tr>";
                        //Row 2
                        obj.tableStucture += "<tr>";
                    }
                }
            }   //	SerNo

            ////	GuaranteeDate
            if (!_productWindow && aset.IsGuaranteeDate())
            {
                var dtpicGuaranteeDate = TimeUtil.AddDays(DateTime.Now, _prd.GetGuaranteeDays());
                if (_M_AttributeSetInstance_ID > 0)
                {
                    dtpicGuaranteeDate = (DateTime)(_masi.GetGuaranteeDate());
                }
                var label = Msg.Translate(ctx, "GuaranteeDate");
                //Column 1
                obj.tableStucture += "<td>";
                obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' id='guaranteeDate_" + windowNo + "' class='VIS_Pref_Label_Font'>" + label + "</label>";
                obj.tableStucture += "</td>";
                //Column 2
                obj.tableStucture += "<td>";
                //obj.tableStucture += "<input style='width: 100%;' value='" + String.Format("{0:yyyy-MM-dd}", dtpicGuaranteeDate) + "' type='date'  id='dtpicGuaranteeDate_" + windowNo + "' class='VIS_Pref_pass'/>";
                obj.tableStucture += "<input style='width: 100%;' value='" + String.Format("{0:yyyy-MM-dd}", dtpicGuaranteeDate) + "' type='date'  id='dtpicGuaranteeDate_" + windowNo + "' class='VIS_Pref_pass'/>";
                obj.tableStucture += "</td>";

                obj.tableStucture += "</tr>";
                //Row 2
                obj.tableStucture += "<tr>";
            }

            //string[] sep = new string[1];
            //sep[0] = "<tr>";
            //sep = obj.tableStucture.Split(sep, StringSplitOptions.RemoveEmptyEntries);
            //if (sep.Length <= 3)
            //{
            //    obj.Error = "PAttributeNoInfo";
            //    obj.IsReturnNull = true;
            //    return null;
            //}

            //	New/Edit Window
            if (!_productWindow)
            {
                //chkNewEdit.IsChecked = _M_AttributeSetInstance_ID == 0;
            }

            //	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 vis-gc-vpanel-table-readOnly' 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'>" + VAdvantage.Utility.Util.CleanMnemonic(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'>" + VAdvantage.Utility.Util.CleanMnemonic(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);
        }
Example #3
0
        /// <summary>
        /// Table line structure
        /// </summary>
        /// <param name="attribute"></param>
        /// <param name="product"></param>
        /// <param name="readOnly"></param>
        private string AddAttributeLine(MGenAttribute attribute, bool readOnly, int windowNo, AttributesObjects obj, int count)
        {
            //Column 1
            obj.tableStucture += "<td>";
            obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;'  class='VIS_Pref_Label_Font' id=" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "  >" + attribute.GetName() + "</label>";
            obj.tableStucture += "</td>";

            MGenAttributeInstance instance = attributesList[attribute].Key;

            if (MGenAttribute.ATTRIBUTEVALUETYPE_List.Equals(attribute.GetAttributeValueType()))
            {
                MGenAttributeValue[] values = attributesList[attribute].Value;

                //Column 2
                obj.tableStucture += "<td>";
                if (readOnly)
                {
                    obj.tableStucture += "<select style='width: 100%;'  class='VIS_Pref_pass'  readonly id='cmb_" + count + "_" + windowNo + "'>";
                }
                else
                {
                    obj.tableStucture += "<select style='width: 100%;'  class='VIS_Pref_pass' id='cmb_" + count + "_" + windowNo + "'>";
                }

                obj.ControlList += "cmb_" + count + "_" + windowNo + ",";
                bool found = false;
                if (instance != null)
                {
                    for (int i = 0; i < values.Length; i++)
                    {
                        if (values[i] == null && i == 0)
                        {
                            obj.tableStucture += " <option value='0' > </option>";
                        }
                        else if (values[i] != null)
                        {
                            if (values[i].GetC_GenAttributeValue_ID() == instance.GetC_GenAttributeValue_ID())
                            {
                                obj.tableStucture += " <option selected value='" + values[i].GetC_GenAttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                            }
                            else
                            {
                                obj.tableStucture += " <option value='" + values[i].GetC_GenAttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                            }
                        }
                    }


                    if (found)
                    {
                        log.Fine("Attribute=" + attribute.GetName() + " #" + values.Length + " - found: " + instance);
                    }
                    else
                    {
                        log.Warning("Attribute=" + attribute.GetName() + " #" + values.Length + " - NOT found: " + instance);
                    }
                }
                else
                {
                    //if instance value is null
                    for (int i = 0; i < values.Length; i++)
                    {
                        if (values[i] == null && i == 0)
                        {
                            obj.tableStucture += " <option value='0' > </option>";
                        }
                        else if (values[i] != null)
                        {
                            obj.tableStucture += " <option value='" + values[i].GetC_GenAttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                        }
                    }
                    log.Fine("Attribute=" + attribute.GetName() + " #" + values.Length + " no instance");
                }
                obj.tableStucture += "</select>";
                obj.tableStucture += "</td>";
            }
            else if (MGenAttribute.ATTRIBUTEVALUETYPE_Number.Equals(attribute.GetAttributeValueType()))
            {
                //Column 2
                obj.tableStucture += "<td>";
                var instanceValue = 0.0M;
                if (instance != null)
                {
                    instanceValue = instance.GetValueNumber();
                }

                if (readOnly)
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass' readonly id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + instanceValue + "' class='' type='number'>";
                }
                else
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass'  id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + instanceValue + "' class='' type='number'>";
                }
                obj.ControlList   += "txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + ",";
                obj.tableStucture += "</td>";
            }
            else        //	Text Field
            {
                //Column 2
                obj.tableStucture += "<td>";

                var val = "";

                if (instance != null)
                {
                    val = instance.GetValue();
                }

                if (readOnly)
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass' readonly id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + val + "' class='' type='text'>";
                }
                else
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass'  id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + val + "' class='' type='text'>";
                }

                obj.ControlList   += "txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + ",";
                obj.tableStucture += "</td>";
            }

            obj.tableStucture += "</tr>";
            //Row Add
            obj.tableStucture += "<tr>";
            return(obj.tableStucture);
        }
        /// <summary>
        /// Table line structure
        /// </summary>
        /// <param name="attribute"></param>
        /// <param name="product"></param>
        /// <param name="readOnly"></param>
        private string AddAttributeLine(MAttribute attribute, int M_AttributeSetInstance_ID, bool product, bool readOnly, int windowNo, AttributesObjects obj, int count)
        {
            log.Fine(attribute + ", Product=" + product + ", R/O=" + readOnly);
            //Column 1
            obj.tableStucture += "<td>";
            if (product)
            {
                obj.tableStucture += "<label style=' font-weight:bold; padding-bottom: 10px; padding-right: 5px;' class='VIS_Pref_Label_Font' id=" + attribute.GetName().Replace(" ", "") + "_" + windowNo + ">" + attribute.GetName() + "</label>";
            }
            else
            {
                obj.tableStucture += "<label style='padding-bottom: 10px; padding-right: 5px;' class='VIS_Pref_Label_Font' id=" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "  >" + attribute.GetName() + "</label>";
            }
            obj.tableStucture += "</td>";

            MAttributeInstance instance = attribute.GetMAttributeInstance(M_AttributeSetInstance_ID);

            if (MAttribute.ATTRIBUTEVALUETYPE_List.Equals(attribute.GetAttributeValueType()))
            {
                MAttributeValue[] values = attribute.GetMAttributeValues();
                //Column 2
                obj.tableStucture += "<td>";
                if (readOnly)
                {
                    obj.tableStucture += "<select style='width: 100%;margin-bottom: 10px;'  readonly id='cmb_" + count + "_" + windowNo + "'>";
                }
                else
                {
                    obj.tableStucture += "<select style='width: 100%;margin-bottom: 10px;;'  id='cmb_" + count + "_" + windowNo + "'>";
                }
                obj.ControlList += "cmb_" + count + "_" + windowNo + ",";
                bool found = false;

                for (int i = 0; i < values.Length; i++)
                {
                    //Set first value default empty
                    if (values[i] == null && i == 0)
                    {
                        obj.tableStucture += " <option value='0' > </option>";
                    }
                    else if (values[i] != null)
                    {
                        if (instance != null)
                        {
                            if (values[i].GetM_AttributeValue_ID() == instance.GetM_AttributeValue_ID())
                            {
                                obj.tableStucture += " <option selected value='" + values[i].GetM_AttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                            }
                            else
                            {
                                obj.tableStucture += " <option value='" + values[i].GetM_AttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                            }
                        }
                        else
                        {
                            obj.tableStucture += " <option value='" + values[i].GetM_AttributeValue_ID() + "' >" + values[i].GetName() + "</option>";
                        }
                    }
                }

                obj.tableStucture += "</select>";
                obj.tableStucture += "</td>";

                if (found)
                {
                    log.Fine("Attribute=" + attribute.GetName() + " #" + values.Length + " - found: " + instance);
                }
                else
                {
                    log.Warning("Attribute=" + attribute.GetName() + " #" + values.Length + " - NOT found: " + instance);
                }

                if (instance != null)
                {
                }
                else
                {
                    log.Fine("Attribute=" + attribute.GetName() + " #" + values.Length + " no instance");
                }
            }
            else if (MAttribute.ATTRIBUTEVALUETYPE_Number.Equals(attribute.GetAttributeValueType()))
            {
                string value = null;
                if (instance != null)
                {
                    value = instance.GetValue();
                }
                //Column 2
                obj.tableStucture += "<td>";
                if (readOnly)
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass' readonly id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + value + "' class='' type='number'>";
                }
                else
                {
                    string addclass = "VIS_Pref_pass";
                    if (attribute.IsMandatory())
                    {
                        addclass += " vis-gc-vpanel-table-mandatory ";
                    }

                    obj.tableStucture += "<input style='width: 100% ;' maxlength='40' class='" + addclass + "' id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + value + "' class='' type='number'>";
                }
                obj.ControlList   += "txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + ",";
                obj.tableStucture += "</td>";
            }
            else        //	Text Field
            {
                string value = null;
                if (instance != null)
                {
                    value = instance.GetValue();
                }

                //Column 2
                obj.tableStucture += "<td>";
                if (readOnly)
                {
                    obj.tableStucture += "<input style='width: 100%;' class='VIS_Pref_pass' readonly id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + value + "' class='' type='text'>";
                }
                else
                {
                    string addclass = "VIS_Pref_pass";
                    if (attribute.IsMandatory())
                    {
                        addclass += " vis-gc-vpanel-table-mandatory ";
                    }

                    obj.tableStucture += "<input style='width: 100%;' maxlength='40' class='" + addclass + "' id='txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + "' value='" + value + "' class='' type='text'>";
                }
                obj.ControlList   += "txt" + attribute.GetName().Replace(" ", "") + "_" + windowNo + ",";
                obj.tableStucture += "</td>";
            }

            obj.tableStucture += "</tr>";
            //Row Add
            obj.tableStucture += "<tr>";
            return(obj.tableStucture);
        }