/// <summary>
        /// 广告位置添加
        /// </summary>
        /// <returns></returns>
        public ActionResult AdertPositionEdit()
        {
            //BLL.ProductTypeBase ptbll = new BLL.ProductTypeBase();
            //List<Model.ProductTypeBase> modelType = ptbll.GetModelList(" pt_ParentId = 0 and pt_IsDel=0");

            //List<SelectListItem> selectType = new List<SelectListItem>();
            //selectType = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "-1" } };
            //for (int i = 0; i < modelType.Count; i++)
            //{
            //    selectType.Add(new SelectListItem
            //    {
            //        Value = modelType[i].pt_ID.ToString(),
            //        Text = modelType[i].pt_Name
            //    });
            //}
            //ViewData["AdertType"] = new SelectList(selectType, "Value", "Text", "请选择");
            //List<SelectListItem> select1 = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "-1" }, new SelectListItem { Text = "左边", Value = "0" }, new SelectListItem { Text = "下边", Value = "1" } };
            //ViewData["XianshiPosition"] = new SelectList(select1, "Value", "Text", "请选择");
            ViewData["otype"] = RequestBase.GetString("otype");
            if (RequestBase.GetString("p_ID") != null && RequestBase.GetString("p_ID") != "")
            {
                Model.AdertPositionBase apmodel = new Model.AdertPositionBase();
                apmodel = new BLL.AdertPositionBase().GetModel(int.Parse(RequestBase.GetString("p_ID")));

                Model.AdertPositionBase adert = new BLL.AdertPositionBase().GetModel(int.Parse(RequestBase.GetString("p_ID")));
                //DataSet ptdataset = new BLL.ProductTypeBase().GetList(" pt_Name='" + adert.p_PositionExplain + "'");
                //int ptid = int.Parse(ptdataset.Tables[0].Rows[0]["pt_ID"].ToString());
                //ViewData["AdertType"] = new SelectList(selectType, "Value", "Text", ptid);

                //if (adert.p_showposition == "0")//广告位置在左边时
                //{
                //    ViewData["XianshiPosition"] = new SelectList(select1, "Value", "Text", 0);
                //}
                //else
                //{
                //    ViewData["XianshiPosition"] = new SelectList(select1, "Value", "Text", 1);
                //}
                return View(adert);
            }
            else
            {
                return View();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.AdertPositionBase DataRowToModel(DataRow row)
 {
     Model.AdertPositionBase model = new Model.AdertPositionBase();
     if (row != null)
     {
         if (row["p_ID"] != null && row["p_ID"].ToString() != "")
         {
             model.p_ID = int.Parse(row["p_ID"].ToString());
         }
         if (row["p_PositionName"] != null)
         {
             model.p_PositionName = row["p_PositionName"].ToString();
         }
         if (row["p_PositionExplain"] != null)
         {
             model.p_PositionExplain = row["p_PositionExplain"].ToString();
         }
         if (row["p_CreateDate"] != null && row["p_CreateDate"].ToString() != "")
         {
             model.p_CreateDate = DateTime.Parse(row["p_CreateDate"].ToString());
         }
         if (row["p_CreateUser"] != null && row["p_CreateUser"].ToString() != "")
         {
             model.p_CreateUser = new Guid(row["p_CreateUser"].ToString());
         }
         if (row["p_Status"] != null && row["p_Status"].ToString() != "")
         {
             model.p_Status = int.Parse(row["p_Status"].ToString());
         }
         if (row["p_Delete"] != null && row["p_Delete"].ToString() != "")
         {
             model.p_Delete = int.Parse(row["p_Delete"].ToString());
         }
         if (row["p_showposition"] != null)
         {
             model.p_showposition = row["p_showposition"].ToString();
         }
         if (row["p_producttype"] != null && row["p_producttype"].ToString() != "")
         {
             model.p_producttype = int.Parse(row["p_producttype"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete()
        {
            string pid = RequestBase.GetString("p_ID");
            Model.AdertPositionBase apmodel = new Model.AdertPositionBase();
            apmodel = new BLL.AdertPositionBase().GetModel(int.Parse(pid));
            bool result = false;
            try
            {
                if (apmodel.p_PositionExplain == "1")
                {
                    return Content(DWZUtil.GetResultJson("300", "删除失败!!此广告位为固定广告位不能进行此操作!", "", "", ""));
                }
                else
                {
                    Model.AdertPositionBase adertposition = apbll.GetModel(int.Parse(RequestBase.GetString("p_ID")));
                    adertposition.p_Delete = 1;
                    result = apbll.Update(adertposition);
                    if (result)
                    {
                        return Content(DWZUtil.GetAjaxTodoJson("200", "删除成功!!", "w_广告位置管理", "", "forward", "AdertPositionBox", ""));
                    }
                    else
                    {
                        return Content(DWZUtil.GetResultJson("300", "删除失败!!", "", "", ""));
                    }
                }

            }
            catch
            {
                return Content(DWZUtil.GetResultJson("300", "删除失败!!", "", "", ""));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.AdertPositionBase GetModel(int p_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 p_ID,p_PositionName,p_PositionExplain,p_CreateDate,p_CreateUser,p_Status,p_Delete,p_showposition,p_producttype from AdertPositionBase ");
            strSql.Append(" where p_ID=@p_ID");
            SqlParameter[] parameters = {
                    new SqlParameter("@p_ID", SqlDbType.Int,4)
            };
            parameters[0].Value = p_ID;

            Model.AdertPositionBase model = new Model.AdertPositionBase();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }