Пример #1
0
        public void Save()
        {
            if (this.id != Constants.DEFAULT_VALUE_INT)
            {
                ETC.Category category = this.entity ?? ETC.Category.ExecuteCreate(this.id);

                if (category != null)
                {
                    if (this.image != null)
                    {
                        SaveImg();
                    }

                    category.Update(
                        this.name,
                        this.description,
                        this.imageName,
                        this.status ? ETC.Category.STATUS_ACTIVE : ETC.Category.STATUS_INACTIVE,
                        Common.Session.Account.ID);
                }
            }
            else
            {
                ETC.Category category = ETC.Category.ExecuteCreate(
                    this.name,
                    this.description,
                    this.imageName,
                    this.status ? ETC.Category.STATUS_ACTIVE : ETC.Category.STATUS_INACTIVE,
                    Common.Session.Account.ID,
                    Common.Session.Account.ID);
                category.Insert();
                this.id = category.ID;

                if (this.image != null)
                {
                    SaveImg();
                }
            }

            if (!String.IsNullOrEmpty(this.TempFolderPath) && Directory.Exists(this.TempFolderPath))
            {
                Directory.Delete(this.TempFolderPath, true);
            }
        }