예제 #1
0
        public async Task <int> UpdateItem(RetailerBuyingCalendarItem item)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(item);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #2
0
        public async Task <int> UpdatePrice(ProductPrice price)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(price);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #3
0
        public async Task <int> UpdateItem(CFShippingItem shippingItem)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(shippingItem);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
        public async Task <bool> UpdateItemAsync(PurchaseOrderItem poItem)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(poItem);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs != 0);
        }
        public async Task <int> Update(DistributionEmployee employee)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(employee);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #6
0
        public async Task <int> UpdateAsync(Contact contact)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(contact);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
        public async Task <int> Update(FarmerRetailerOrderItems item)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(item);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #8
0
        public async Task <int> UpdateLocation(RetailerLocation retailerLocation)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(retailerLocation);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #9
0
        public async Task <bool> UpdateAsync(Message msg, CancellationToken cancellationToken = default(CancellationToken))
        {
            string cmd = QueriesCreatingHelper.CreateQueryUpdate(msg);
            var    rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs != 0);
        }
예제 #10
0
        public async Task <int> Update(CollectionInventory inventory)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(inventory);
            var rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs == 0 ? -1 : 0);
        }
예제 #11
0
        public async Task <bool> Update(FulfillmentCollection fulCol)
        {
            string cmd = QueriesCreatingHelper.CreateQueryUpdate(fulCol);
            var    rs  = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

            return(rs != 0);
        }
예제 #12
0
        public async Task <int> AddOrUpdateContact(Contact contact)
        {
            var cmd = string.Empty;

            if (contact.Id != 0)
            {
                cmd = QueriesCreatingHelper.CreateQueryUpdate(contact);
                var rs = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

                return(rs == 0 ? -1 : contact.Id);
            }
            else
            {
                cmd  = QueriesCreatingHelper.CreateQueryInsert(contact);
                cmd += ";SELECT LAST_INSERT_ID();";
                return((await DALHelper.ExecuteQuery <int>(cmd, dbTransaction: DbTransaction, connection: DbConnection)).First());
            }
        }
예제 #13
0
        public async Task <int> AddOrUpdateLanguage(CategoryLanguage language)
        {
            string cmd  = QueriesCreatingHelper.CreateQuerySelect <CategoryLanguage>($"category_id = {language.CategoryId} AND language_id = {language.LanguageId}");
            var    lang = (await DALHelper.ExecuteQuery <CategoryLanguage>(cmd, dbTransaction: DbTransaction, connection: DbConnection)).FirstOrDefault();

            if (lang == null)
            {
                cmd  = QueriesCreatingHelper.CreateQueryInsert(language);
                cmd += ";SELECT LAST_INSERT_ID();";
                return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
            }
            else
            {
                language.Id = lang.Id;
                cmd         = QueriesCreatingHelper.CreateQueryUpdate(language);
                var rs = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection);

                return(rs == 0 ? -1 : language.Id);
            }
        }
예제 #14
0
        public async Task <int> Update(PesticideCategory pesticideCategory)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(pesticideCategory);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #15
0
        public async Task <int> UpdateAsync(AccountRole accountRole)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(accountRole);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #16
0
        public async Task <int> UpdateAsync(Material material)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(material);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #17
0
        public async Task <int> UpdateAsync(CultureField cultureField)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(cultureField);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #18
0
        public async Task <int> UpdateAsync(UI.Captions.Models.Caption caption)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(caption);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #19
0
        public async Task <int> Delete(UserSession user, T value, IDbConnection conn = null, IDbTransaction trans = null)
        {
            Assembly assembly = null;

            if (!string.IsNullOrEmpty(GlobalConfiguration.IntegrationTemplate.ModelAssembly))
            {
                var path = Path.Combine(Directory.GetCurrentDirectory(), "ExtensionFolder", GlobalConfiguration.IntegrationTemplate.ModelAssembly);
                assembly = Assembly.Load(File.ReadAllBytes(path));
            }
            EventResultModel eventResultModel = null;

            if (conn != null && trans != null)
            {
                try
                {
                    var model = GlobalConfiguration.IntegrationTemplate.ModelTemplates.FirstOrDefault(m => m.Name == typeof(T).Name);

                    // run berore record event
                    eventResultModel = CommonHelper.RunEvent(assembly, model.Delete.BeforeRowEvent, typeof(BaseEvent <T>), new object[] { this, value, conn, trans, user });
                    if (!eventResultModel.Result)
                    {
                        throw new Exception(eventResultModel.ErrorMessage);
                    }
                    if (!eventResultModel.IsBubble)
                    {
                        return(0);
                    }

                    value.IsDeleted = true;
                    string cmd = QueriesCreatingHelper.CreateQueryUpdate(value);

                    var rs = await DALHelper.Execute(cmd, dbTransaction : trans, connection : conn);

                    // run after record event
                    eventResultModel = CommonHelper.RunEvent(assembly, model.Delete.AfterRowEvent, typeof(BaseEvent <T>), new object[] { this, value, conn, trans, user });
                    if (!eventResultModel.Result)
                    {
                        throw new Exception(eventResultModel.ErrorMessage);
                    }
                    if (!eventResultModel.IsBubble)
                    {
                        return(0);
                    }

                    return(rs == 1 ? 0 : -1);
                }
                catch (Exception ex)
                {
                    LogHelper.GetLogger().Error(ex.Message);
                    return(-1);
                }
            }
            else
            {
                try
                {
                    var model = GlobalConfiguration.IntegrationTemplate.ModelTemplates.FirstOrDefault(m => m.Name == typeof(T).Name);

                    // run berore record event
                    eventResultModel = CommonHelper.RunEvent(assembly, model.Delete.BeforeRowEvent, typeof(BaseEvent <T>), new object[] { this, value, conn, trans, user });
                    if (!eventResultModel.Result)
                    {
                        throw new Exception(eventResultModel.ErrorMessage);
                    }
                    if (!eventResultModel.IsBubble)
                    {
                        return(0);
                    }

                    value.IsDeleted = true;
                    string cmd = QueriesCreatingHelper.CreateQueryUpdate(value);

                    var rs = await DALHelper.Execute(cmd);

                    // run after record event
                    eventResultModel = CommonHelper.RunEvent(assembly, model.Delete.AfterRowEvent, typeof(BaseEvent <T>), new object[] { this, value, conn, trans, user });
                    if (!eventResultModel.Result)
                    {
                        throw new Exception(eventResultModel.ErrorMessage);
                    }
                    if (!eventResultModel.IsBubble)
                    {
                        return(0);
                    }

                    return(rs == 1 ? 0 : -1);
                }
                catch (Exception ex)
                {
                    LogHelper.GetLogger().Error(ex.Message);
                    return(-1);
                }
            }
        }
        public async Task <int> Update(CultivationActivity cultivationActivity)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(cultivationActivity);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #21
0
        public async Task <int> UpdateAsync(ProductLanguage productLanguage)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(productLanguage);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
        public async Task <int> UpdateAsync(ScheduleAction scheduleAction)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(scheduleAction);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
        public async Task <int> Update(FertilizerCategory fertilizerCategory)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(fertilizerCategory);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #24
0
        public async Task <int> UpdateAsync(GrowingMethod growingMethod)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(growingMethod);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #25
0
        public async Task <int> UpdateAsync(SessionBuffer sessionBuffer)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(sessionBuffer);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }
예제 #26
0
        public async Task <int> UpdateAsync(CompanyType companyType)
        {
            var cmd = QueriesCreatingHelper.CreateQueryUpdate(companyType);

            return(await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection));
        }