Esempio n. 1
0
 public int Add(M_Image model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] {
         new SqlParameter("@ColId", SqlDbType.Int, 4), new SqlParameter("@Title", SqlDbType.NVarChar), new SqlParameter("@TitleColor", SqlDbType.NVarChar), new SqlParameter("@TitleFontType", SqlDbType.Int, 4), new SqlParameter("@TitleType", SqlDbType.Int, 4), new SqlParameter("@TitleImgPath", SqlDbType.VarChar, 255), new SqlParameter("@UId", SqlDbType.Int, 4), new SqlParameter("@UName", SqlDbType.NVarChar), new SqlParameter("@UserType", SqlDbType.Int, 4), new SqlParameter("@AdminUId", SqlDbType.Int, 4), new SqlParameter("@AdminUName", SqlDbType.Char, 10), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@HitCount", SqlDbType.Int, 4), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@TemplatePath", SqlDbType.VarChar, 255),
         new SqlParameter("@PageType", SqlDbType.Int, 4), new SqlParameter("@IsCreated", SqlDbType.Bit, 1), new SqlParameter("@UserCateId", SqlDbType.Int, 4), new SqlParameter("@PointCount", SqlDbType.Int, 4), new SqlParameter("@ChargeType", SqlDbType.Int, 4), new SqlParameter("@ChargeHourCount", SqlDbType.Int, 4), new SqlParameter("@ChargeViewCount", SqlDbType.Int, 4), new SqlParameter("@IsOpened", SqlDbType.Int, 4), new SqlParameter("@GroupIdStr", SqlDbType.VarChar, 0x3e8), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@IsRecommend", SqlDbType.Bit, 1), new SqlParameter("@IsTop", SqlDbType.Bit, 1), new SqlParameter("@IsFocus", SqlDbType.Bit, 1), new SqlParameter("@IsSideShow", SqlDbType.Bit, 1), new SqlParameter("@TagIdStr", SqlDbType.VarChar, 300), new SqlParameter("@IsAllowComment", SqlDbType.Bit, 1),
         new SqlParameter("@TagNameStr", SqlDbType.NVarChar), new SqlParameter("@SpecialIdStr", SqlDbType.VarChar, 500), new SqlParameter("@Content", SqlDbType.NText), new SqlParameter("@ImgPath", SqlDbType.NText), new SqlParameter("@Identity", SqlDbType.Int, 4)
      };
     commandParameters[0].Value = model.ColId;
     commandParameters[1].Value = model.Title;
     commandParameters[2].Value = model.TitleColor;
     commandParameters[3].Value = model.TitleFontType;
     commandParameters[4].Value = model.TitleType;
     commandParameters[5].Value = model.TitleImgPath;
     commandParameters[6].Value = model.UId;
     commandParameters[7].Value = model.UName;
     commandParameters[8].Value = model.UserType;
     commandParameters[9].Value = model.AdminUId;
     commandParameters[10].Value = model.AdminUName;
     commandParameters[11].Value = model.Status;
     commandParameters[12].Value = model.HitCount;
     commandParameters[13].Value = model.AddTime;
     commandParameters[14].Value = model.UpdateTime;
     commandParameters[15].Value = model.TemplatePath;
     commandParameters[16].Value = model.PageType;
     commandParameters[17].Value = model.IsCreated;
     commandParameters[18].Value = model.UserCateId;
     commandParameters[19].Value = model.PointCount;
     commandParameters[20].Value = model.ChargeType;
     commandParameters[21].Value = model.ChargeHourCount;
     commandParameters[22].Value = model.ChargeViewCount;
     commandParameters[23].Value = model.IsOpened;
     commandParameters[24].Value = model.GroupIdStr;
     commandParameters[25].Value = model.IsDeleted;
     commandParameters[26].Value = model.IsRecommend;
     commandParameters[27].Value = model.IsTop;
     commandParameters[28].Value = model.IsFocus;
     commandParameters[29].Value = model.IsSideShow;
     commandParameters[30].Value = model.TagIdStr;
     commandParameters[31].Value = model.IsAllowComment;
     commandParameters[32].Value = model.TagNameStr;
     commandParameters[33].Value = model.SpecialIdStr;
     commandParameters[34].Value = model.Content;
     commandParameters[35].Value = model.ImgPath;
     commandParameters[36].Value = 0;
     commandParameters[36].Direction = ParameterDirection.Output;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Image_Add", commandParameters);
     return (int) commandParameters[36].Value;
 }
Esempio n. 2
0
 public void Update(M_Image model)
 {
     this.dal.Update(model);
 }
