Пример #1
0
        private void ADImageList_BindGrid()
        {
            zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
            DataTable dt = aDImageListBLL.GetList(grid1.PageSize, grid1.PageIndex + 1, "*", "PublishDate", 0, "desc", "IsEnable=1").Tables[0];

            grid1.DataSource = dt;
            grid1.DataBind();
        }
Пример #2
0
 /// <summary>
 /// 获取总页数
 /// </summary>
 /// <returns></returns>
 private int Get_ADImageListTotalCount()
 {
     zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
     DataTable dt = aDImageListBLL.GetList("IsEnable=1").Tables[0];
     if (dt.Rows.Count > 0)
     {
         return dt.Rows.Count;
     }
     else
     {
         return 0;
     }
 }
Пример #3
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.ADImageListModel aDImageListModel = new zlzw.Model.ADImageListModel();
                aDImageListModel.AdImageTitle = txbAdImageTitle.Text;
                aDImageListModel.ADLink = txbADLink.Text;
                if (fileADImagePath.PostedFile.ContentLength > 0)
                {
                    fileADImagePath.SaveAs(Server.MapPath(ViewState["fileADImagePath"].ToString()));
                    aDImageListModel.ADImagePath = ViewState["fileADImagePath"].ToString();
                }
                else
                {
                    aDImageListModel.ADImagePath = ViewState["fileADImagePath"].ToString();
                }
                aDImageListModel.ADContent = txbADContent.Text;
                aDImageListModel.IsEnable = 1;
                aDImageListModel.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString());
                aDImageListModel.ADImageGUID = new Guid(ViewState["AdminGUID"].ToString());
                zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
                aDImageListModel.ADImageID = int.Parse(Get_ID(aDImageListBLL, Request.QueryString["value"]));

                aDImageListBLL.Update(aDImageListModel);
            }
            else
            {
                //添加保存

                zlzw.Model.ADImageListModel aDImageListModel = new zlzw.Model.ADImageListModel();
                aDImageListModel.AdImageTitle = txbAdImageTitle.Text;
                aDImageListModel.ADLink = txbADLink.Text;
                if (fileADImagePath.PostedFile.ContentLength > 0)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + fileADImagePath.FileName;
                    fileADImagePath.SaveAs(Server.MapPath("~/UploadImages/" + fileName));
                    aDImageListModel.ADImagePath = "~/UploadImages/" + fileName;//保存图片路径
                }
                aDImageListModel.ADContent = txbADContent.Text;
                aDImageListModel.IsEnable = 1;
                aDImageListModel.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
                zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
                aDImageListBLL.Add(aDImageListModel);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }
Пример #4
0
 private void LoadData(string strType)
 {
     if (strType == "1")
     {
         string strID = Request.QueryString["value"];//操作ID
         zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
         zlzw.Model.ADImageListModel aDImageListModel = aDImageListBLL.GetModel(int.Parse(Get_ID(aDImageListBLL, strID)));
         txbAdImageTitle.Text = aDImageListModel.AdImageTitle;//图片名称 `
         txbADLink.Text = aDImageListModel.ADLink;//链接地址
         txbADContent.Text = aDImageListModel.ADContent;//内容简介
         ViewState["fileADImagePath"] = aDImageListModel.ADImagePath.ToString();//图片地址
         ViewState["AdminGUID"] = aDImageListModel.ADImageGUID.ToString();
         ToolbarText2.Text = "编辑一个图片";
     }
     btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
 }
Пример #5
0
 public string Get_ADImageList()
 {
     zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
     System.Data.DataTable dt = aDImageListBLL.GetList("IsEnable=1 order by PublishDate desc").Tables[0];
     System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
     for (int nCount = 0; nCount < dt.Rows.Count; nCount++)
     {
         if (dt.Rows[0]["ADLink"].ToString() == "")
         {
             strBuilder.Append("<li><img src='" + dt.Rows[nCount]["ADImagePath"].ToString().Split('~')[1] + "'/></li>");
         }
         else
         {
             strBuilder.Append("<li><a href='" + dt.Rows[nCount]["ADLink"].ToString().Split('~')[1] + "'><img style='border:0px;' src='" + dt.Rows[nCount]["ADImagePath"].ToString() + "'/></a></li>");
         }
     }
     return strBuilder.ToString();
 }
Пример #6
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0)
            {
                string strSelectID = "0";
                for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++)
                {
                    int rowIndex = grid1.SelectedRowIndexArray[i];
                    foreach (object key in grid1.DataKeys[rowIndex])
                    {
                        strSelectID = key.ToString();
                    }
                }
                #region 删除逻辑

                zlzw.BLL.ADImageListBLL aDImageListBLL = new zlzw.BLL.ADImageListBLL();
                DataTable dt = aDImageListBLL.GetList("ADImageGUID='" + strSelectID + "'").Tables[0];
                zlzw.Model.ADImageListModel aDImageListModel = aDImageListBLL.GetModel(int.Parse(dt.Rows[0]["ADImageID"].ToString()));
                aDImageListModel.IsEnable = 0;
                aDImageListBLL.Update(aDImageListModel);
                ADImageList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }