Beispiel #1
0
        private static string Save(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.SkillXPersonXSkillLevelInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                       ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.SkillXPersonXSkillLevelUpdate  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }
            sql = sql + ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId) +
                  ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillId) +
                  ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.PersonId) +
                  ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId);
            return(sql);
        }
Beispiel #2
0
        private DataTable GetData(string name)
        {
            var data = new SkillXPersonXSkillLevelDataModel();
            var dt   = SkillXPersonXSkillLevelDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Beispiel #3
0
        protected override void ShowData(int skillXPersonXSkillLevelId)
        {
            oDetailButtonPanel.SetId = SetId;
            var data = new SkillXPersonXSkillLevelDataModel();

            data.SkillXPersonXSkillLevelId = skillXPersonXSkillLevelId;

            var dt = SkillXPersonXSkillLevelDataManager.GetDetails(data, SessionVariables.RequestProfile);

            if (dt.Rows.Count == 1)
            {
                var row = dt.Rows[0];

                lblSkillXPersonXSkillLevelId.Text = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId]);
                lblSkillLevel.Text = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevel]);
                lblSkill.Text      = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.Skill]);
                lblPerson.Text     = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.Person]);

                oUpdateInfo.LoadText(dt.Rows[0]);

                oHistoryList.Setup((int)SystemEntity.SkillXPersonXSkillLevel, skillXPersonXSkillLevelId, "SkillXPersonXSkillLevel");
                dynAuditHistory.Visible = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.HistoryGridVisibilityKey, "SkillXPersonXSkillLevel");
            }
            else
            {
                Clear();
            }
        }
Beispiel #4
0
        public static List <SkillXPersonXSkillLevelDataModel> GetEntityDetails(SkillXPersonXSkillLevelDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.SkillXPersonXSkillLevelSearch ";

            var parameters =
                new
            {
                AuditId                     = requestProfile.AuditId
                , ApplicationId             = requestProfile.ApplicationId
                , ReturnAuditInfo           = returnAuditInfo
                , SkillXPersonXSkillLevelId = dataQuery.SkillXPersonXSkillLevelId
                , SkillId                   = dataQuery.SkillId
                , PersonId                  = dataQuery.PersonId
                , SkillLevelId              = dataQuery.SkillLevelId
            };

            List <SkillXPersonXSkillLevelDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <SkillXPersonXSkillLevelDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }
Beispiel #5
0
        public static void Delete(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SkillXPersonXSkillLevelDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.PersonId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId);

            Framework.Components.DataAccess.DBDML.RunSQL("SkillXPersonXSkillLevel.Delete", sql, DataStoreKey);
        }
Beispiel #6
0
        public static bool DoesExist(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SkillXPersonXSkillLevelSearch " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId);

            var oDT = new Framework.Components.DataAccess.DBDataTable("SkillXPersonXSkillLevel.DoesExist", sql, DataStoreKey);

            return(oDT.DBTable.Rows.Count > 0);
        }
Beispiel #7
0
        public static DataTable Search(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.SkillXPersonXSkillLevelSearch " +
                      " " + BaseDataManager.SetCommonParametersForSearch(requestProfile.AuditId, requestProfile.ApplicationId, requestProfile.ApplicationModeId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.PersonId) +
                      ", " + ToSQLParameter(data, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId);

            var oDT = new Framework.Components.DataAccess.DBDataTable("SkillXPersonXSkillLevel.Search", sql, DataStoreKey);

            return(oDT.DBTable);
        }
Beispiel #8
0
        public void LoadData(int skillXPersonXSkillLevelId, bool showId)
        {
            var data = new SkillXPersonXSkillLevelDataModel();

            data.SkillXPersonXSkillLevelId = skillXPersonXSkillLevelId;
            var oSkillXPersonXSkillLevelTable = SkillXPersonXSkillLevelDataManager.GetDetails(data, SessionVariables.RequestProfile);

            if (oSkillXPersonXSkillLevelTable.Rows.Count == 1)
            {
                var row = oSkillXPersonXSkillLevelTable.Rows[0];

                if (!showId)
                {
                    txtSkillXPersonXSkillLevelId.Text = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId]);

                    // only show Audit History in case of Update page, not for Clone.
                    oHistoryList.Setup((int)SystemEntity.SkillXPersonXSkillLevel, skillXPersonXSkillLevelId, "SkillXPersonXSkillLevel");
                    dynAuditHistory.Visible = PerferenceUtility.GetUserPreferenceByKeyAsBoolean(ApplicationCommon.HistoryGridVisibilityKey, "SkillXPersonXSkillLevel");
                }
                else
                {
                    txtSkillXPersonXSkillLevelId.Text = String.Empty;
                }
                txtSkillLevelId.Text = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId]);
                txtSkillId.Text      = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillId]);
                txtPersonId.Text     = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.PersonId]);

                drpPersonList.SelectedValue     = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.PersonId]);
                drpSkillList.SelectedValue      = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillId]);
                drpSkillLevelList.SelectedValue = Convert.ToString(row[SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId]);
            }
            else
            {
                txtSkillXPersonXSkillLevelId.Text = String.Empty;
                txtSkillId.Text      = String.Empty;
                txtPersonId.Text     = String.Empty;
                txtSkillLevelId.Text = String.Empty;
            }
        }
Beispiel #9
0
        public static string ToSQLParameter(SkillXPersonXSkillLevelDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId:
                if (data.SkillXPersonXSkillLevelId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId, data.SkillXPersonXSkillLevelId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.SkillXPersonXSkillLevelId);
                }
                break;

            case SkillXPersonXSkillLevelDataModel.DataColumns.SkillId:
                if (data.SkillId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SkillXPersonXSkillLevelDataModel.DataColumns.SkillId, data.SkillId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.SkillId);
                }
                break;

            case SkillXPersonXSkillLevelDataModel.DataColumns.PersonId:
                if (data.PersonId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SkillXPersonXSkillLevelDataModel.DataColumns.PersonId, data.PersonId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.PersonId);
                }
                break;

            case SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId:
                if (data.SkillLevelId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId, data.SkillLevelId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevelId);
                }
                break;


            case SkillXPersonXSkillLevelDataModel.DataColumns.Skill:
                if (!string.IsNullOrEmpty(data.Skill))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, SkillXPersonXSkillLevelDataModel.DataColumns.Skill, data.Skill);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.Skill);
                }
                break;

            case SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevel:
                if (!string.IsNullOrEmpty(data.SkillLevel))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevel, data.SkillLevel);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SkillXPersonXSkillLevelDataModel.DataColumns.SkillLevel);
                }
                break;
            }

            return(returnValue);
        }
Beispiel #10
0
        public static void Update(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, requestProfile, "Update");

            Framework.Components.DataAccess.DBDML.RunSQL("SkillXPersonXSkillLevel.Update", sql, DataStoreKey);
        }
Beispiel #11
0
        public static SkillXPersonXSkillLevelDataModel GetDetails(SkillXPersonXSkillLevelDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }