Пример #1
0
        /// <summary>
        /// Init Field for Process Parameter
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="WindowNo">window number</param>
        /// <param name="dr">dataRow</param>
        /// <returns>this object</returns>
        public static GridFieldVO CreateParameter(Ctx ctx, int windowNo, IDataReader dr)
        {
            GridFieldVO vo = new GridFieldVO(ctx, windowNo, 0, 0, 0, false);

            vo.isProcess     = true;
            vo.IsDisplayedf  = true;
            vo.IsDisplayedMR = true;
            vo.IsReadOnly    = false;
            vo.IsUpdateable  = true;

            try
            {
                vo.AD_Table_ID     = 0;
                vo.AD_Column_ID    = Utility.Util.GetValueOfInt(dr["AD_Process_Para_ID"]); //	**
                vo.ColumnName      = dr["ColumnName"].ToString();
                vo.Header          = dr["Name"].ToString();
                vo.Description     = Utility.Util.GetValueOfString(dr["Description"]);
                vo.Help            = Utility.Util.GetValueOfString(dr["Help"]);
                vo.displayType     = Utility.Util.GetValueOfInt(dr["AD_Reference_ID"]);
                vo.AD_Reference_ID = Utility.Util.GetValueOfInt(dr["AD_Reference_ID"]);
                vo.IsMandatoryUI   = Utility.Util.GetValueOfString(dr["IsMandatoryUI"]).Equals("Y");
                vo.FieldLength     = Utility.Util.GetValueOfInt(dr["FieldLength"]);
                vo.DisplayLength   = vo.FieldLength;
                vo.DefaultValue    = Utility.Util.GetValueOfString(dr["DefaultValue"]);
                vo.DefaultValue2   = Utility.Util.GetValueOfString(dr["DefaultValue2"]);
                vo.VFormat         = Utility.Util.GetValueOfString(dr["VFormat"]);
                vo.ValueMin        = Utility.Util.GetValueOfString(dr["ValueMin"]);
                vo.ValueMax        = Utility.Util.GetValueOfString(dr["ValueMax"]);
                vo.isRange         = Utility.Util.GetValueOfString(dr["IsRange"]).Equals("Y");
                //
                vo.AD_Reference_Value_ID = Utility.Util.GetValueOfInt(dr["AD_Reference_Value_ID"]);
                vo.ValidationCode        = Utility.Util.GetValueOfString(dr["ValidationCode"]);
                vo.AD_InfoWindow_ID      = Util.GetValueOfInt(dr["AD_INFOWINDOW_ID"]);
            }
            catch (System.Exception e)
            {
                VLogger.Get().Log(Level.SEVERE, "createParameter", e);
            }
            //
            vo.InitFinish();
            if (vo.DefaultValue2 == null)
            {
                vo.DefaultValue2 = "";
            }
            return(vo);
        }
