Пример #1
0
        public bool InsertCategoryType(b2bCategoryType CategoryType)
        {
            var svCategory = new CategoryService();
            var Cate       = svCategory.SelectData <b2bCategoryType>(" * ", "IsDelete = 0 AND RowFlag > 0 AND CategoryTypeName = '" + CategoryType.CategoryTypeName + "'");

            if (Cate.Count() != 1)
            {
                CategoryType.CreatedDate  = DateTimeNow;
                CategoryType.ModifiedDate = DateTimeNow;
                CategoryType.CreatedBy    = "sa";
                CategoryType.ModifiedBy   = "sa";

                using (var trans = new TransactionScope())
                {
                    qDB.b2bCategoryTypes.InsertOnSubmit(CategoryType);
                    qDB.SubmitChanges();
                    trans.Complete();
                    IsResult = true;
                }
            }
            else
            {
                IsResult = false;
            }
            return(IsResult);
        }
        public ActionResult InsertCateType(string catetypename)
        {
            var svCategory = new CategoryService();

            try
            {
                var model = new b2bCategoryType();

                model.CategoryTypeName = catetypename;
                model.RowFlag          = 1;
                model.RowVersion       = 1;
                model.IsDelete         = false;
                model.IsShow           = true;

                svCategory.InsertCategoryType(model);
            }
            catch (Exception ex)
            {
                CreateLogFiles(ex);
            }
            return(Json(new { IsResult = svCategory.IsResult, MsgError = res.Admin.lblCate_duplicate }));
        }