Exemplo n.º 1
0
    public void btnPost_Click(object sender, EventArgs e)
    {
        ShowPicture showPicture = null;

        if (action == OperateType.Add)
        {
            showPicture = new ShowPicture();
        }
        else
        {
            showPicture = ShowPictures.Get(showPictureID);
        }
        showPicture.Description  = this.txtDescription.Text;
        showPicture.Link         = this.txtLink.Text;
        showPicture.Title        = this.txtTitle.Text;
        showPicture.DisplayOrder = Convert.ToInt32(this.txtDisplayOrder.Text);
        if (fuLogo.PostedFile != null && fuLogo.PostedFile.ContentLength > 0)
        {
            showPicture.FileName = Path.GetFileName(fuLogo.PostedFile.FileName);
        }
        if (action == OperateType.Add)
        {
            ShowPictures.Create(showPicture, fuLogo.PostedFile.InputStream);
            mbMessage.ShowMsg("新增展示图片信息成功,可继续填写新展示图片信息,若完成请返回!", Color.Navy);
        }
        else if (action == OperateType.Edit)
        {
            ShowPictures.Update(showPicture, fuLogo.PostedFile.InputStream);
            mbMessage.ShowMsg("修改展示图片信息成功,可继续修改展示图片信息,若完成请返回!", Color.Navy);
        }
        BindData();
    }
Exemplo n.º 2
0
    void BindData()
    {
        ShowPicture showPicture = null;

        if (action == OperateType.Edit)
        {
            showPicture = ShowPictures.Get(showPictureID);
        }
        else
        {
            showPicture = new ShowPicture();
        }
        this.txtDescription.Text  = showPicture.Description;
        this.txtLink.Text         = showPicture.Link;
        this.txtTitle.Text        = showPicture.Title;
        this.txtDisplayOrder.Text = showPicture.DisplayOrder.ToString();
        if (showPicture.File != null)
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(showPicture.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
        else
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
    }
Exemplo n.º 3
0
 public void Save()
 {
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowPictureKey, ShowPicture.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowVariationPictureKey, ShowVariationPicture.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowStatisticsKey, ShowStatistics.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowOnlyCurrentStatisticsKey, ShowOnlyCurrentStatistics.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowOtherLanguagesKey, ShowOtherLanguages.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowRulesKey, ShowRules.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Display, ShowPricesKey, ShowPrices.ToString());
     _magicDatabase.InsertNewOption(TypeOfOption.Upgrade, AutoCheckUpgradeKey, AutoCheckUpgrade.ToString());
 }
Exemplo n.º 4
0
 /// <summary>
 /// Show the image on another thread.
 /// </summary>
 void ShowImage()
 {
     if (this.InvokeRequired)
     {
         ShowPicture d = new ShowPicture(ShowImage);
         this.Invoke(d, null);
     }
     else
     {
         this.DisplayPicture(this.mainPicBox, new DisplayPictureEventArgs(loader.CurrentImage));
         fotobox.UpdateAll();
     }
 }
Exemplo n.º 5
0
        /// 删除,按主键ID;
        /// </summary>
        /// <param name="identify">实体的主键</param>
        public void ShowPicDelete(int identify)
        {
            ShowPicture shp = ShowPicSingle(identify);

            if (shp == null)
            {
                return;
            }
            if (!string.IsNullOrWhiteSpace(shp.Shp_File))
            {
                WeiSha.WebControl.FileUpload.Delete("ShowPic", shp.Shp_File);
            }
            Gateway.Default.Delete <ShowPicture>(ShowPicture._.Shp_ID == identify);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 添加轮换图片
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void ShowPicAdd(ShowPicture entity)
 {
     Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
     if (org != null)
     {
         entity.Org_ID = org.Org_ID;
     }
     //如果没有排序号,则自动计算
     if (entity.Shp_Tax < 1)
     {
         object obj = Gateway.Default.Max <ShowPicture>(ShowPicture._.Shp_Tax,
                                                        ShowPicture._.Org_ID == entity.Org_ID && ShowPicture._.Shp_Site == entity.Shp_Site);
         entity.Shp_Tax = obj is int?(int)obj + 1 : 0;
     }
     Gateway.Default.Save <ShowPicture>(entity);
 }
Exemplo n.º 7
0
 protected void egvShowPictures_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         ShowPicture picture          = e.Row.DataItem as ShowPicture;
         Image       showPictureThumb = e.Row.FindControl("ShowPictureThumb") as Image;
         if (showPictureThumb != null)
         {
             if (picture.File != null)
             {
                 showPictureThumb.ImageUrl = SiteUrlManager.GetResizedImageUrl(picture.File, (int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value);
             }
             else
             {
                 showPictureThumb.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)showPictureThumb.Width.Value, (int)showPictureThumb.Height.Value);
             }
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 将当前项目向下移动;
        /// </summary>
        /// <param name="id"></param>
        /// <returns>如果已经处于顶端,则返回false;移动成功,返回true</returns>
        public bool ShowPicDown(int id)
        {
            //当前对象
            ShowPicture current = Gateway.Default.From <ShowPicture>().Where(ShowPicture._.Shp_ID == id).ToFirst <ShowPicture>();
            int         tax     = (int)current.Shp_Tax;
            //下一个对象,即弟弟对象;弟弟不存则直接返回false;
            ShowPicture next = Gateway.Default.From <ShowPicture>().Where(ShowPicture._.Shp_Tax > tax &&
                                                                          ShowPicture._.Org_ID == current.Org_ID && ShowPicture._.Shp_Site == current.Shp_Site)
                               .OrderBy(ShowPicture._.Shp_Tax.Asc).ToFirst <ShowPicture>();

            if (next == null)
            {
                return(false);
            }
            //交换排序号
            current.Shp_Tax = next.Shp_Tax;
            next.Shp_Tax    = tax;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <ShowPicture>(current);
                    tran.Save <ShowPicture>(next);
                    tran.Commit();
                    return(true);
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 将当前项目向上移动;
        /// </summary>
        /// <param name="id"></param>
        /// <returns>如果已经处于顶端,则返回false;移动成功,返回true</returns>
        public bool ShowPicUp(int id)
        {
            //当前对象
            ShowPicture current = Gateway.Default.From <ShowPicture>().Where(ShowPicture._.Shp_ID == id).ToFirst <ShowPicture>();
            int         tax     = (int)current.Shp_Tax;
            //上一个对象,即兄长对象;兄长不存则直接返回false;
            ShowPicture prev = Gateway.Default.From <ShowPicture>().Where(ShowPicture._.Shp_Tax < tax &&
                                                                          ShowPicture._.Org_ID == current.Org_ID && ShowPicture._.Shp_Site == current.Shp_Site)
                               .OrderBy(ShowPicture._.Shp_Tax.Desc).ToFirst <ShowPicture>();

            if (prev == null)
            {
                return(false);
            }
            //交换排序号
            current.Shp_Tax = prev.Shp_Tax;
            prev.Shp_Tax    = tax;
            using (DbTrans tran = Gateway.Default.BeginTrans())
            {
                try
                {
                    tran.Save <ShowPicture>(current);
                    tran.Save <ShowPicture>(prev);
                    tran.Commit();
                    return(true);
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
                finally
                {
                    tran.Close();
                }
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="entity">业务实体</param>
 public void ShowPicSave(ShowPicture entity)
 {
     Gateway.Default.Save <ShowPicture>(entity);
 }