Пример #2
0
        }   //  initStdField

        /// <summary>
        ///
        /// </summary>
        /// <param name="ctx">Current Ctx of an application</param>
        /// <param name="iWindowId">window number</param>
        /// <param name="dr">Datarow contating resultset</param>
        /// <returns></returns>
        public static GridFieldVO CreateParameter(Ctx t_ctx, int iWindowId, System.Data.DataRow dr)
        {
            GridFieldVO vo = new GridFieldVO(t_ctx, iWindowId, 0, 0, 0, false);

            vo.isProcess    = true;
            vo.IsDisplayedf = true;
            vo.IsReadOnly   = false;
            vo.IsUpdateable = true;
            try
            {
                vo.AD_Table_ID           = 0;
                vo.AD_Column_ID          = int.Parse(dr["AD_Process_Para_ID"].ToString());
                vo.ColumnName            = dr["COLUMNNAME"].ToString();
                vo.Header                = dr["Name"].ToString();
                vo.name                  = dr["Name"].ToString();
                vo.Description           = dr["Description"].ToString();
                vo.Help                  = dr["Help"].ToString();
                vo.displayType           = int.Parse(dr["AD_Reference_ID"].ToString());
                vo.AD_Reference_ID       = int.Parse(dr["AD_Reference_ID"].ToString());
                vo.IsMandatoryUI         = dr["IsMandatoryUI"].ToString() == "Y" ? true : false;
                vo.FieldLength           = int.Parse(dr["FIELDLENGTH"].ToString());
                vo.DisplayLength         = vo.FieldLength;
                vo.DefaultValue          = dr["DefaultValue"].ToString();
                vo.DefaultValue2         = dr["DEFAULTVALUE2"].ToString();
                vo.ValueMin              = dr["VALUEMIN"].ToString();
                vo.ValueMax              = dr["VALUEMAX"].ToString();
                vo.isRange               = dr["ISRANGE"].ToString() == "Y";
                vo.AD_Reference_Value_ID = int.Parse((dr["AD_REFERENCE_VALUE_ID"].ToString() == "") ? "0" : dr["AD_REFERENCE_VALUE_ID"].ToString());
                vo.ValidationCode        = dr["VALIDATIONCODE"].ToString();
                vo.AD_InfoWindow_ID      = Util.GetValueOfInt(dr["AD_INFOWINDOW_ID"]);
                vo.LoadRecursiveData     = dr["LoadRecursiveData"].ToString() == "Y" ? true : false;
                vo.ShowChildOfSelected   = dr["ShowChildOfSelected"].ToString() == "Y" ? true : false;

                //Check If parameter is marked encrypted or not.
                vo.IsEncryptedField = dr["IsEncrypted"].ToString() == "Y" ? true : false;
                dr.Delete();
            }
            catch
            {
            }

            vo.InitFinish();
            return(vo);
        }
Пример #3
0
        }   //  MFieldVO

        /// <summary>
        /// copy const
        /// </summary>
        /// <param name="newCtx">context</param>
        /// <param name="f">object</param>
        public GridFieldVO(Ctx newCtx, FieldVObj f)
        {
            GridFieldVO vo = this;

            this.ctx        = newCtx;
            vo.isProcess    = true;
            vo.IsDisplayedf = true;
            vo.IsReadOnly   = false;
            vo.IsUpdateable = true;

            vo.AD_Table_ID   = 0;
            vo.AD_Column_ID  = 0;
            vo.ColumnName    = f.ColumnName;
            vo.Header        = "";
            vo.Description   = f.Description;
            vo.Help          = f.Help;
            vo.displayType   = f.displayType;
            vo.IsMandatoryUI = f.IsMandatoryUI;
            vo.FieldLength   = f.FieldLength;
            vo.DisplayLength = f.DisplayLength;
            vo.DefaultValue  = f.DefaultValue;
            vo.DefaultValue2 = f.DefaultValue2;
            vo.VFormat       = f.VFormat;
            vo.ValueMin      = f.ValueMin;
            vo.ValueMax      = f.ValueMax;
            vo.isRange       = f.isRange;
            //
            vo.AD_Reference_Value_ID = f.AD_Reference_Value_ID;
            vo.ValidationCode        = f.ValidationCode;
            //
            vo.InitFinish();
            if (vo.DefaultValue2 == null)
            {
                vo.DefaultValue2 = "";
            }
        }
Пример #4
0
        }   //  createParameter

        /// <summary>
        /// Make a standard field (Created/Updated/By)
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="windowNo">window number</param>
        /// <param name="tabNo">tab number</param>
        /// <param name="AD_Window_ID">Window_ID</param>
        /// <param name="AD_Tab_ID">Tab Id</param>
        /// <param name="tabReadOnly">tab readonly</param>
        /// <param name="isCreated">is prefic created column</param>
        /// <param name="isTimestamp">is prefix "update" column</param>
        /// <returns></returns>
        public static GridFieldVO CreateStdField(Ctx ctx, int windowNo, int tabNo,
                                                 int AD_Window_ID, int AD_Tab_ID, bool tabReadOnly,
                                                 bool isCreated, bool isTimestamp)
        {
            GridFieldVO vo = new GridFieldVO(ctx, windowNo, tabNo,
                                             AD_Window_ID, AD_Tab_ID, tabReadOnly);

            vo.ColumnName = isCreated ? "Created" : "Updated";
            if (!isTimestamp)
            {
                vo.ColumnName += "By";
            }
            vo.displayType = isTimestamp ? DisplayType.DateTime : DisplayType.Table;
            if (!isTimestamp)
            {
                vo.AD_Reference_Value_ID = 110;         //	AD_User Table Reference
            }
            vo.IsDisplayedf  = false;
            vo.IsMandatoryUI = false;
            vo.IsReadOnly    = false;
            vo.IsUpdateable  = true;
            vo.InitFinish();
            return(vo);
        }   //  initStdField
