示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StoreMarktingInfo storeMarktingInfo = new StoreMarktingInfo
            {
                MarktingType = (EnumMarktingType)int.Parse(this.ddlType.SelectedValue)
            };

            if (this.hidOldImages.Value != this.hidUploadImages.Value)
            {
                storeMarktingInfo.IconUrl = base.UploadImage(this.hidUploadImages.Value, "depot");
                this.hidOldImages.Value   = storeMarktingInfo.IconUrl;
            }
            else
            {
                storeMarktingInfo.IconUrl = this.hidOldImages.Value;
            }
            int num = 0;

            if (string.IsNullOrEmpty(this.hidId.Value))
            {
                num = StoreMarktingHelper.AddInfo(storeMarktingInfo);
            }
            else
            {
                storeMarktingInfo.Id = int.Parse(this.hidId.Value);
                storeMarktingInfo.DisplaySequence = int.Parse(this.hidDisplaySequence.Value);
                num = StoreMarktingHelper.Edit(storeMarktingInfo);
            }
            this.ShowResultData(num);
        }
示例#2
0
        private void bindInfo(int id)
        {
            StoreMarktingInfo storeMarktingInfo = StoreMarktingHelper.GetStoreMarktingInfo(id);

            this.hidOldImages.Value       = storeMarktingInfo.IconUrl;
            this.ddlType.SelectedValue    = ((byte)storeMarktingInfo.MarktingType).ToString();
            this.hidDisplaySequence.Value = storeMarktingInfo.DisplaySequence.ToString();
            this.btnSave.Text             = "保存";
        }
        public static int Edit(StoreMarktingInfo info)
        {
            StoreMarktingDao storeMarktingDao = new StoreMarktingDao();

            if (!storeMarktingDao.TypeValidate(info.Id, info.MarktingType))
            {
                return(-1);
            }
            info.RedirectTo = info.RedirectUrl;
            return(storeMarktingDao.Update(info, null) ? 1 : 2);
        }
        public static int AddInfo(StoreMarktingInfo info)
        {
            StoreMarktingDao storeMarktingDao = new StoreMarktingDao();

            if (!storeMarktingDao.TypeValidate(info.Id, info.MarktingType))
            {
                return(-1);
            }
            info.DisplaySequence = storeMarktingDao.GetMaxDisplaySequence <StoreMarktingInfo>();
            info.RedirectTo      = info.RedirectUrl;
            return((storeMarktingDao.Add(info, null) > 0) ? 1 : 2);
        }