Пример #1
0
        private void LoadGroupBuyingCategory(GroupBuyingCategoryType type)
        {
            new GroupBuyingFacade(this).GetAllGroupBuyingCategory((se, a) =>
            {
                if (a.FaultsHandle())
                {
                    return;
                }
                _viewModel.GroupBuyingCategoryList.Clear();
                if (a.Result == null || a.Result.Count < 1)
                {
                    return;
                }
                var list = a.Result.Where(p => p.CategoryType == type).ToList();
                list.ForEach(p =>
                {
                    var v = EntityConverter <GroupBuyingCategoryInfo, GroupBuyingCategoryVM> .Convert(p);
                    _viewModel.GroupBuyingCategoryList.Add(v);
                });

                if (this._viewModel.SysNo.HasValue && this._viewModel.SysNo > 0)
                {
                    int?categorySysNo = this._viewModel.GroupBuyingCategorySysNo;
                    this._viewModel.GroupBuyingCategorySysNo = 0;
                    this._viewModel.GroupBuyingCategorySysNo = categorySysNo;
                }
                else
                {
                    if (list.Count > 0)
                    {
                        this._viewModel.GroupBuyingCategorySysNo = list.FirstOrDefault().SysNo;
                    }
                }
                if (this._viewModel.GroupBuyingCategorySysNo == null)
                {
                    this.cmbGroupBuyingCategory.SelectedIndex = 0;
                }
            });
        }
Пример #2
0
        public bool CheckGroupBuyingCategoryNameExists(string categoryName, int excludeSysNo, GroupBuyingCategoryType categoryType)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CheckGroupBuyingCategoryNameExists");

            command.SetParameterValue("@CategoryName", categoryName);
            command.SetParameterValue("@ExcludeSysNo", excludeSysNo);
            command.SetParameterValue("@CategoryType", categoryType);
            return(command.ExecuteScalar <int>() > 0);
        }