Пример #5
0
        /// <summary>
        ///  Create Field Value Object
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="WindowNo">window number</param>
        /// <param name="TabNo">tab number</param>
        /// <param name="AD_Window_ID">window Id</param>
        /// <param name="AD_Tab_ID">Tab Id</param>
        /// <param name="readOnly">is readonly</param>
        /// <param name="dr">datarow</param>
        /// <returns>object of this Class</returns>
        public static GridFieldVO Create(Ctx ctx, int windowNo, int tabNo,
                                         int AD_Window_ID, int AD_Tab_ID, bool readOnly, IDataReader dr)
        {
            GridFieldVO vo = new GridFieldVO(ctx, windowNo, tabNo,
                                             AD_Window_ID, AD_Tab_ID, readOnly);
            String columnName = "ColumnName";

            try
            {
                vo.ColumnName = dr["ColumnName"].ToString();
                if (vo.ColumnName == null || columnName.Trim().Length == 0)
                {
                    return(null);
                }

                // VLogger.Get().Fine(vo.ColumnName);

                //ResultSetMetaData rsmd = dr.getMetaData();
                for (int i = 0; i < dr.FieldCount; i++)
                {
                    columnName = dr.GetName(i).ToUpper();// rsmd.getColumnName(i);
                    if (columnName.Equals("NAME"))
                    {
                        vo.Header = dr[i].ToString();
                    }
                    else if (columnName.Equals("AD_REFERENCE_ID"))
                    {
                        vo.displayType = Utility.Util.GetValueOfInt(dr[i]);//  Utility.Util.GetValueOfInt(dr[i])
                    }
                    else if (columnName.Equals("AD_COLUMN_ID"))
                    {
                        vo.AD_Column_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("AD_INFOWINDOW_ID"))
                    {
                        vo.AD_InfoWindow_ID = Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("AD_TABLE_ID"))
                    {
                        vo.AD_Table_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("DISPLAYLENGTH"))
                    {
                        vo.DisplayLength = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("ISSAMELINE"))
                    {
                        vo.IsSameLine = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISDISPLAYED"))
                    {
                        vo.IsDisplayedf = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("MRISDISPLAYED"))
                    {
                        vo.IsDisplayedMR = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("DISPLAYLOGIC"))
                    {
                        vo.DisplayLogic = dr[i].ToString();
                    }
                    else if (columnName.Equals("DEFAULTVALUE"))
                    {
                        vo.DefaultValue = dr[i].ToString();
                    }
                    else if (columnName.Equals("ISMANDATORYUI"))
                    {
                        vo.IsMandatoryUI = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISREADONLY"))
                    {
                        vo.IsReadOnly = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISUPDATEABLE"))
                    {
                        vo.IsUpdateable = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISALWAYSUPDATEABLE"))
                    {
                        vo.IsAlwaysUpdateable = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISHEADING"))
                    {
                        vo.IsHeading = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISFIELDONLY"))
                    {
                        vo.IsFieldOnly = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISENCRYPTEDFIELD"))
                    {
                        vo.IsEncryptedField = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISENCRYPTEDCOLUMN"))
                    {
                        vo.IsEncryptedColumn = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISSELECTIONCOLUMN"))
                    {
                        vo.IsSelectionColumn = "Y".Equals(dr[i].ToString());
                    }
                    //else if (columnName.Equals("ISINCLUDEDCOLUMN"))
                    //    vo.IsIncludedColumn = "Y".Equals(dr[i].ToString());
                    else if (columnName.Equals("SELECTIONSEQNO"))
                    {
                        vo.SelectionSeqNo = Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("SORTNO"))
                    {
                        vo.SortNo = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("FIELDLENGTH"))
                    {
                        vo.FieldLength = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("VFORMAT"))
                    {
                        vo.VFormat = dr[i].ToString();
                    }
                    else if (columnName.Equals("VALUEMIN"))
                    {
                        vo.ValueMin = dr[i].ToString();
                    }
                    else if (columnName.Equals("VALUEMAX"))
                    {
                        vo.ValueMax = dr[i].ToString();
                    }
                    else if (columnName.Equals("FIELDGROUP"))
                    {
                        vo.FieldGroup = Env.TrimModulePrefix(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISKEY"))
                    {
                        vo.IsKey = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ISPARENT"))
                    {
                        vo.IsParent = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("DESCRIPTION"))
                    {
                        vo.Description = dr[i].ToString();
                    }
                    else if (columnName.Equals("HELP"))
                    {
                        vo.Help = dr[i].ToString();
                    }
                    else if (columnName.Equals("CALLOUT"))
                    {
                        vo.Callout = dr[i].ToString();

                        if (!string.IsNullOrEmpty(vo.Callout))
                        {
                            Tuple <string, string, string> tpl = null;

                            StringTokenizer st       = new StringTokenizer(vo.Callout, ";,", false);
                            StringBuilder   callouts = new StringBuilder();

                            bool hasModulePrefix = Env.HasModulePrefix(vo.ColumnName, out tpl);


                            while (st.HasMoreTokens())      //  for each callout
                            {
                                string prefix = "";

                                String cmd = st.NextToken().Trim();
                                if (hasModulePrefix)
                                {
                                    prefix = vo.ColumnName.Substring(0, vo.ColumnName.IndexOf('_'));
                                }
                                else
                                {
                                    String className = cmd.Substring(0, cmd.LastIndexOf("."));
                                    className = className.Remove(0, className.LastIndexOf(".") + 1);

                                    if (Env.HasModulePrefix(className, out tpl))
                                    {
                                        prefix = className.Substring(0, className.IndexOf('_'));
                                    }
                                }

                                if (callouts.Length > 0)
                                {
                                    if (prefix.Length > 0)
                                    {
                                        callouts.Append(";").Append(cmd.Replace("ViennaAdvantage", prefix));
                                    }
                                    else
                                    {
                                        callouts.Append(";").Append(cmd);
                                    }
                                }
                                else
                                {
                                    if (prefix.Length > 0)
                                    {
                                        callouts.Append(cmd.Replace("ViennaAdvantage", prefix));
                                    }
                                    else
                                    {
                                        callouts.Append(";").Append(cmd);
                                    }
                                }
                            }
                            vo.Callout = callouts.ToString();
                        }
                    }
                    else if (columnName.Equals("AD_PROCESS_ID"))
                    {
                        vo.AD_Process_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("AD_FORM_ID"))
                    {
                        vo.AD_Form_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("READONLYLOGIC"))
                    {
                        vo.ReadOnlyLogic = dr[i].ToString();
                    }
                    else if (columnName.Equals("MANDATORYLOGIC"))
                    {
                        vo.mandatoryLogic = dr[i].ToString();
                    }
                    else if (columnName.Equals("OBSCURETYPE"))
                    {
                        vo.ObscureType = dr[i].ToString();
                    }
                    else if (columnName.Equals("ISDEFAULTFOCUS"))
                    {
                        vo.IsDefaultFocus = "Y".Equals(dr[i].ToString());
                    }
                    //
                    else if (columnName.Equals("AD_REFERENCE_VALUE_ID"))
                    {
                        vo.AD_Reference_Value_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("VALIDATIONCODE"))
                    {
                        vo.ValidationCode = dr[i].ToString();
                    }
                    else if (columnName.Equals("COLUMNSQL"))
                    {
                        vo.ColumnSQL = dr[i].ToString();
                    }
                    else if (columnName.Equals("AD_FIELD_ID"))
                    {
                        vo.AD_Field_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("MOBILELISTINGFORMAT"))
                    {
                        vo.MobileListingFormat = Utility.Util.GetValueOfString(dr[i]);
                    }
                    else if (columnName.Equals("MRSEQNO"))
                    {
                        if (dr[i] != null && dr[i] != DBNull.Value)
                        {
                            int mrseq = Util.GetValueOfInt(dr[i]);
                            if (mrseq >= 0)
                            {
                                vo.mrSeqNo = mrseq;
                            }
                        }
                    }

                    else if (columnName.Equals("ZOOMWINDOW_ID"))
                    {
                        vo.ZoomWindow_ID = Util.GetValueOfInt(dr[i]);
                    }

                    else if (columnName.Equals("ISLINK"))
                    {
                        vo.isLink = "Y".Equals(Util.GetValueOfString(dr[i]));
                    }

                    else if (columnName.Equals("ISRIGHTPANELINK"))
                    {
                        vo.isRightPaneLink = "Y".Equals(Util.GetValueOfString(dr[i]));
                    }

                    else if (columnName.Equals("ISCOPY"))
                    {
                        vo.IsCopy = "Y".Equals(Util.GetValueOfString(dr[i]));
                    }
                    else if (columnName.Equals("COLUMNWIDTH"))
                    {
                        vo.ColumnWidth = Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("ISBACKGROUNDPROCESS"))
                    {
                        vo.IsBackgroundProcess = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ASKUSERBGPROCESS"))
                    {
                        vo.AskUserBGProcess = "Y".Equals(dr[i].ToString());
                    }
                    /******************************/
                    else if (columnName.Equals("Isheaderpanelitem", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.IsHeaderPanelitem = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("Headeroverridereference", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HeaderOverrideReference = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("HeaderStyle", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HeaderStyle = dr[i].ToString();
                    }
                    else if (columnName.Equals("HeaderHeadingOnly", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HeaderHeadingOnly = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("HeaderSeqno", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HeaderSeqno = Utility.Util.GetValueOfDecimal(dr[i]);
                    }
                    else if (columnName.Equals("HeaderIconOnly", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HeaderIconOnly = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("HtmlStyle", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.HtmlStyle = dr[i].ToString();
                    }
                    else if (columnName.Equals("ShowIcon", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.ShowIcon = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("AD_Image_ID", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.AD_Image_ID = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("PlaceHolder", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.PlaceHolder = Utility.Util.GetValueOfString(dr[i]);
                    }
                    else if (columnName.Equals("FontName", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.FontClass = Utility.Util.GetValueOfString(dr[i]);
                    }
                    else if (columnName.Equals("ImageUrl", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.ImageName = Utility.Util.GetValueOfString(dr[i]);
                        if (vo.ImageName != "" && vo.ImageName.Contains("/"))
                        {
                            vo.ImageName = vo.ImageName.Substring(vo.ImageName.LastIndexOf("/") + 1);
                        }
                    }
                    // new column added for maintain versions
                    else if (columnName.Equals("ISMAINTAINVERSIONS", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.IsMaintainVersions = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("CellSpace", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.CellSpace = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("FieldBreadth", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.FieldBreadth = Utility.Util.GetValueOfInt(dr[i]);
                    }
                    else if (columnName.Equals("IsLineBreak", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.LineBreak = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("FieldGroupDefault", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.FieldGroupDefault = "Y".Equals(dr[i].ToString());
                    }
                    else if (columnName.Equals("ShowFilterOption", StringComparison.OrdinalIgnoreCase))
                    {
                        vo.ShowFilterOption = "Y".Equals(dr[i].ToString());
                    }
                }
                if (vo.Header == null)
                {
                    vo.Header = vo.ColumnName;
                }
            }
            catch (Exception e)
            {
                VLogger.Get().Log(Level.SEVERE, "ColumnName=" + columnName, e);
                return(null);
            }
            vo.InitFinish();
            return(vo);
        }