Esempio n. 1
0
        public static void Save(string name, string component, int sortOrder, RequestProfile requestProfile)
        {
            var obj = new DBComponentNameDataModel();

            obj.ApplicationId = requestProfile.ApplicationId;
            obj.Name          = name;
            obj.Description   = name;
            obj.SortOrder     = sortOrder;

            var dt = DBComponentNameDataManager.Search(obj, requestProfile);

            if (dt.Rows.Count == 0)
            {
                DBComponentNameDataManager.Create(obj, requestProfile);
            }
            else if (dt.Rows.Count == 1)
            {
                obj.DBComponentNameId = (int)(dt.Rows[0][DBComponentNameDataModel.DataColumns.DBComponentNameId]);
                DBComponentNameDataManager.Update(obj, requestProfile);
            }
        }
Esempio n. 2
0
        public static void SaveEntityDetails(String entityName, String dbName, String dbProjectName, String dbComponentName, RequestProfile requestProfile)
        {
            var dbNameId          = 0;
            var dbComponentNameId = 0;
            var dbProjectNameId   = 0;

            var obj1 = new DBNameDataModel();

            obj1.Name = dbName;
            var dt = DBNameDataManager.Search(obj1, requestProfile);

            if (dt.Rows.Count >= 1)
            {
                if (dbName.Equals(obj1.Name))
                {
                    dbNameId = Convert.ToInt32(dt.Rows[0][DBNameDataModel.DataColumns.DBNameId].ToString());
                }
            }

            var obj2 = new DBComponentNameDataModel();

            obj2.Name = dbComponentName;
            dt        = DBComponentNameDataManager.Search(obj2, requestProfile);

            if (dt.Rows.Count >= 1)
            {
                if (dbComponentName.Equals(obj2.Name))
                {
                    dbComponentNameId = Convert.ToInt32(dt.Rows[0][DBComponentNameDataModel.DataColumns.DBComponentNameId].ToString());
                }
            }

            var obj3 = new DBProjectNameDataModel();

            obj3.Name = dbProjectName;
            dt        = DBProjectNameDataManager.Search(obj3, requestProfile);

            if (dt.Rows.Count >= 1)
            {
                if (dbProjectName.Equals(obj3.Name))
                {
                    dbProjectNameId = Convert.ToInt32(dt.Rows[0][DBProjectNameDataModel.DataColumns.DBProjectNameId].ToString());
                }
            }

            var obj4 = new AllEntityDetailDataModel();
            var AllEntityDetailId = 0;

            obj4.EntityName = entityName;
            dt = AllEntityDetailDataManager.Search(obj4, requestProfile);

            if (dt.Rows.Count >= 1)
            {
                if (entityName.Equals(obj4.EntityName))
                {
                    AllEntityDetailId = Convert.ToInt32(dt.Rows[0][AllEntityDetailDataModel.DataColumns.AllEntityDetailId].ToString());
                }
            }

            var obj = new AllEntityDetailDataModel();

            obj.ApplicationId          = requestProfile.ApplicationId;
            obj.EntityName             = entityName;
            obj.DB_Name                = dbName;
            obj.DB_Project_Name        = dbProjectName;
            obj.Component_Project_Name = dbComponentName;
            obj.DBNameId               = dbNameId;
            obj.DBProjectNameId        = dbProjectNameId;
            obj.DBComponentNameId      = dbComponentNameId;

            if (AllEntityDetailId == 0)
            {
                AllEntityDetailDataManager.Create(obj, requestProfile);
            }

            else if (AllEntityDetailId != 0)
            {
                obj.AllEntityDetailId = AllEntityDetailId;
                AllEntityDetailDataManager.Update(obj, requestProfile);
            }
        }