Beispiel #1
0
    //添加广告位置
    public void AddAD_Position()
    {
        int    Ad_Position_ID        = tools.CheckInt(Request.Form["Ad_Position_ID"]);
        string Ad_Position_Name      = tools.CheckStr(Request.Form["Ad_Position_Name"]);
        int    Ad_Position_ChannelID = tools.CheckInt(Request.Form["Ad_Position_ChannelID"]);
        string Ad_Position_Value     = tools.CheckStr(Request.Form["Ad_Position_Value"]);
        int    Ad_Position_Width     = tools.CheckInt(Request.Form["Ad_Position_Width"]);
        int    Ad_Position_Height    = tools.CheckInt(Request.Form["Ad_Position_Height"]);
        int    Ad_Position_IsActive  = tools.CheckInt(Request.Form["Ad_Position_IsActive"]);
        string Ad_Position_Site      = Public.GetCurrentSite();

        int    U_Ad_Position_Marketing = tools.CheckInt(Request.Form["U_Ad_Position_Marketing"]);
        double U_Ad_Position_Price     = tools.CheckFloat(Request.Form["U_Ad_Position_Price"]);

        if (Ad_Position_Name == "")
        {
            Public.Msg("error", "错误信息", "请填写位置名称", false, "{back}");
        }
        if (Ad_Position_Value == "")
        {
            Public.Msg("error", "错误信息", "请填写位置代号", false, "{back}");
        }

        ADPositionInfo entity = new ADPositionInfo();

        entity.Ad_Position_ID          = Ad_Position_ID;
        entity.Ad_Position_Name        = Ad_Position_Name;
        entity.Ad_Position_ChannelID   = Ad_Position_ChannelID;
        entity.Ad_Position_Value       = Ad_Position_Value;
        entity.Ad_Position_Width       = Ad_Position_Width;
        entity.Ad_Position_Height      = Ad_Position_Height;
        entity.Ad_Position_IsActive    = Ad_Position_IsActive;
        entity.Ad_Position_Site        = Ad_Position_Site;
        entity.U_Ad_Position_Marketing = U_Ad_Position_Marketing;
        entity.U_Ad_Position_Price     = U_Ad_Position_Price;

        if (Myposition.AddAD_Position(entity, Public.GetUserPrivilege()))
        {
            Public.Msg("positive", "操作成功", "操作成功", true, "ad_position_add.aspx");
        }
        else
        {
            Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}");
        }
    }