Esempio n. 3
0
 public int Add(M_Image model)
 {
     return this.dal.Add(model);
 }
Esempio n. 4
0
 public M_Image GetItem(int imgId)
 {
     DataRow info = this.InfoOper.GetInfo("kyimage", imgId);
     if (info == null)
     {
         return null;
     }
     M_Image image = new M_Image();
     image.Id = imgId;
     if (info["ColId"].ToString() != "")
     {
         image.ColId = int.Parse(info["ColId"].ToString());
     }
     image.Title = info["Title"].ToString();
     image.TitleColor = info["TitleColor"].ToString();
     if (info["TitleFontType"].ToString() != "")
     {
         image.TitleFontType = int.Parse(info["TitleFontType"].ToString());
     }
     if (info["TitleType"].ToString() != "")
     {
         image.TitleType = int.Parse(info["TitleType"].ToString());
     }
     image.TitleImgPath = info["TitleImgPath"].ToString();
     if (info["UId"].ToString() != "")
     {
         image.UId = int.Parse(info["UId"].ToString());
     }
     image.UName = info["UName"].ToString();
     if (info["UserType"].ToString() != "")
     {
         image.UserType = int.Parse(info["UserType"].ToString());
     }
     if (info["AdminUId"].ToString() != "")
     {
         image.AdminUId = int.Parse(info["AdminUId"].ToString());
     }
     image.AdminUName = info["AdminUName"].ToString();
     if (info["Status"].ToString() != "")
     {
         image.Status = int.Parse(info["Status"].ToString());
     }
     if (info["HitCount"].ToString() != "")
     {
         image.HitCount = int.Parse(info["HitCount"].ToString());
     }
     if (info["AddTime"].ToString() != "")
     {
         image.AddTime = DateTime.Parse(info["AddTime"].ToString());
     }
     if (info["UpdateTime"].ToString() != "")
     {
         image.UpdateTime = DateTime.Parse(info["UpdateTime"].ToString());
     }
     image.TemplatePath = info["TemplatePath"].ToString();
     if (info["PageType"].ToString() != "")
     {
         image.PageType = int.Parse(info["PageType"].ToString());
     }
     if (info["IsCreated"].ToString() != "")
     {
         if ((info["IsCreated"].ToString() == "1") || (info["IsCreated"].ToString().ToLower() == "true"))
         {
             image.IsCreated = true;
         }
         else
         {
             image.IsCreated = false;
         }
     }
     if (info["UserCateId"].ToString() != "")
     {
         image.UserCateId = int.Parse(info["UserCateId"].ToString());
     }
     if (info["PointCount"].ToString() != "")
     {
         image.PointCount = int.Parse(info["PointCount"].ToString());
     }
     if (info["ChargeType"].ToString() != "")
     {
         image.ChargeType = int.Parse(info["ChargeType"].ToString());
     }
     if (info["ChargeHourCount"].ToString() != "")
     {
         image.ChargeHourCount = int.Parse(info["ChargeHourCount"].ToString());
     }
     if (info["ChargeViewCount"].ToString() != "")
     {
         image.ChargeViewCount = int.Parse(info["ChargeViewCount"].ToString());
     }
     if (info["IsOpened"].ToString() != "")
     {
         image.IsOpened = int.Parse(info["IsOpened"].ToString());
     }
     image.GroupIdStr = info["GroupIdStr"].ToString();
     if (info["IsDeleted"].ToString() != "")
     {
         if ((info["IsDeleted"].ToString() == "1") || (info["IsDeleted"].ToString().ToLower() == "true"))
         {
             image.IsDeleted = true;
         }
         else
         {
             image.IsDeleted = false;
         }
     }
     if (info["IsRecommend"].ToString() != "")
     {
         if ((info["IsRecommend"].ToString() == "1") || (info["IsRecommend"].ToString().ToLower() == "true"))
         {
             image.IsRecommend = true;
         }
         else
         {
             image.IsRecommend = false;
         }
     }
     if (info["IsTop"].ToString() != "")
     {
         if ((info["IsTop"].ToString() == "1") || (info["IsTop"].ToString().ToLower() == "true"))
         {
             image.IsTop = true;
         }
         else
         {
             image.IsTop = false;
         }
     }
     if (info["IsFocus"].ToString() != "")
     {
         if ((info["IsFocus"].ToString() == "1") || (info["IsFocus"].ToString().ToLower() == "true"))
         {
             image.IsFocus = true;
         }
         else
         {
             image.IsFocus = false;
         }
     }
     if (info["IsSideShow"].ToString() != "")
     {
         if ((info["IsSideShow"].ToString() == "1") || (info["IsSideShow"].ToString().ToLower() == "true"))
         {
             image.IsSideShow = true;
         }
         else
         {
             image.IsSideShow = false;
         }
     }
     image.TagIdStr = info["TagIdStr"].ToString();
     if (info["IsAllowComment"].ToString() != "")
     {
         if ((info["IsAllowComment"].ToString() == "1") || (info["IsAllowComment"].ToString().ToLower() == "true"))
         {
             image.IsAllowComment = true;
         }
         else
         {
             image.IsAllowComment = false;
         }
     }
     image.TagNameStr = info["TagNameStr"].ToString();
     image.SpecialIdStr = info["SpecialIdStr"].ToString();
     image.Content = info["Content"].ToString();
     image.ImgPath = info["ImgPath"].ToString();
     return image;
 }
