예제 #1
0
    protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int id = DataConverter.CLng(e.CommandArgument);

        switch (e.CommandName.ToLower())
        {
        case "del":
        {
            proBll.RealDelByIDS(id.ToString());
        }
        break;
        }
        MyBind();
    }
예제 #2
0
 public int Product_RealDel(string ids)
 {
     if (!String.IsNullOrEmpty(ids))
     {
         proBll.RealDelByIDS(ids);
     }
     return(Success);
 }
예제 #3
0
        public ContentResult Product_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            //case "upmove":
            //    {
            //        M_Product product = proBll.GetproductByid(Mid);
            //        M_Product productPre = proBll.GetNearID(NodeID, product.OrderID, 1);           //int NodeID, int CurrentID, int UporDown
            //        if (productPre.OrderID != 0)
            //        {
            //            int CurrOrder = product.OrderID;
            //            product.OrderID = productPre.OrderID;
            //            productPre.OrderID = CurrOrder;
            //            proBll.UpdateOrder(product);
            //            proBll.UpdateOrder(productPre);
            //        }
            //    }
            //    break;
            //case "downmove":
            //    {
            //        M_Product product = proBll.GetproductByid(Mid);
            //        M_Product productPre = proBll.GetNearID(NodeID, product.OrderID, 0);
            //        if (productPre.ID != 0)
            //        {
            //            int CurrOrder = product.OrderID;
            //            product.OrderID = productPre.OrderID;
            //            productPre.OrderID = CurrOrder;
            //            proBll.UpdateOrder(product);
            //            proBll.UpdateOrder(productPre);
            //        }
            //    }
            //    break;
            case "refresh":    //刷新/重发布,将商品ctreatime和updatatime改为当前值
                SafeSC.CheckIDSEx(ids);
                string date = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                DBCenter.UpdateSQL(proBll.TbName, "AddTime='" + date + "',UpdateTime='" + date + "'", "ID IN (" + ids + ")");
                break;

            case "del":
                SafeSC.CheckIDSEx(ids);
                proBll.RealDelByIDS(ids);
                break;

            case "clear":
                proBll.ClearRecycle();
                break;

            default:
                proBll.setproduct(action, ids);
                break;
            }
            return(Content(Success.ToString()));
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            string ids = Request.Form["idchk"];

            if (string.IsNullOrEmpty(ids))
            {
                function.WriteErrMsg("未选中值");
            }
            else
            {
                bll.RealDelByIDS(ids); function.WriteSuccessMsg("删除成功");
            }
            DataBind();
        }
예제 #5
0
        protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            M_Product product    = new M_Product();
            M_Product productPre = new M_Product();

            switch (e.CommandName.ToLower())
            {
            case "upmove":
                product    = bll.GetproductByid(Convert.ToInt32(e.CommandArgument.ToString()));
                productPre = bll.GetNearID(NodeID, product.OrderID, 1);               //int NodeID, int CurrentID, int UporDown
                if (productPre.OrderID != 0)
                {
                    int CurrOrder = product.OrderID;
                    product.OrderID    = productPre.OrderID;
                    productPre.OrderID = CurrOrder;
                    bll.UpdateOrder(product);
                    bll.UpdateOrder(productPre);
                }
                break;

            case "downmove":
                product    = bll.GetproductByid(Convert.ToInt32(e.CommandArgument.ToString()));
                productPre = bll.GetNearID(NodeID, product.OrderID, 0);
                if (productPre.ID != 0)
                {
                    int CurrOrder = product.OrderID;
                    product.OrderID    = productPre.OrderID;
                    productPre.OrderID = CurrOrder;
                    bll.UpdateOrder(product);
                    bll.UpdateOrder(productPre);
                }
                break;

            case "del1":
                int  pid   = DataConverter.CLng(e.CommandArgument.ToString());
                bool delok = bll.RealDelByIDS(pid.ToString());
                break;

            default:
                break;
            }
            MyBind();
        }
