Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(ROYcms.Sys.Model.ROYcms_product model)
        {
            //
            //级联更新  删除以前的分类关联  新建一个分类关联
            //

            ROYcms.Sys.BLL.ROYcms_Class_News   ROYcms_Class_product_bll   = new ROYcms.Sys.BLL.ROYcms_Class_News();
            ROYcms.Sys.Model.ROYcms_Class_News ROYcms_Class_product_model = new ROYcms.Sys.Model.ROYcms_Class_News();
            ROYcms.Sys.BLL.ROYcms_class        ROYcms_Class_bll           = new ROYcms.Sys.BLL.ROYcms_class();
            ROYcms.Sys.Model.ROYcms_class      ROYcms_Class_model         = ROYcms_Class_bll._GetModel(model.classname.ToString());

            //删除
            ROYcms_Class_product_bll.Delete(" (news_id=" + model.bh + ") AND (Class=" + GetClassName(model.bh) + ") ");
            //添加
            ROYcms_Class_product_model.news_id    = model.bh;
            ROYcms_Class_product_model.Class      = Convert.ToInt32(model.classname);
            ROYcms_Class_product_model.class_id   = ROYcms_Class_model.ClassId;
            ROYcms_Class_product_model.class_list = ROYcms_Class_model.ClassList;
            ROYcms_Class_product_model.Time       = DateTime.Now;
            ROYcms_Class_product_model.GUID       = model.GUID;
            ROYcms_Class_product_bll.Add(ROYcms_Class_product_model);

            dal.Update(model);
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int  Add(ROYcms.Sys.Model.ROYcms_product model)
        {
            int news_id = dal.Add(model);

            //
            //级联添加
            //
            if (news_id != 1)
            {
                ROYcms.Sys.BLL.ROYcms_Class_News   ROYcms_Class_product_bll   = new ROYcms.Sys.BLL.ROYcms_Class_News();
                ROYcms.Sys.Model.ROYcms_Class_News ROYcms_Class_product_model = new ROYcms.Sys.Model.ROYcms_Class_News();
                ROYcms.Sys.BLL.ROYcms_class        ROYcms_Class_bll           = new ROYcms.Sys.BLL.ROYcms_class();
                ROYcms.Sys.Model.ROYcms_class      ROYcms_Class_model         = ROYcms_Class_bll._GetModel(model.classname.ToString());

                ROYcms_Class_product_model.news_id    = news_id;
                ROYcms_Class_product_model.Class      = Convert.ToInt32(model.classname);
                ROYcms_Class_product_model.class_id   = ROYcms_Class_model.ClassId;
                ROYcms_Class_product_model.class_list = ROYcms_Class_model.ClassList;
                ROYcms_Class_product_model.Time       = DateTime.Now;
                ROYcms_Class_product_model.GUID       = model.GUID;
                ROYcms_Class_product_bll.Add(ROYcms_Class_product_model);
            }
            return(news_id);
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 protected void Page_Load(object sender, EventArgs e)
 {
     ViewState["Class"] = ROYcms.Common.Request.GetQueryInt("Id");
     Model = ClassBll._GetModel(ViewState["Class"].ToString());
 }
Пример #4
0
        /// <summary>
        /// 添加一个频道
        /// </summary>
        public int Insert()
        {
            Model.Id = ROYcms.Common.Request.GetFormInt("Id");
            if (Model.Id > 0) //   如果是编辑
            {
                Model = BLL._GetModel(Model.Id.ToString());
            }
            else
            {
                Model.ClassId = ROYcms.Common.StringPlus.GetRamCode();
                string ClassList = "";                                                                                                          //栏目包含列表
                string ClassPre  = ROYcms.Common.Request.GetFormString("ClassId") == "" ? "0" : ROYcms.Common.Request.GetFormString("ClassId"); //父亲级ID
                int    ClassTj   = 1;                                                                                                           //栏目深度
                if (ClassPre == "0")                                                                                                            //是顶层
                {
                    ClassList = Model.ClassId + ",";
                    ClassTj   = 1;
                }
                else
                {
                    DataSet ds = new ROYcms.Sys.BLL.ROYcms_class().GetClassListByClassId(ClassPre);

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        ClassList = dr["ClassList"].ToString().Trim() + Model.ClassId + ",";
                        ClassTj   = Convert.ToInt32(dr["ClassTj"]) + 1;
                    }
                }
                Model.ClassList = ClassList;
                Model.ClassPre  = ClassPre;
                Model.ClassTj   = ClassTj;
            }

            Model.ClassName = ROYcms.Common.Request.GetFormString("ClassName");
            Model.ClassKind = ROYcms.Common.Request.GetFormInt("ClassKind");

            Model.ClassOrder    = 0;
            Model.ListType      = 0;
            Model.GoType        = 0;
            Model.ContentType   = 0;
            Model.DefaultFile   = ROYcms.Common.Request.GetFormString("DefaultFile");
            Model.FilePath      = ROYcms.Common.Request.GetFormString("FilePath");
            Model.ColumnsType   = ROYcms.Common.Request.GetFormInt("ColumnsType");
            Model.WebsiteUrl    = ROYcms.Common.Request.GetFormString("WebsiteUrl");
            Model.TemplateIndex = ROYcms.Common.Request.GetFormString("TemplateIndex");
            Model.TemplateList  = ROYcms.Common.Request.GetFormString("TemplateList");
            Model.TemplateShow  = ROYcms.Common.Request.GetFormString("TemplateShow");
            Model.ListeRules    = ROYcms.Common.Request.GetFormString("ListeRules");
            Model.ShowRules     = ROYcms.Common.Request.GetFormString("ShowRules");
            Model.keyword       = ROYcms.Common.Request.GetFormString("keyword");
            Model.Description   = ROYcms.Common.Request.GetFormString("Description");
            Model.contents      = ROYcms.Common.Request.GetFormString("contents");
            if (Model.Id > 0)
            {
                if (!BLL.Exists(Model.FilePath, Model.DefaultFile)) //不存在
                {
                    return(BLL.ClassUpdate(Model) == true ? 1 : 0);
                }
                else
                {
                    if (BLL.GetId(Model.FilePath, Model.DefaultFile) == Model.Id)//当前的地址
                    {
                        return(BLL.ClassUpdate(Model) == true ? 1 : 0);
                    }
                    else
                    {
                        return(-1);
                    }
                }
            }
            else
            {
                if (!BLL.Exists(Model.FilePath, Model.DefaultFile))
                {
                    return(BLL.ClassAdd(Model) == true ? 1 : 0);
                }
                else
                {
                    return(-1);
                }
            }
        }