Example #1
0
 private static DataSet GetAllObjectForDataLookups(string strTableName, string strQueryColumn)
 {
     try
     {
         Type   businessObjectType = BusinessObjectFactory.GetBusinessObject(strTableName + "Info").GetType();
         string strQueryCommand    = string.Empty;
         if (businessObjectType != null)
         {
             if (businessObjectType.GetProperty("AAStatus") != null)
             {
                 strQueryCommand = string.Format("Select {0} From [{1}] Where [AAStatus]='Alive'", strQueryColumn, strTableName);
             }
             else
             {
                 strQueryCommand = string.Format("Select {0} From [{1}]", strQueryColumn, strTableName);
             }
         }
         else
         {
             strQueryCommand = string.Format("Select {0} From [{1}]", strQueryColumn, strTableName);
         }
         return(SqlDatabaseHelper.RunQuery(SqlDatabaseHelper.GetQuery(strQueryCommand)));
     }
     catch { }
     return(null);
 }
Example #2
0
 public virtual BusinessObject GetBusinessObject(int pRowHandle, params string[] pProperties)
 {
     if (pRowHandle < 0)
     {
         return(null);
     }
     if (string.IsNullOrWhiteSpace(VinaDataSource))
     {
         VinaDbUtil     vinaDbUtil = new VinaDbUtil();
         BusinessObject obj        = BusinessObjectFactory.GetBusinessObject(VinaDataSource + "Info");
         if (obj != null)
         {
             System.Threading.Tasks.Parallel.For(0, pProperties.Length, i =>
             {
                 object objProp = (MainView as DevExpress.XtraGrid.Views.Grid.GridView).GetRowCellValue(pRowHandle, pProperties[i]);
                 if (objProp != DBNull.Value)
                 {
                     vinaDbUtil.SetPropertyValue(obj, pProperties[i], objProp);
                 }
             });
         }
         return(obj);
     }
     return((BusinessObject)(MainView as DevExpress.XtraGrid.Views.Grid.GridView).GetRow(pRowHandle));
 }
Example #3
0
        public virtual void SetDefaultMainObject()
        {
            try
            {
                VinaDbUtil vinaDbUtil = new VinaDbUtil();

                string fromBusinessObject = VinaUtil.GetTableNameFromBusinessObject(this.MainObject);
                string str = fromBusinessObject.Substring(0, fromBusinessObject.Length - 1) + "ID";
                this.MainObject = (BusinessObject)BusinessObjectFactory.GetBusinessObject(fromBusinessObject + "Info");

                vinaDbUtil.SetPropertyValue(this.MainObject, str.Substring(0, str.Length - 2) + "No", (object)BusinessObject.DefaultObjectNo);
                vinaDbUtil.SetPropertyValue(this.MainObject, "AAStatus", (object)BusinessObject.DefaultAAStatus);

                this.UpdateMainObjectBindingSource();
            }
            catch (Exception ex)
            {
                int num = (int)MessageBox.Show(ex.ToString());
            }
        }
Example #4
0
        private static string GetLookupQueryColumn(STGridColumnsInfo objSTGridColumnsInfo)
        {
            string str = string.Empty;
            string tablePrimaryColumn = GMCDbUtil.GetTablePrimaryColumn(objSTGridColumnsInfo.STGridColumnRepository);

            str = str + string.Format("{0},", tablePrimaryColumn);
            string name = tablePrimaryColumn.Substring(0, tablePrimaryColumn.Length - 2) + "No";
            string str4 = tablePrimaryColumn.Substring(0, tablePrimaryColumn.Length - 2) + "Name";

            try
            {
                System.Type businessObjectType = BusinessObjectFactory.GetBusinessObject(objSTGridColumnsInfo.STGridColumnRepository + "Info").GetType();
                if (businessObjectType != null)
                {
                    if (businessObjectType.GetProperty(name) != null)
                    {
                        str = str + string.Format("{0},", name);
                    }
                    if (businessObjectType.GetProperty(str4) != null)
                    {
                        str = str + string.Format("{0},", str4);
                    }
                }
            }
            catch { }
            if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoDsplMem) && ((!objSTGridColumnsInfo.STGridColumnRepoDsplMem.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoDsplMem.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoDsplMem.Equals(str4)))
            {
                str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoDsplMem);
            }
            if (!objSTGridColumnsInfo.STGridColumnRepoDsplMem.StartsWith("FK_"))
            {
                if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoCol1) && ((!objSTGridColumnsInfo.STGridColumnRepoCol1.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoCol1.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoCol1.Equals(str4)))
                {
                    str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoCol1);
                }
                if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoCol2) && ((!objSTGridColumnsInfo.STGridColumnRepoCol2.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoCol2.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoCol2.Equals(str4)))
                {
                    str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoCol2);
                }
                if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoCol3) && ((!objSTGridColumnsInfo.STGridColumnRepoCol3.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoCol3.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoCol3.Equals(str4)))
                {
                    str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoCol3);
                }
                if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoCol4) && ((!objSTGridColumnsInfo.STGridColumnRepoCol4.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoCol4.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoCol4.Equals(str4)))
                {
                    str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoCol4);
                }
                if (!string.IsNullOrEmpty(objSTGridColumnsInfo.STGridColumnRepoCol5) && ((!objSTGridColumnsInfo.STGridColumnRepoCol5.Equals(tablePrimaryColumn) && !objSTGridColumnsInfo.STGridColumnRepoCol5.Equals(name)) && !objSTGridColumnsInfo.STGridColumnRepoCol5.Equals(str4)))
                {
                    str = str + string.Format("{0},", objSTGridColumnsInfo.STGridColumnRepoCol5);
                }
            }
            if (GMCWebApp.LookupExColumsList.ContainsKey(objSTGridColumnsInfo.STGridColumnRepository))
            {
                str = str + string.Format("{0},", GMCWebApp.LookupExColumsList[objSTGridColumnsInfo.STGridColumnRepository]);
            }
            if (str.Substring(str.Length - 1).Equals(","))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(str);
        }