예제 #6
0
        public void ProcessRequest(HttpContext context)
        {
            M_UserInfo mu = buser.GetLogin();

            retMod.retcode = M_APIResult.Failed;
            if (mu.IsNull)
            {
                retMod.retmsg = "用户未登录"; RepToClient(retMod);
            }
            int siteID = DataConvert.CLng(Req("SiteID"));

            //retMod.callback = CallBack;//暂不开放JsonP
            try
            {
                switch (Action)
                {
                case "mb_list":
                    #region
                {
                    string    fields = "wxico,wxsize,wxbk,flag,wxlink,content,dbtype";
                    DataTable dt     = GetListDT();
                    foreach (DataRow dr in dt.Rows)
                    {
                        M_CommonData conMod = conBll.SelReturnModel(Convert.ToInt32(dr["id"]));
                        //if (!conMod.Inputer.Equals(mu.UserName)) { continue; }
                        List <SqlParameter> sp1 = GetSPByDR(dr, "title");
                        List <SqlParameter> sp2 = GetSPByDR(dr, fields);
                        DBCenter.UpdateSQL("ZL_CommonModel", GetSet(sp1), "GeneralID=" + conMod.GeneralID, sp1);
                        DBCenter.UpdateSQL("ZL_C_Article", GetSet(sp2), "ID=" + conMod.ItemID, sp2);
                    }
                    retMod.retcode = M_APIResult.Success;
                }
                    #endregion
                    break;

                case "mb_nav":
                {
                    DataTable dt = GetListDT();
                    foreach (DataRow dr in dt.Rows)
                    {
                        M_CommonData conMod = conBll.SelReturnModel(Convert.ToInt32(dr["id"]));
                        //if (!conMod.Inputer.Equals(mu.UserName)) { continue; }
                        List <SqlParameter> sp1 = new List <SqlParameter>()
                        {
                            new SqlParameter("title", dr["title"].ToString())
                        };
                        List <SqlParameter> sp2 = new List <SqlParameter>()
                        {
                            new SqlParameter("wxico", dr["wxico"].ToString())
                        };
                        DBCenter.UpdateSQL("ZL_CommonModel", "Title=@title", "GeneralID=" + conMod.GeneralID, sp1);
                        DBCenter.UpdateSQL("ZL_C_Article", "wxico=@wxico", "ID=" + conMod.ItemID, sp2);
                    }
                    retMod.retcode = M_APIResult.Success;
                }
                break;

                case "mg_footbar":
                {
                    DataTable dt = GetListDT();
                    foreach (DataRow dr in dt.Rows)
                    {
                        M_CommonData conMod = conBll.SelReturnModel(Convert.ToInt32(dr["id"]));
                        //if (!conMod.Inputer.Equals(mu.UserName)) { continue; }
                        List <SqlParameter> sp1 = new List <SqlParameter>()
                        {
                            new SqlParameter("title", dr["title"].ToString())
                        };
                        List <SqlParameter> sp2 = new List <SqlParameter>()
                        {
                            new SqlParameter("wxico", dr["wxico"].ToString())
                        };
                        DBCenter.UpdateSQL("ZL_CommonModel", "Title=@title", "GeneralID=" + conMod.GeneralID, sp1);
                        DBCenter.UpdateSQL("ZL_C_Article", "wxico=@wxico", "ID=" + conMod.ItemID, sp2);
                    }
                    retMod.retcode = M_APIResult.Success;
                }
                break;

                case "mb_image":                  //更新单个内容的指定字段,是否需要扩展为,根据字段更新目标表,以减少代码
                {
                    string    flag = Req("flag"); //传了该值,则代表单条数据更新
                    DataTable dt   = GetListDT();
                    foreach (DataRow dr in dt.Rows)
                    {
                        List <SqlParameter> sp2 = new List <SqlParameter>()
                        {
                            new SqlParameter("wxico", dr["wxico"].ToString()),
                            new SqlParameter("flag", dr["flag"].ToString())
                        };
                        DBCenter.UpdateSQL("ZL_C_Article", "wxico=@wxico", "Flag=@flag", sp2);
                    }
                    retMod.retcode = M_APIResult.Success;
                }
                break;

                case "mb_byid":                                                        //主用于内容更新
                {
                    string    fields = "wxico,wxsize,wxbk,flag,wxlink,content,dbtype"; //dbtype
                    DataTable dt     = GetListDT();
                    foreach (DataRow dr in dt.Rows)
                    {
                        M_CommonData        conMod = conBll.SelReturnModel(Convert.ToInt32(dr["id"]));
                        List <SqlParameter> sp1    = GetSPByDR(dr, "title");
                        List <SqlParameter> sp2    = GetSPByDR(dr, fields);
                        DBCenter.UpdateSQL("ZL_CommonModel", GetSet(sp1), "GeneralID=" + conMod.GeneralID, sp1);
                        DBCenter.UpdateSQL("ZL_C_Article", GetSet(sp2), "ID=" + conMod.ItemID, sp2);
                    }
                    retMod.retcode = M_APIResult.Success;
                }
                break;

                case "mb_new":
                {
                    B_CodeModel codeBll  = new B_CodeModel("ZL_C_Article");
                    string      nodeName = Req("type").Equals("nav") ? "微站图片" : "微站内容";
                    DataTable   nodedt   = DBCenter.Sel("ZL_Node", "NodeBySite=" + siteID + " AND NodeName='" + nodeName + "'");
                    if (nodedt.Rows.Count < 1)
                    {
                        retMod.retmsg = nodeName + "节点不存在";
                    }
                    else
                    {
                        DataRow      dr     = GetListDT().Rows[0];
                        M_CommonData conMod = new M_CommonData();
                        DataRow      artdr  = codeBll.NewModel();
                        conMod.Title     = dr["title"].ToString();
                        conMod.Inputer   = mu.UserName;
                        conMod.Status    = (int)ZLEnum.ConStatus.Audited;
                        conMod.TableName = "ZL_C_Article";
                        conMod.ModelID   = 2;                                         //文章ID
                        conMod.NodeID    = Convert.ToInt32(nodedt.Rows[0]["NodeID"]); //放入微内容处
                                                                                      //-----------------------------
                        artdr["content"] = "ajax添加";
                        artdr["wxico"]   = dr["wxico"];
                        artdr["wxsize"]  = dr["wxsize"];
                        artdr["wxbk"]    = dr["wxbk"];
                        artdr["flag"]    = dr["flag"];
                        artdr["dbtype"]  = dr["dbtype"];
                        conMod.ItemID    = codeBll.Insert(artdr);
                        conMod.GeneralID = conBll.insert(conMod);
                        retMod.retcode   = M_APIResult.Success;
                        retMod.result    = conMod.GeneralID.ToString();
                    }
                }
                break;

                case "mb_del":
                {
                    int          id     = Convert.ToInt32(Req("id"));
                    M_CommonData conMod = conBll.SelReturnModel(id);
                    if (conMod == null)
                    {
                        retMod.retmsg = "内容[" + id + "]不存在";
                    }
                    else if (!conMod.Inputer.Equals(mu.UserName))
                    {
                        retMod.retmsg = "你无权删除[" + id + "]内容";
                    }
                    else
                    {
                        conBll.SetDel(conMod.GeneralID);
                        retMod.retcode = M_APIResult.Success;
                    }
                }
                break;

                case "mb_pro_update":    //新建,或更新
                {
                    DataRow   dr     = GetListDT().Rows[0];
                    M_Product proMod = new M_Product();
                    if (DataConvert.CLng(dr["id"]) > 0)
                    {
                        int id = Convert.ToInt32(dr["id"]);
                        proMod = proBll.GetproductByid(id);
                        if (proMod == null)
                        {
                            retMod.retmsg = "商品[" + id + "]不存在"; RepToClient(retMod);
                        }
                        else if (proMod.UserID != mu.UserID)
                        {
                            retMod.retmsg = "无权修改[" + id + "]商品"; RepToClient(retMod);
                        }
                    }
                    proMod.Proname    = dr["proname"].ToString();
                    proMod.ActPrice   = dr["price"].ToString();
                    proMod.LinPrice   = DataConvert.CDouble(dr["price"]);
                    proMod.UserID     = mu.UserID;
                    proMod.AddUser    = mu.UserName;
                    proMod.Nodeid     = B_Design_MBSite.UserShopNodeID;
                    proMod.ParentID   = siteID;
                    proMod.Proinfo    = dr["proinfo"].ToString();
                    proMod.Procontent = dr["content"].ToString();
                    proMod.Clearimg   = dr["pics"].ToString();
                    proMod.Thumbnails = proMod.Clearimg;
                    if (proMod.ID > 0)
                    {
                        proBll.updateinfo(proMod);
                    }
                    else
                    {
                        proMod.ID = proBll.Insert(proMod);
                    }
                    retMod.retmsg  = proMod.ID.ToString();
                    retMod.retcode = M_APIResult.Success;
                }
                break;

                case "mb_pro_del":
                {
                    int       id     = Convert.ToInt32(Req("id"));
                    M_Product proMod = proBll.GetproductByid(id);
                    if (proMod == null)
                    {
                        retMod.retmsg = "商品[" + id + "]不存在";
                    }
                    else if (proMod.UserID != mu.UserID)
                    {
                        retMod.retmsg = "你无权删除[" + id + "]商品";
                    }
                    else
                    {
                        proBll.RealDelByIDS(id.ToString());
                        retMod.retcode = M_APIResult.Success;
                    }
                }
                break;

                default:
                    retMod.retmsg = "[" + Action + "]接口不存在";
                    break;
                }
            }
            catch (Exception ex) { retMod.retmsg = ex.Message; retMod.retcode = M_APIResult.Failed; }
            RepToClient(retMod);
        }