Ejemplo n.º 1
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.LinkListBLL     linkListBLL   = new zlzw.BLL.LinkListBLL();
                zlzw.Model.LinkListModal linkListModal = linkListBLL.GetModel(int.Parse(strSelectID));
                linkListModal.IsEnable = 0;
                linkListBLL.Update(linkListModal);
                LinkList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 2
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.LinkListModal linkListModal = new zlzw.Model.LinkListModal();
                linkListModal.LinkType   = int.Parse(drpLinkType.SelectedValue);
                linkListModal.LinkTitle  = txbLinkTitle.Text;  //友情链接名称
                linkListModal.LinkTarget = txbLinkTarget.Text; //友情链接地址
                linkListModal.LinkDesc   = txbLinkDesc.Text;   //友情链接简介
                linkListModal.Other01    = txbSort.Text;       //排序
                if (btnImageUpload.PostedFile.ContentLength > 0)
                {
                    btnImageUpload.SaveAs(Server.MapPath(ViewState["LinkImages"].ToString()));
                    linkListModal.LinkImage = ViewState["LinkImages"].ToString();//友情链接Logo路径
                }
                else
                {
                    linkListModal.LinkImage = ViewState["LinkImages"].ToString();
                }
                linkListModal.IsEnable    = 1;
                linkListModal.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString());
                linkListModal.LinkID      = int.Parse(Request.QueryString["value"]);
                zlzw.BLL.LinkListBLL linkListBLL = new zlzw.BLL.LinkListBLL();
                linkListBLL.Update(linkListModal);
            }
            else
            {
                //添加保存

                zlzw.Model.LinkListModal linkListModal = new zlzw.Model.LinkListModal();
                linkListModal.LinkType   = int.Parse(drpLinkType.SelectedValue);
                linkListModal.LinkTitle  = txbLinkTitle.Text;  //友情链接名称
                linkListModal.LinkTarget = txbLinkTarget.Text; //友情链接地址
                linkListModal.LinkDesc   = txbLinkDesc.Text;   //友情链接简介
                linkListModal.Other01    = txbSort.Text;       //排序
                if (btnImageUpload.HasFile)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + btnImageUpload.FileName;
                    btnImageUpload.SaveAs(Server.MapPath("~/LinkImages/" + fileName));
                    linkListModal.LinkImage = "~/LinkImages/" + fileName;//友情链接Logo路径
                }
                else
                {
                    if (drpLinkType.SelectedValue == "0")
                    {
                        Alert.Show("请上传一张尺寸为166 * 55 的友情链接Logo", "错误提醒", MessageBoxIcon.Error);
                        return;
                    }
                }

                linkListModal.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
                linkListModal.IsEnable    = 1;
                zlzw.BLL.LinkListBLL linkListBLL = new zlzw.BLL.LinkListBLL();
                linkListBLL.Add(linkListModal);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }