Beispiel #1
0
        public void Delete(string value)
        {
            var dataQuery = new LanguageDataModel();

            dataQuery.LanguageId = int.Parse(value);
            LanguageDataManager.Delete(dataQuery, SessionVariables.RequestProfile);
        }
        public DataManager()
        {
            ConnectionString  = "Data Source=";
            ConnectionString += Directory.GetCurrentDirectory();
            ConnectionString += "\\data.sqlite;Version=3;Read Only=True;";

            TemplatePath = Directory.GetCurrentDirectory() + "\\template.html";

            random = new Random();

            UsedBooks = new List <string>();
            UsedBooks.Add("Player's Handbook");

            RaceData                = new RaceDataManager(ConnectionString, UsedBooks);
            AppearanceData          = new AppearanceDataManager(ConnectionString, UsedBooks);
            ClassData               = new ClassDataManager(ConnectionString, UsedBooks);
            BackgroundData          = new BackgroundDataManager(ConnectionString, UsedBooks);
            AbilityData             = new AbilityDataManager(ConnectionString, UsedBooks);
            LanguageData            = new LanguageDataManager(ConnectionString, UsedBooks);
            SkillData               = new SkillDataManager(ConnectionString, UsedBooks);
            EquipmentData           = new EquipmentDataManager(ConnectionString, UsedBooks);
            SpellData               = new SpellDataManager(ConnectionString, UsedBooks);
            ExtraRaceChoiceData     = new ExtraRaceChoiceDataManager(ConnectionString, UsedBooks);
            ExtraClassChoiceData    = new ExtraClassChoiceDataManager(ConnectionString, UsedBooks);
            ExtraSubclassChoiceData = new ExtraSubclassChoiceDataManager(ConnectionString, UsedBooks);
            NameData                = new NameDataManager(ConnectionString, UsedBooks);
            StoryData               = new StoryDataManager(ConnectionString, UsedBooks);
            ExportData              = new ExportDataManager(ConnectionString, TemplatePath, UsedBooks);
        }
Beispiel #3
0
        public void LoadData(int LanguageId, bool showId)
        {
            Clear();

            var data = new LanguageDataModel();

            data.LanguageId = LanguageId;

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

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

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.LanguageId;

                oHistoryList.Setup(PrimaryEntity, LanguageId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Beispiel #4
0
        public override int?Save(string action)
        {
            var data = new LanguageDataModel();

            data.LanguageId  = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

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

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

            return(data.LanguageId);
        }
Beispiel #5
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var notDeletableIds = new List <int>();
                var deleteIndexList = DeleteIds.Split(',');

                foreach (var index in deleteIndexList)
                {
                    var data = new LanguageDataModel();
                    data.LanguageId = int.Parse(index);

                    if (!LanguageDataManager.IsDeletable(data, SessionVariables.RequestProfile))
                    {
                        notDeletableIds.Add((int)(data.LanguageId));
                    }
                }

                if (notDeletableIds.Count == 0)
                {
                    foreach (var index in deleteIndexList)
                    {
                        var data = new LanguageDataModel();
                        data.LanguageId = int.Parse(index);

                        LanguageDataManager.Delete(data, SessionVariables.RequestProfile);
                    }
                }
                else
                {
                    var msg = String.Empty;

                    foreach (var id in notDeletableIds)
                    {
                        if (!string.IsNullOrEmpty(msg))
                        {
                            msg += ", <br/>";
                        }
                        msg += "LanguageId: " + id + " has detail records";
                    }

                    foreach (string index in deleteIndexList)
                    {
                        var data = new LanguageDataModel();
                        data.LanguageId = int.Parse(index);

                        LanguageDataManager.DeleteChildren(data, SessionVariables.RequestProfile);
                        LanguageDataManager.Delete(data, SessionVariables.RequestProfile);
                    }
                }

                DeleteAndRedirect();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Beispiel #6
0
        public LanguageDataModel GetById(string value)
        {
            var dataQuery = new LanguageDataModel();

            dataQuery.LanguageId = int.Parse(value);

            var result = LanguageDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile, 1);

            return(result[0]);
        }
Beispiel #7
0
        protected override void ShowData(int LanguageId)
        {
            base.ShowData(LanguageId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new LanguageDataModel();

            data.LanguageId = LanguageId;

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

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

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, LanguageId, "Language");
            }
        }
Beispiel #8
0
        protected override DataTable GetData()
        {
            var dt = LanguageDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile);

            return(dt);
        }
Beispiel #9
0
 public void Update([FromBody] LanguageDataModel data)
 {
     LanguageDataManager.Update(data, SessionVariables.RequestProfile);
 }
Beispiel #10
0
        // GET api/summary/GetList
        public IEnumerable <LanguageDataModel> GetList()
        {
            var dataQuery = new LanguageDataModel();

            return(LanguageDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile));
        }