Esempio n. 5
0
    /// <summary>
    /// 添加/修改
    /// </summary>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        CheckInput();
        if (flag != "Update")//说明是新增
        {
            model = new M_Image();
            //model.AddTime = DateTime.Now;

            //添加时间
            if (txtAddTime.Text.Trim().Length != 0)
            {
                if (Function.IsDate(txtAddTime.Text.Trim().ToString()))
                    model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString());
                else
                    Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
            }
            else
                model.AddTime = DateTime.Now;

            model.IsCreated = false;
            model.IsDeleted = false;
            model.Status = 3;
        }
        else
        {
            //添加时间
            if (txtAddTime.Text.Trim().Length != 0)
            {
                if (Function.IsDate(txtAddTime.Text.Trim().ToString()))
                    model.AddTime = DateTime.Parse(txtAddTime.Text.Trim().ToString());
                else
                    Function.ShowSysMsg(0, "<li>你输入的日期格式不对</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
            }
            else
                model.AddTime = DateTime.Now;
        }
        model.AdminUId = adminModel.UserId;
        model.AdminUName = adminModel.AdminName;
        model.ChargeHourCount = Function.CheckNumber(txtChargeHourCount.Text) == true ? int.Parse(txtChargeHourCount.Text) : 0;
        for (int i = 1; i < 7; i++)
        {
            RadioButton chargType = Page.FindControl("rdBtnChargeType" + i) as RadioButton;
            if (chargType.Checked)
            {
                model.ChargeType = i;
                break;
            }
        }
        model.ChargeViewCount = Function.CheckNumber(txtChargeViewCount.Text) == true ? int.Parse(txtChargeViewCount.Text) : 0;
        model.ColId = int.Parse(Request.Form["ddlColumn"]);
        B_SiteInfo site=new B_SiteInfo();
        model.Content = site.GetFiltering(txtContent.Text);
        string GroupId="";
        for (int i = 0; i < UserGroup.Items.Count; i++)
        {
            if (UserGroup.Items[i].Selected)
            {
                GroupId += "|"+UserGroup.Items[i].Value;
            }
        }
        model.GroupIdStr = GroupId == "" ? "" : GroupId + "|";
        model.HitCount = Function.CheckNumber(txtHitCount.Text) == true ? int.Parse(txtHitCount.Text) : 0;
        model.ImgPath = string.IsNullOrEmpty(Request.Form["imgs"]) == true ? "" : "|" + Request.Form["imgs"].Replace(",", "|") + "|";
        model.IsAllowComment = property.Items[4].Selected;
        model.IsFocus = property.Items[2].Selected;
        model.IsOpened = int.Parse(rblIsOpened.SelectedValue);
        model.IsRecommend = property.Items[0].Selected;
        model.IsSideShow = (!rbTextTitle.Checked) && property.Items[3].Selected;
        model.IsTop = property.Items[1].Selected;
        model.PageType = rblPageType.SelectedIndex + 1;
        model.PointCount = Function.CheckNumber(txtPointCount.Text) == true ? int.Parse(txtPointCount.Text) : 0;
        string spclId = "";
        for (int i = 0; i < lBoxTopicIdStr.Items.Count; i++)
        {
            if (lBoxTopicIdStr.Items[i].Selected)
            {
                spclId += "|" + lBoxTopicIdStr.Items[i].Value + "|";
            }
        }
        model.SpecialIdStr = spclId;
        #region 关键字
        string tagIdStr = string.Empty;
        string nameStr = txtTagNameStr.Text.Trim();
        nameStr = Regex.Replace(nameStr, @"\s+", "|", RegexOptions.IgnoreCase);
        if (nameStr.Length != 0)
        {
            if (nameStr.StartsWith("|"))
                nameStr = nameStr.Substring(1, nameStr.Length - 1);
            if (nameStr.EndsWith("|"))
                nameStr = nameStr.Substring(0, nameStr.Length - 1);
            B_Tag tagBll = new B_Tag();
            DataRow dr = tagBll.AddTagStr(nameStr, ChannelModel.ModelType, 0, "后台管理员");
            if (dr != null)
            {
                tagIdStr = "|" + dr[0] + "|";
                nameStr = "|" + dr[1] + "|";
            }
            else
            {
                tagIdStr = "";
                nameStr = "";
            }
        }
        model.TagIdStr = tagIdStr;
        model.TagNameStr = nameStr;
        #endregion
        model.TemplatePath = txtTemplatePath.Text;
        model.Title = site.GetFiltering(txtTitle.Text);
        model.TitleColor = txtHeaderColor.Text;
        model.TitleFontType = int.Parse(ddlFontType.SelectedValue);
        model.TitleImgPath = rbPicTitle.Checked ? txtPicTitlePath.Text : "";
        model.TitleType = rbTextTitle.Checked ? 1 : 2;
        model.UId = adminModel.UserId;
        model.UName = adminModel.AdminName;
        model.UpdateTime = DateTime.Now;
        model.UserType = 1;

        if (flag != "Update")
        {
            ImgId = imageBll.Add(model);

            if (property.Items[5].Selected)
            {
                DataRow dr = CreateBll.GetInfoById("kyimage", ImgId);
                CreateBll.CreateInfo(dr);
            }

            Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]);
        }
        else
        {
            imageBll.Update(model);
            if (property.Items[5].Selected)
            {
                DataRow dr = CreateBll.GetInfoById("kyimage", ImgId);
                CreateBll.CreateSingleInfo(dr);
            }
            Response.Redirect("InfoList.aspx?ChId=" + ChannelId + "&ColId=" + Request.Form["ddlColumn"]);
        }
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminBll.CheckMulitLogin();
        adminModel = admin.GetLoginModel();
        M_InfoModel infoModel = InfoModelBll.GetModel(2);
        FilePicPath.Text = infoModel.UploadPath + "|" + infoModel.UploadSize;
        AdminUserModel = AdminBll.GetModel(adminModel.UserId);
        if (!string.IsNullOrEmpty(Request.QueryString["ChId"]))
        {
            ChannelId = Function.CheckNumberNotZero(Request.QueryString["ChId"]) == true ? int.Parse(Request.QueryString["ChId"]) : 0;
        }
        if (!string.IsNullOrEmpty(Request.QueryString["ColId"]))
        {
            ColId = Function.CheckNumber(Request.QueryString["ColId"]) ? int.Parse(Request.QueryString["ColId"]) : 0;
        }
        ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId);
        if (ChannelModel == null || ChannelModel.ModelType != 2)
        {
            Function.ShowSysMsg(0,"<li>频道参数错误</li><li><a href='javascript:window.history.back();'>返回上一步</a></li>");
            return;
        }
        litNav.Text = ChannelModel.TypeName + "管理 &gt;&gt; <a href='InfoList.aspx?ChId=" + ChannelId + "'>站点" + ChannelModel.TypeName + "列表</a>&gt;&gt;设置" + ChannelModel.TypeName;
        txtTemplatePath.Attributes.Add("readonly", "readonly");

        if (!IsPostBack)
        {
            BindData();
        }

        if (Request.QueryString["ChId"] != null && Request.QueryString["ColId"] != null && Request.QueryString["Id"] != null)
        {
            ColId = Function.CheckNumber(Request.QueryString["ColId"]) == true ? int.Parse(Request.QueryString["ColId"]) : 0;
            ImgId = Function.CheckNumber(Request.QueryString["Id"]) == true ? int.Parse(Request.QueryString["Id"]) : 0;
            if (ImgId > 0 && !AdminGroupBll.Power_Channel(ChannelId, ColId, AdminUserModel.GroupId, 3))
            {
                Function.ShowSysMsg(0, "<li>你没有该栏目下的修改权限</li>");
            }
            model = imageBll.GetItem(ImgId);
            if (ChannelId > 0 && ColId > 0 && ImgId > 0 && model != null)
            {
                flag = "Update";
                if (!IsPostBack)
                {
                    BindDataOnUpdate();
                }
            }
            else
            {
                Function.ShowSysMsg(0,"<li>参数错误</li><li><a href='javascript:window.history.back();'>返回上一步</a></li>");
            }

        }
    }