コード例 #1
0
        private async Task <List <T> > getListData <T>(int IDIdentity, string idReferenceColName) where T : class
        {
            List <SearchField> param = new System.Collections.Generic.List <SearchField>();

            param.Add(new SearchField {
                Name = idReferenceColName, Operator = "=", Value = IDIdentity.ToString()
            });
            RepoListAsync list   = new RepoListAsync();
            var           myList = await list.ListDataAsync <T>(param);

            var myListData = (List <T>)myList.ReturnValue[0].ReturnValue;

            return((myList.IsSuccessConnection & myList.IsSuccessQuery & myListData.Count > 0) ?myListData : null);
        }
コード例 #2
0
        public async Task <bool> IsContinueUpdateAfterMultiplePKAsync <T>(T entity) where T : class
        {
            // if true, continue to next query
            bool result = true;

            if (isUsingMultiplePK)
            {
                List <SearchField> lsfMultiplePK = new List <SearchField>();
                bool isMultiple = this.CheckIsMultiplePKUpdate <T>(entity, out lsfMultiplePK);
                if (isMultiple)
                {
                    RepoListAsync repoList = new RepoListAsync();
                    var           cekList  = await repoList.ListDataAsync <T>(lsfMultiplePK).ConfigureAwait(false);

                    if (cekList.IsSuccessConnection & cekList.IsSuccessQuery)
                    {
                        if (cekList.ReturnValue.ReturnValue != null)
                        {
                            var dataList = (List <T>)cekList.ReturnValue.ReturnValue;
                            if (dataList != null)
                            {
                                if (dataList.Count >= 1)
                                {
                                    result = false;
                                    var PIdentity = ColumnPropGet.GetInstance.GetIdentityColumnProps <T>();// Identity PK/identity PK like, means ordinary position must set to 0 in database table
                                    foreach (var item in lsfMultiplePK)
                                    {
                                        if (item.Name != PIdentity.Name)
                                        {
                                            multipleErrorMessage += item.Name + " , ";
                                        }
                                    }
                                    multipleErrorMessage += " columns";
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
コード例 #3
0
        public async Task <bool> IsContinueSaveAfterMultiplePKAsync <T>(T entity) where T : class
        {
            // if true, continue to next query
            bool result = true;

            if (isUsingMultiplePK)
            {
                List <SearchField> lsfMultiplePK = new List <SearchField>();
                bool isMultiple = this.CheckIsMultiplePKSave <T>(entity, out lsfMultiplePK);
                if (isMultiple)
                {
                    RepoListAsync repoList = new RepoListAsync();
                    var           cekList  = await repoList.ListDataAsync <T>(lsfMultiplePK).ConfigureAwait(false);

                    if (cekList.IsSuccessConnection & cekList.IsSuccessQuery)
                    {
                        if (cekList.ReturnValue.ReturnValue != null)
                        {
                            var dataList = (List <T>)cekList.ReturnValue.ReturnValue;
                            if (dataList != null)
                            {
                                if (dataList.Count >= 1)
                                {
                                    result = false;
                                    foreach (var item in lsfMultiplePK)
                                    {
                                        multipleErrorMessage += item.Name + ",";
                                    }
                                    multipleErrorMessage += " columns";
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }