Exemplo n.º 1
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "")
        {
            MessageBox.Show(this, "请正确填写信息再提交保存!");
            return;
        }

        Mod_Information dto = new Mod_Information();

        if (id != 0)
        {
            dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID));
        }

        dto.Title    = txtTitle.Text.Trim();
        dto.Content1 = txtContent.Text.Trim();

        //dto.SubTitle = txtSubTitle.Text.Trim();

        dto.WebSiteID    = AdminManage.WebSiteID;
        dto.Model        = Model;
        dto.ModifyDate   = DateTime.Now;
        dto.Image        = txtImage.Text.Trim();
        dto.FileURL      = txtVideo.Text.Trim();
        dto.Introduction = txtIntroduction.Text;
        if (id == 0)
        {
            dto.UserID = AdminManage.AdminID;
            dto.UID    = BInformation.Add(dto);
            dto.ID     = dto.UID;
        }
        BInformation.Update(dto);

        if (dto.ID != 0)
        {
            Dal_PicList DPicList = new Dal_PicList();
            DPicList.OperateList(SetPicList(dto), dto.ID, AdminManage.WebSiteID, false);
        }

        MessageBox.ShowRedirect(this, "信息保存成功!");
    }
Exemplo n.º 2
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "" || !StringHelper.IsNumberId(txtOrderBy.Text.Trim()) || !StringHelper.IsNumberId(txtBrowseCount.Text.Trim()))
        {
            MessageBox.Show(this, "请正确填写信息再提交保存!");
            return;
        }

        Mod_Information dto = new Mod_Information();

        if (id != 0)
        {
            dto = BInformation.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID));
        }

        dto.Title    = txtTitle.Text.Trim();
        dto.SubTitle = txtSubTitle.Text.Trim();
        dto.TypeID   = int.Parse(ddlBaseType.SelectedValue);
        string tagsStr = string.Empty;



        dto.Image         = txtImage.Text.Trim();
        dto.FileURL       = txtVideo.Text.Trim();
        dto.CitationTitle = txtCitationTitle.Text.Trim();


        foreach (ListItem item in cblShow.Items)
        {
            switch (item.Value)
            {
            case "1":
                dto.State = item.Selected ? 1 : 0;
                break;

            case "2":
                dto.IsTop = item.Selected ? 1 : 0;
                break;

            case "3":
                dto.IsCommend = item.Selected ? 1 : 0;
                break;
            }
        }


        dto.Content1    = txtContent1.Text.Trim();
        dto.OrderBy     = int.Parse(txtOrderBy.Text.Trim());
        dto.BrowseCount = int.Parse(txtBrowseCount.Text.Trim());
        dto.AddDate     = DateTime.Parse(txtAddDate.Value.Trim());
        dto.CommendDate = DateTime.Parse(CommendDate.Value.Trim());

        dto.WebSiteID  = AdminManage.WebSiteID;
        dto.Model      = Model;
        dto.ModifyDate = DateTime.Now;

        dto.Source = txtSource.Text.Trim();
        dto.Author = txtAuthor.Text.Trim();



        //string Brands = string.Empty;
        //foreach (ListItem item in lbIntroduction.Items)
        //{
        //    if (item.Selected)
        //    {
        //        Brands += item.Value + ",";
        //    }
        //}
        //dto.Introduction = Brands.Trim(',');


        //Brands = string.Empty;
        //foreach (ListItem item in lbLink.Items)
        //{
        //    if (item.Selected)
        //    {
        //        Brands += item.Value + ",";
        //    }
        //}
        //dto.Link = Brands.Trim(',');



        dto.Introduction = lbIntroduction.SelectedValue;
        dto.Link         = lbLink.SelectedValue;



        //for (int i = 0; i < 6; i++)
        //{
        if (id == 0)
        {
            dto.UserID = AdminManage.AdminID;
            dto.UID    = BInformation.Add(dto);
            dto.ID     = dto.UID;
        }
        BInformation.Update(dto);

        if (dto.ID != 0)
        {
            Dal_PicList DPicList = new Dal_PicList();
            DPicList.OperateList(SetPicList(dto), dto.ID, AdminManage.WebSiteID, false);
        }

        //}

        MessageBox.ShowRedirect(this, "信息保存成功!", "Column/Download/List.aspx?" + StringHelper.DelUrlParameter("ID"));
    }
Exemplo n.º 3
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim() == "")
        {
            MessageBox.Show(this, "带*的是必须项或是必选项,请填写完整再提交保存!");
            return;
        }


        if (id != 0)
        {
            WebSite.Model.Mod_BaseType dto = new WebSite.Model.Mod_BaseType();

            dto          = BBaseType.GetModel(string.Format("ID={0} AND WebSiteID={1}", id, AdminManage.WebSiteID));
            dto.ParentID = int.Parse(ddlBaseType.SelectedValue);
            dto.Model    = txtModel.Text.Trim();
            dto.Title    = txtTitle.Text.Trim();
            dto.Image    = txtImage.Text.Trim();
            dto.FileURl  = txtFileURl.Text.Trim();


            dto.OrderBy     = int.Parse(txtOrderBy.Text.Trim());
            dto.State       = int.Parse(rblState.SelectedValue);
            dto.IsAdmin     = int.Parse(rblIsAdmin.SelectedValue);
            dto.DisplayMode = int.Parse(rblDisplayMode.SelectedValue);
            dto.IsRecommend = int.Parse(rblIsRecommend.SelectedValue);
            dto.IsUser      = int.Parse(rblIsUser.SelectedValue);


            dto.IsUser = int.Parse(rblIsUser.SelectedValue);

            dto.IncludeType = txtIncludeType.Text.Trim();
            dto.Link        = txtLink.Text.Trim();
            dto.Info        = txtInfo.Text.Trim();
            dto.Content     = txtContent.Text.Trim();
            dto.WebSiteID   = AdminManage.WebSiteID;

            BBaseType.Update(dto, true);
            if (dto.ParentID == 0)
            {
                dto.IDPath = dto.ID.ToString();
            }
            else
            {
                dto.IDPath = BBaseType.GetModel(string.Format("ID={0} AND WebSiteID={1}", dto.ParentID, AdminManage.WebSiteID)).IDPath + "," + dto.ID;
            }
            BBaseType.Update(dto, true);

            //操作图片集
            Dal_PicList DPicList = new Dal_PicList();
            DPicList.OperateList(SetPicList(), dto.ID, AdminManage.WebSiteID, false);
        }
        else
        {
            WebSite.Model.Mod_BaseType dto = new WebSite.Model.Mod_BaseType();
            dto.Title   = txtTitle.Text.Trim();
            dto.Image   = txtImage.Text.Trim();
            dto.FileURl = txtFileURl.Text.Trim();

            //添加新数据
            string[] titleArr = dto.Title.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < titleArr.Length; i++)
            {
                if (titleArr[i] == "")
                {
                    continue;
                }
                dto.Title       = titleArr[i];
                dto.IncludeType = txtIncludeType.Text.Trim();
                dto.Link        = txtLink.Text.Trim();
                dto.Info        = txtInfo.Text.Trim();
                dto.ParentID    = int.Parse(ddlBaseType.SelectedValue);
                dto.State       = int.Parse(rblState.SelectedValue);
                dto.IsAdmin     = int.Parse(rblIsAdmin.SelectedValue);
                dto.DisplayMode = int.Parse(rblDisplayMode.SelectedValue);
                dto.IsRecommend = int.Parse(rblIsRecommend.SelectedValue);
                dto.IsUser      = int.Parse(rblIsUser.SelectedValue);
                dto.Content     = txtContent.Text.Trim();
                dto.OrderBy     = int.Parse(txtOrderBy.Text.Trim());
                dto.WebSiteID   = AdminManage.WebSiteID;
                dto.Model       = txtModel.Text.Trim();
                dto.AddDate     = DateTime.Now;
                dto.UID         = BBaseType.Add(dto, true);
                dto.ID          = dto.UID;
                if (dto.ParentID == 0)
                {
                    dto.IDPath = dto.ID.ToString();
                }
                else
                {
                    dto.IDPath = BBaseType.GetModel(string.Format("ID={0} AND WebSiteID={1}", dto.ParentID, AdminManage.WebSiteID)).IDPath + "," + dto.ID;
                }
                BBaseType.Update(dto, true);

                //操作图片集
                Dal_PicList DPicList = new Dal_PicList();
                DPicList.OperateList(SetPicList(), dto.ID, AdminManage.WebSiteID, false);
            }
        }



        MessageBox.ShowRedirect(this, "信息(" + txtTitle.Text.Trim() + ")保存成功!", "Column/BaseType/List.aspx?" + StringHelper.DelUrlParameter("ID"));
    }