Beispiel #2
0
    //获取广告推广申请
    public string GetAd_Applys()
    {
        ADPositionInfo positioninfo = null;
        QueryInfo      Query        = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        string keyword       = tools.CheckStr(Request["keyword"]);
        string Ad_Kind       = tools.CheckStr(Request["Ad_Kind"]);
        int    ad_channel_id = tools.CheckInt(Request["ad_channel_id"]);

        Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.Ad_Site", "=", Public.GetCurrentSite()));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.U_Ad_Advertiser", ">", "0"));
        if (Ad_Kind.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.Ad_Kind", "=", Ad_Kind));
        }
        if (Ad_Kind.Length == 0 & ad_channel_id != 0)
        {
            string ad_kind_str = GetADKinds(ad_channel_id);
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.Ad_Kind", "in", ad_kind_str));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND(", "str", "ADInfo.Ad_Title", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR)", "int", "ADInfo.U_Ad_Advertiser", "in", "select supplier_id from supplier where Supplier_CompanyName like '%" + keyword + "%'"));
        }

        string Audit = tools.CheckStr(Request["Audit"]);

        Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.U_Ad_Audit", "=", Audit));

        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));
        PageInfo       pageinfo = MyAD.GetPageInfo(Query, Public.GetUserPrivilege());
        IList <ADInfo> Ads      = MyAD.GetADs(Query, Public.GetUserPrivilege());

        if (Ads != null)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\"");
            jsonBuilder.Append(":[");

            Supplier     Supplier = new Supplier();
            SupplierInfo SupplierEntity;

            foreach (ADInfo entity in Ads)
            {
                jsonBuilder.Append("{\"id\":" + entity.Ad_ID + ",\"cell\":[");
                //各字段

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_ID);
                jsonBuilder.Append("\",");


                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.Ad_Title));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                positioninfo = Myposition.GetAD_PositionByValue(entity.Ad_Kind, Public.GetUserPrivilege());
                if (positioninfo != null)
                {
                    jsonBuilder.Append(positioninfo.Ad_Position_Name);
                }
                else
                {
                    jsonBuilder.Append(entity.Ad_Kind);
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (entity.Ad_MediaKind == 1)
                {
                    jsonBuilder.Append("文字");
                }
                else if (entity.Ad_MediaKind == 2)
                {
                    jsonBuilder.Append("图片");
                }
                else if (entity.Ad_MediaKind == 3)
                {
                    jsonBuilder.Append("Flash");
                }
                else
                {
                    jsonBuilder.Append("富媒体");
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_Show_Freq);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_Sort);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_Show_times);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_Hits);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_StartDate.ToShortDateString() + " - " + entity.Ad_EndDate.ToShortDateString());
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (entity.U_Ad_Audit == 1)
                {
                    jsonBuilder.Append("已审核");
                }
                else if (entity.U_Ad_Audit == 2)
                {
                    jsonBuilder.Append("审核不通过");
                }
                else
                {
                    jsonBuilder.Append("未审核");
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                SupplierEntity = Supplier.GetSupplierByID(entity.U_Ad_Advertiser);
                if (SupplierEntity != null)
                {
                    jsonBuilder.Append(SupplierEntity.Supplier_CompanyName);
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Ad_Addtime);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append("<img src=\\\"/images/icon_view.gif\\\"> <a href=\\\"ad_view.aspx?ad_id=" + entity.Ad_ID + "\\\" title=\\\"查看\\\">查看</a>");

                if (Public.CheckPrivilege("c47f67fa-1142-459d-b466-e3216848ff9c") && entity.U_Ad_Audit == 0)
                {
                    jsonBuilder.Append(" <img src=\\\"/images/icon_edit.gif\\\"> <a href=\\\"ad_edit.aspx?ad_id=" + entity.Ad_ID + "\\\" title=\\\"修改\\\">修改</a>");
                }
                if (Public.CheckPrivilege("6087aa59-bd66-4eb5-8fb0-f72da294b1ae") && entity.U_Ad_Audit != 1)
                {
                    jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('ad_do.aspx?action=move&ad_id=" + entity.Ad_ID + "')\\\" title=\\\"删除\\\">删除</a>");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("]},");
            }
            jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            jsonBuilder.Append("]");
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
        else
        {
            return(null);
        }
    }
Beispiel #3
0
    //广告推广审核
    public void ADApply_Audit_Edit(int status)
    {
        string ad_id = tools.CheckStr(Request["ad_id"]);

        if (ad_id == "")
        {
            Public.Msg("error", "错误信息", "请选择要操作的申请信息", false, "{back}");
            return;
        }

        ADPositionInfo AdPositionEntity = null;

        if (tools.Left(ad_id, 1) == ",")
        {
            ad_id = ad_id.Remove(0, 1);
        }

        ProductDenyReasonInfo reasoninfo;

        QueryInfo Query = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.Ad_ID", "in", ad_id));
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "ADInfo.Ad_Site", "=", Public.GetCurrentSite()));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.U_Ad_Audit", "=", "0"));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ADInfo.U_Ad_Advertiser", ">", "0"));
        Query.OrderInfos.Add(new OrderInfo("ADInfo.Ad_ID", "DESC"));
        IList <ADInfo> entitys = MyAD.GetADs(Query, Public.GetUserPrivilege());

        if (entitys != null)
        {
            foreach (ADInfo entity in entitys)
            {
                if (status == 1)
                {
                    AdPositionEntity = Myposition.GetAD_PositionByValue(entity.Ad_Kind, Public.GetUserPrivilege());
                    if (AdPositionEntity == null)
                    {
                        AdPositionEntity = new ADPositionInfo();
                    }


                    double DeductMoney = ((entity.Ad_EndDate - entity.Ad_StartDate).Days + 1) * AdPositionEntity.U_Ad_Position_Price;
                    if (supplier.GetSupplierAdvAccount(entity.U_Ad_Advertiser) >= DeductMoney)
                    {
                        supplier.Supplier_Account_Log(entity.U_Ad_Advertiser, 2, Math.Round(0 - DeductMoney, 2), "广告服务费");
                    }
                    else
                    {
                        Public.Msg("error", "错误信息", "账户余额不足", false, "{back}");
                        break;
                    }
                }
                entity.U_Ad_Audit = status;
                MyAD.EditAD(entity, Public.GetUserPrivilege());
            }
        }

        Response.Redirect("/ad/ad_apply.aspx");
    }