Exemplo n.º 1
0
        public static DataTable DoesExist(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ThemeKeyDataModel();

            doesExistRequest.Name = data.Name;
            return(Search(doesExistRequest, requestProfile));
        }
Exemplo n.º 2
0
        public static int Create(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("ThemeKey.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
Exemplo n.º 3
0
        public void LoadData(int themeKeyId, bool showId)
        {
            Clear();

            var data = new ThemeKeyDataModel();

            data.ThemeKeyId = themeKeyId;

            var items = ThemeKeyDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.ThemeKeyId;
                // oHistoryList.Setup(PrimaryEntity, ThemeKeyId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Exemplo n.º 4
0
        public override int?Save(string action)
        {
            var data = new ThemeKeyDataModel();

            data.ThemeKeyId  = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;
            //data.IsAllTab = IsAllTab;

            if (action == "Insert")
            {
                var dtTheme = ThemeKeyDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtTheme.Rows.Count == 0)
                {
                    ThemeKeyDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                ThemeKeyDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.ThemeKeyId);
        }
Exemplo n.º 5
0
        public static string Save(ThemeKeyDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";

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

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

            default:
                break;
            }
            sql = sql + ", " + ToSQLParameter(data, ThemeKeyDataModel.DataColumns.ThemeKeyId) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Name) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.Description) +
                  ", " + ToSQLParameter(data, StandardDataModel.StandardDataColumns.SortOrder);

            return(sql);
        }
Exemplo n.º 6
0
        protected override void ShowData(int ThemeKeyId)
        {
            oDetailButtonPanel.SetId = SetId;
            var data = new ThemeKeyDataModel();

            data.ThemeKeyId = ThemeKeyId;

            var items = ThemeKeyDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                lblThemeKeyId.Text  = item.ThemeKeyId.ToString();
                lblName.Text        = item.Name;
                lblDescription.Text = item.Description;
                lblSortOrder.Text   = item.SortOrder.ToString();
                //lblIsAllTab.Text = item.IsAllTab.ToString();

                oUpdateInfo.LoadText(item.UpdatedDate, item.UpdatedBy, item.LastAction);

                oHistoryList.Setup(PrimaryEntity, ThemeKeyId, "ThemeKey");
            }
            else
            {
                Clear();
            }
        }
Exemplo n.º 7
0
        protected override void Clear()
        {
            base.Clear();

            var data = new ThemeKeyDataModel();

            SetData(data);
        }
Exemplo n.º 8
0
        private System.Data.DataTable GetData()
        {
            // TODO: on all export pages
            var data = new ThemeKeyDataModel();

            var dt = Framework.Components.Core.ThemeKeyDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemplo n.º 9
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var ThemeKeydata = new ThemeKeyDataModel();

            ThemeKeydata.ThemeKeyId = entityKey;
            var results = Framework.Components.Core.ThemeKeyDataManager.Search(ThemeKeydata, SessionVariables.RequestProfile);

            return(results);
        }
Exemplo n.º 10
0
        public static DataSet GetChildren(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.ThemeKeyChildrenGet" +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, ThemeKeyDataModel.DataColumns.ThemeKeyId);
            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
Exemplo n.º 11
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new ThemeKeyDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);

            Framework.Components.Core.ThemeKeyDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Exemplo n.º 12
0
        private DataTable GetData(string name)
        {
            var data = new ThemeKeyDataModel();

            data.Name = name;

            var dt = ThemeKeyDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemplo n.º 13
0
        public static bool DoesExist(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ThemeKeyDataModel();

            doesExistRequest.ApplicationId = data.ApplicationId;
            doesExistRequest.Name          = data.Name;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
Exemplo n.º 14
0
        public static void Delete(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.ThemeKeyDelete ";

            var parameters =
                new
            {
                AuditId      = requestProfile.AuditId
                , ThemeKeyId = data.ThemeKeyId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
Exemplo n.º 15
0
        public static bool IsDeletable(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var isDeletable = true;
            var ds          = GetChildren(data, requestProfile);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataTable dt in ds.Tables)
                {
                    if (dt.Rows.Count > 0)
                    {
                        isDeletable = false;
                        break;
                    }
                }
            }
            return(isDeletable);
        }
Exemplo n.º 16
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var notDeletableIds = new List <int>();
                var deleteIndexList = DeleteIds.Split(',');

                foreach (string index in deleteIndexList)
                {
                    var data = new ThemeKeyDataModel();
                    data.ThemeKeyId = int.Parse(index);
                    Framework.Components.Core.ThemeKeyDataManager.Delete(data, SessionVariables.RequestProfile);
                }

                DeleteAndRedirect();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Exemplo n.º 17
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new ThemeKeyDataModel();

            UpdatedData = Framework.Components.Core.ThemeKeyDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.ThemeKeyId =
                    Convert.ToInt32(SelectedData.Rows[i][ThemeKeyDataModel.DataColumns.ThemeKeyId].ToString());

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());


                data.Name =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Name))
                    ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Name)
                    : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString();

                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                    ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                    : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                Framework.Components.Core.ThemeKeyDataManager.Update(data, SessionVariables.RequestProfile);
                data            = new ThemeKeyDataModel();
                data.ThemeKeyId =
                    Convert.ToInt32(SelectedData.Rows[i][ThemeKeyDataModel.DataColumns.ThemeKeyId].ToString());
                var dt = Framework.Components.Core.ThemeKeyDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Exemplo n.º 18
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var ThemeKeydata = new ThemeKeyDataModel();

                selectedrows = ThemeKeyDataManager.GetDetails(ThemeKeydata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        ThemeKeydata.ThemeKeyId = entityKey;
                        var result = ThemeKeyDataManager.GetDetails(ThemeKeydata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    ThemeKeydata.ThemeKeyId = SetId;
                    var result = ThemeKeyDataManager.GetDetails(ThemeKeydata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            return(null);
        }
Exemplo n.º 19
0
        public static List <ThemeKeyDataModel> GetEntityDetails(ThemeKeyDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.ThemeKeySearch ";

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , ApplicationId   = requestProfile.ApplicationId
                , ApplicationMode = requestProfile.ApplicationModeId
                , ReturnAuditInfo = returnAuditInfo
                , ThemeKeyId      = dataQuery.ThemeKeyId
                , Name            = dataQuery.Name
            };

            List <ThemeKeyDataModel> result;

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

            return(result);
        }
Exemplo n.º 20
0
        public static string ToSQLParameter(ThemeKeyDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
Exemplo n.º 21
0
        public static DataTable Search(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
Exemplo n.º 22
0
        public static void Update(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("ThemeKey.Update", sql, DataStoreKey);
        }
Exemplo n.º 23
0
        public static ThemeKeyDataModel GetDetails(ThemeKeyDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
Exemplo n.º 24
0
        public void SetData(ThemeKeyDataModel data)
        {
            SystemKeyId = data.ThemeKeyId;

            base.SetData(data);
        }