Exemplo n.º 1
0
    protected void btnSaveClick(Object sender, EventArgs e)
    {
        FeeInfo info = this.GetInfoFromPageControl();

        if (FeeInfoAdapter.Instance.IsFeeCodeUsed(info, action == ActionType.Add))
        {
            base.MessageBox(this.name + "编码冲突,请重新定义!");
            this.tbFeeCode.Focus();
            return;
        }
        if (action == ActionType.Add)
        {
            FeeInfoAdapter.Instance.InsertFeeInfo(info);
            UrlParamBuilder urlEdit = new UrlParamBuilder(SalaryConst.FeeEditUrl);
            if (!String.IsNullOrEmpty(yearMonth))
            {
                urlEdit.AppendItem(FeeMonthInfoConst.YearMonth, yearMonth);
            }
            urlEdit.AppendItem(FeeInfoConst.FeeID, info.FeeID);
            urlEdit.AppendItem(SalaryConst.QueryAction, ActionType.Edit);
            Redirect(urlEdit.ToUrlString());
        }
        else
        {
            FeeInfoAdapter.Instance.UpdateFeeInfo(info);
        }
        if (info.FeeType.Equals(FeeType.Tax))
        {
            base.MessageAndRefreshParentByCurrHref(this.name + "保存成功!");
        }
        else
        {
            base.MessageAndRefreshParentByCurrHrefAndClose(this.name + "保存成功!");
        }
    }
Exemplo n.º 2
0
        public static List <Trade> PoloniexToTrades(IList <ITrade> trades, FeeInfo feeInfo)
        {
            var tradeList = new List <Trade>();

            foreach (var completedOrder in trades)
            {
                var trade = Mapper.Map <Trade>(completedOrder);
                trade.Exchange = Constants.Poloniex;
                trade.Side     = completedOrder.Type == OrderType.Buy ? TradeSide.Buy : TradeSide.Sell;

                var ccy = completedOrder.Pair.Split('_');
                trade.Base  = ccy[0];
                trade.Terms = ccy[1];

                var baseAmount = Convert.ToDecimal(completedOrder.AmountBase);

                if (trade.Side == TradeSide.Buy)
                {
                    trade.Commission = Convert.ToDecimal((completedOrder.AmountQuote * 0.0025) *
                                                         completedOrder.PricePerCoin);
                    trade.Quantity = Convert.ToDecimal(completedOrder.AmountQuote - completedOrder.AmountQuote * 0.0025);
                    trade.Cost     = baseAmount;
                }
                else
                {
                    trade.Commission = baseAmount * 0.0025m;
                    trade.Quantity   = Convert.ToDecimal(completedOrder.AmountQuote);
                    trade.Cost       = baseAmount - trade.Commission;
                }

                tradeList.Add(trade);
            }

            return(tradeList);
        }
Exemplo n.º 3
0
        public static BPValidationRequest InitialValidationForEp(FeeInfo feeInfo, BillerInfo billerInfo)
        {
            var validationRequest = CreateBaseValidationRequest()
                                    .FromFeeInfo(feeInfo)
                                    .FromBillerInfo(billerInfo);

            return(validationRequest);
        }
Exemplo n.º 4
0
        public static BPValidationRequest SubsequentValidationForEp(FeeInfo feeInfo, BillerInfo billerInfo, BPValidationResponse validationResponse, TestBiller biller, string thirdPartyType)
        {
            var validationRequest = CreateBaseValidationRequest()
                                    .FromFeeInfo(feeInfo)
                                    .FromBillerInfo(billerInfo)
                                    .FromValidationResponse(validationResponse, biller, thirdPartyType);

            return(validationRequest);
        }
Exemplo n.º 5
0
 private static void OnBTCeFeeChanged(Object feeObject, EventArgs e)
 {
     lock (lockFee)
     {
         fee = (feeObject as FeeInfo);
         Console.WriteLine("Fee: " + fee);
         logger.Debug(fee);
     }
 }
Exemplo n.º 6
0
    protected void ddlBaseFee_DataBound(object sender, EventArgs e)
    {
        DropDownList ddl     = (DropDownList)sender;
        FeeInfo      feeInfo = null;

        foreach (ListItem li in ddl.Items)
        {
            feeInfo = FeeInfoAdapter.Instance.LoadFeeInfo(this.yearMonth, li.Value);
            li.Text = SalaryAppAdapter.Instance.AddSpaceInFrontOfFeeName(feeInfo.FeeCode) + li.Text;
        }
    }
Exemplo n.º 7
0
        public TestOrdersRepository() : base()
        {
            this.random   = new Random((int)DateTime.Now.Ticks);
            this.products = new List <Fee>();

            GenerateProducts();

            for (int i = 0; i < orderCount; i++)
            {
                FeeInfo.Add(GenerateOrder(i));
            }
        }
Exemplo n.º 8
0
    private FeeInfo GetInfoFromPageControl()
    {
        FeeInfo info = null;

        switch (action)
        {
        case ActionType.Add:
            info               = String.IsNullOrEmpty(yearMonth) ? new FeeInfo() : new FeeMonthInfo(yearMonth);
            info.FeeID         = CommonTools.Instance.GetMaxOrderNo(String.IsNullOrEmpty(yearMonth) ? FeeInfoDBConst.TableName : ORMapping.GetMappingInfo <FeeMonthInfo>().TableName, FeeInfoDBConst.FeeID).ToString();
            info.CommonFeeType = this.enumCommonFeeType;
            break;

        case ActionType.Edit:
            info = FeeInfoAdapter.Instance.LoadFeeInfo(yearMonth, feeID);
            break;
        }
        info.FeeCode = this.tbFeeCode.Text.Trim();
        info.FeeName = this.tbFeeName.Text.Trim();
        if (this.ddlFee.SelectedIndex > 0)
        {
            info.ParentID = FeeInfoAdapter.Instance.LoadFeeInfoByCode(this.yearMonth, this.ddlFee.SelectedValue).FeeID;
            String nm = this.ddlFee.SelectedItem.Text.Replace(" ", "").Trim();
            info.ParentName = nm.StartsWith("-") ? nm.Substring(1).Trim() : nm;
        }
        info.FeeType       = this.enumFeeType;
        info.CalculateSign = this.ddlCalculateSign.SelectedIndex > 0 ? this.ddlCalculateSign.SelectedValue : null;
        String txt = String.Empty;

        if (info.FeeType.Equals(FeeType.Tax))
        {
            //info.CalculateExp = String.Concat("[", FeeInfoAdapter.Instance.LoadFeeInfoByCode(this.yearMonth, this.ddlTaxTargetFee.SelectedValue).FeeID, "]");
            txt = this.tbTaxBaseValue.Text;
            info.TaxBaseValue = String.IsNullOrEmpty(txt) ? 0 : Decimal.Parse(txt);
            //info.TaxTargetFeeID = this.ddlTaxTargetFee.SelectedIndex > 0 ? FeeInfoAdapter.Instance.LoadFeeInfoByCode(this.yearMonth, this.ddlTaxTargetFee.SelectedValue).FeeID : "";
            info.StartDate = DateTime.Parse(this.tbStartDate.Text);
        }
        else if (info.FeeType.Equals(FeeType.Sum))
        {
            info.CalculateExp = FeeInfoAdapter.Instance.ConvertFeeNameWithFeeCodeInExp(yearMonth, this.tbCalculateExp.Text);
        }
        else if (info.FeeType.Equals(FeeType.Common))
        {
            info.CalculateExp = FeeInfoAdapter.Instance.ConvertFeeNameWithFeeCodeInExp(yearMonth, this.tbCalculateExp.Text);//string.Empty;
            ////info.TaxTargetFeeID = this.ddlTargetParameter.SelectedIndex > 0 ? this.ddlTargetParameter.SelectedValue : "";
        }
        else if (info.FeeType.Equals(FeeType.Parameter))
        {
            info.StartDate = DateTime.Parse(this.tbStartDate.Text);
        }
        txt = this.tbDefaultValue.Text;
        info.DefaultValue = String.IsNullOrEmpty(txt) ? 0 : Decimal.Parse(txt);
        return(info);
    }
Exemplo n.º 9
0
        /// <summary>
        /// Deal with StatutoryRate and DTC Position Model number
        /// </summary>
        private void XBRL_StatRate_DTCposModel(XBRL_event_info xei)
        {
            //Get Statutory Rate
            StatutoryRate_edi rt = RateMaster_edi.GetRate_from_country(this.ISO2CntryCode.Value, this.RecordDate_ADR.Value);

            if (rt != null)
            {
                this.StatutoryRate.Value = rt.statry_rt.Value;
            }

            //Get DTC position model number
            DTC_Model.DTCPositionModelNumber_Mapping dm =
                DTC_Model.DTC_model_master.GetMapping_country(this.Country.Value, this.Issue.Value, this.RecordDate_ADR.Value, this.SecurityTypeID.Value);
            if (dm != null)
            {
                this.DTCPosition_ModelNumber.Value = dm.ModelNumber.Value;
            }

            //Get amounts based on Statutary Rate
            if (xei != null && xei.fee_list.Count > 0)
            {
                FeeInfo WHrate_fi = xei.fee_list[0];
                foreach (FeeInfo fi in xei.fee_list)
                {
                    if (fi.WithholdingTaxPercentage == this.StatutoryRate.Value)
                    {
                        WHrate_fi = fi;
                        break;
                    }
                }

                this.DivNetAmount_ADR.Value = WHrate_fi.PayoutAmountNetOfTax;

                if (xei.IsCompleteEvent_flag)
                {
                    this.FinalDivGrossAmount_ADR.Value = WHrate_fi.PayoutAmount;
                }
                else
                {
                    this.ApproxDivGrossAmount_ADR.Value = WHrate_fi.PayoutAmount;
                }
            }
        }
Exemplo n.º 10
0
    private void InitializeControl()
    {
        FeeInfo feeInfo = null;////Tools.DropDownListDataBindByEnum(this.ddlFeeType, typeof(FeeType), string.Empty, true, true);

        Tools.DropDownListDataBindByEnum(this.ddlCalculateSign, typeof(CalculateSign), string.Empty, true, true);
        this.InitializeFeeDropDownList();
        this.InitializeTaxTargetFeeDropDownList();
        if (action != ActionType.Add)
        {
            feeInfo                             = FeeInfoAdapter.Instance.LoadFeeInfo(yearMonth, feeID);
            this.parentID                       = feeInfo.ParentID;
            this.enumFeeType                    = feeInfo.FeeType;
            this.tbFeeCode.Text                 = feeInfo.FeeCode;
            this.tbFeeName.Text                 = feeInfo.FeeName;
            this.tbDefaultValue.Text            = feeInfo.DefaultValue.ToString("#.00");
            this.tbStartDate.Text               = base.ShowCorrectDateTime(feeInfo.StartDate.ToString());
            this.tbTaxBaseValue.Text            = feeInfo.TaxBaseValue.ToString();
            this.tbCalculateExp.Text            = FeeInfoAdapter.Instance.ConvertFeeCodeWithFeeNameInExp(yearMonth, feeInfo.CalculateExp);
            this.ddlFee.SelectedValue           = String.IsNullOrEmpty(feeInfo.ParentID) ? "" : FeeInfoAdapter.Instance.LoadFeeInfo(this.yearMonth, feeInfo.ParentID).FeeCode;
            this.ddlCalculateSign.SelectedValue = feeInfo.CalculateSign;////this.ddlFeeType.SelectedValue = ((Int32)feeInfo.FeeType).ToString();
            switch (feeInfo.FeeType)
            {
            case FeeType.Tax:
                //this.ddlTaxTargetFee.SelectedValue = FeeInfoAdapter.Instance.LoadFeeInfo(this.yearMonth, feeInfo.TaxTargetFeeID).FeeCode;
                this.TaxGridViewDataBind(false);
                break;

            case FeeType.Sum:
                this.InitializeCalculateExpFeeListBox();
                break;
            }
        }
        else
        {
            if ((this.enumFeeType.Equals(FeeType.Parameter) || this.enumFeeType.Equals(FeeType.Tax)) && !String.IsNullOrEmpty(this.parentID))
            {
                this.tbFeeName.Text = FeeInfoAdapter.Instance.LoadFeeInfo(this.yearMonth, this.parentID).FeeName;
            }////this.ddlFeeType.SelectedValue = this.enumFeeType.Equals(0) ? "" : this.enumFeeType.ToString("D");
            this.ddlFee.SelectedValue = String.IsNullOrEmpty(parentID) ? "" : FeeInfoAdapter.Instance.LoadFeeInfo(this.yearMonth, this.parentID).FeeCode;
            this.tbFeeCode.Text       = FeeInfoAdapter.Instance.CreateFeeCode(this.enumFeeType.ToString("D"), parentID);
        }
        this.ddlFeeType_SelectedIndexChanged(null, null);
    }
Exemplo n.º 11
0
    public IList <FeeInfo> SelectAllFee()
    {
        IList <FeeInfo> list = new List <FeeInfo>();
        DataTable       dt   = DBHelper.ExecuteDataTable(SQL_SELECT_ALL_FEE);

        foreach (DataRow dr in dt.Rows)
        {
            FeeInfo info = new FeeInfo();
            info.FeeId     = new Guid(dr["FeeId"].ToString());
            info.Fee       = decimal.Parse(dr["Fee"].ToString());
            info.SiteCount = int.Parse(dr["SiteCount"].ToString());
            info.AdsCount  = int.Parse(dr["AdsCount"].ToString());
            info.ShowDays  = int.Parse(dr["ShowDays"].ToString());
            info.AdsType   = int.Parse(dr["AdsType"].ToString());

            list.Add(info);
        }

        return(list);
    }
Exemplo n.º 12
0
        private FeeInfo GetPreferredFeeInfo(SendData sendData, List <FeeInfo> feeInfos)
        {
            FeeInfo feeInfo =
                !string.IsNullOrEmpty(sendData.SendRequest.ServiceOption) &&
                feeInfos.Exists(x => x.ServiceOption.Equals(sendData.SendRequest.ServiceOption))
                    ? feeInfos.Where(x => x.ErrorInfo == null)
                .FirstOrDefault(x => x.ServiceOption.Equals(sendData.SendRequest.ServiceOption))
                    : null;

            if (feeInfo == null) //get the preferred fee quote
            {
                foreach (var preferredOption in ServiceOptionType.PreferredOrder)
                {
                    feeInfo = feeInfos.FirstOrDefault(x => x.ServiceOption.Equals(preferredOption));
                    if (feeInfo != null)
                    {
                        break;
                    }
                }
            }

            return(feeInfo);
        }
Exemplo n.º 13
0
    protected void BTN_ShowGoods_Click(object sender, EventArgs e)
    {
        IList <UserAdsInfo> list = new List <UserAdsInfo>();

        string nick = "";

        if (Request.Cookies["nick"] != null)
        {
            nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
        }
        else
        {
            nick = Session["snick"].ToString();
        }

        if (DDL_AdsType.SelectedValue == Guid.Empty.ToString() || DDL_App.SelectedValue == Guid.Empty.ToString() || DDL_Position.SelectedValue == Guid.Empty.ToString())
        {
            Page.RegisterStartupScript("通知", "<script>alert('请选择投放的应用,类型以及位置,请按您购买的服务类型选择!');</script>");
            return;
        }

        CateService      cateDal  = new CateService();
        IList <CateInfo> cateList = cateDal.SelectAllCateByNick(nick).ToList();

        UserAdsService userAdsDal = new UserAdsService();

        foreach (RepeaterItem item in Rpt_GoodsList.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("CBOX_Goods");
            if (cb.Checked)
            {
                UserAdsInfo info = new UserAdsInfo();
                info.AdsTitle     = ((Label)item.FindControl("LB_GoodsName")).Text;
                info.Id           = Guid.NewGuid();
                info.UserAdsState = 0;
                info.AdsUrl       = "http://item.taobao.com/item.htm?id=" + ((Label)item.FindControl("LB_GoodsId")).Text;
                string cateId = ((Label)item.FindControl("LB_CateId")).Text;

                IList <CateInfo> thiscList = cateList.Where(o => o.CateId == cateId).ToList();

                info.CateIds = ((Label)item.FindControl("LB_TaoBaoCId")).Text;
                string cname = thiscList.Count == 0 ? "" : thiscList[0].CateName;
                info.SellCateName = GetTaoBaoCName(info.CateIds, cname);
                info.AliWang      = nick;
                info.Nick         = nick;
                info.AdsPic       = ((Label)item.FindControl("LB_Img")).Text;
                info.Price        = decimal.Parse(((Label)item.FindControl("LB_Price")).Text);
                list.Add(info);
            }
        }
        if (list.Count == 0)
        {
            return;
        }

        SiteAdsInfo sadsinfo  = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList()[0];
        int         needScore = sadsinfo.Score * list.Count;

        //购买类型
        IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();

        //投放的广告
        IList <UserAdsInfo> useradsList = userAdsDal.SelectAllUserAds(nick);

        //新的添加广告方法
        if (buyList.Count > 0)
        {
            if (!buyList[0].IsExpied)
            {
                FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == buyList[0].FeeId).ToList()[0];
                //已经投放了的该收费类型的广告集合
                IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                int calScore = 0;
                calScore = feeInfo.Score;
                for (int i = 0; i < myUseradsList.Count; i++)
                {
                    SiteAdsInfo sainfo = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id == myUseradsList[i].AdsId).ToList()[0];
                    calScore -= sainfo.Score;
                }

                int canTou = calScore / needScore; //可以投放的个数

                if (canTou > 0)
                {
                    canTou = canTou > list.Count ? list.Count : canTou;
                }

                //不能继续投放
                if (canTou == 0)
                {
                    Page.RegisterStartupScript("通知", "<script>alert('您不能投放该类型广告');</script>");
                }
                //可以投放
                else
                {
                    if (sadsinfo.AdsCount != -1)
                    {
                        //这里需要查询空闲的广告(或者说是可以用的广告位)
                        IList <UserAdsInfo> usedadsList = userAdsDal.SelectAllUsedAds();
                        IList <SiteAdsInfo> allads      = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList();
                        if (allads.Count > 0 && allads[0].AdsCalCount > 0)
                        {
                            //可以放多少个
                            for (int i = 0; i < canTou; i++)
                            {
                                list[i].AddTime           = DateTime.Now;
                                list[i].AliWang           = nick;
                                list[i].FeeId             = feeInfo.FeeId;
                                list[i].AdsShowStartTime  = DateTime.Now;
                                list[i].AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                                list[i].Nick         = nick;
                                list[i].UserAdsState = 1;
                                string taoId = list[i].CateIds;
                                list[i].CateIds = GetTaoBaoCId(taoId, taoId);
                                list[i].AdsId   = new Guid(DDL_Position.SelectedValue);
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                        }
                    }
                    else
                    {
                        //可以放多少个
                        for (int i = 0; i < canTou; i++)
                        {
                            list[i].AddTime           = DateTime.Now;
                            list[i].AliWang           = nick;
                            list[i].FeeId             = feeInfo.FeeId;
                            list[i].AdsShowStartTime  = DateTime.Now;
                            list[i].AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            list[i].Nick         = nick;
                            list[i].UserAdsState = 1;
                            string taoId = list[i].CateIds;
                            list[i].CateIds = GetTaoBaoCId(taoId, taoId);
                            list[i].AdsId   = new Guid(DDL_Position.SelectedValue);
                        }
                    }
                }
            }
        }
        string uid  = CacheCollection.GetAllSiteList().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).ToList()[0].SiteUrl;
        int    area = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList()[0].PositionCode;
        int    typ  = 0;

        if (DDL_AdsType.SelectedValue.ToLower() == "1A4AB7A8-49A1-41FC-A5A6-788FD582DB82".ToLower() || DDL_AdsType.SelectedValue.ToLower() == "7CE41706-582D-4270-82C4-81420F923D6A".ToLower())
        {
            typ = 0;
        }
        if (DDL_AdsType.SelectedValue.ToLower() == "68A5E23C-6CFD-427D-BD0E-1E2B1B160875".ToLower() || DDL_AdsType.SelectedValue.ToLower() == "C1F928EF-CA82-4FED-B960-CA33FCE417E9".ToLower())
        {
            typ = 1;
        }
        if (DDL_AdsType.SelectedValue.ToLower() == "813F256D-D83A-43CE-8CC4-273C965DBF84".ToLower())
        {
            typ = 2;
        }

        foreach (UserAdsInfo info in list)
        {
            Guid ggid = info.Id;

            if (info.AdsId != Guid.Empty)
            {
                ggid = PostIphone.InsertAds(uid, area, typ, info.AdsPic, info.AdsUrl, info.Price, info.AdsTitle);
                if (ggid == Guid.Empty)
                {
                    Page.RegisterStartupScript("通知", "<script>alert('发送添加广告错误');</script>");
                    continue;
                }
                userAdsDal.InsertUserAds(info, ggid);
            }
        }

        Response.Redirect("UserAdsList.aspx?istou=1");
    }
Exemplo n.º 14
0
        /// <summary>
        /// Description  : To Insert or Update Fee Item.
        /// Created By   : Shiva
        /// Created Date : 12 Sep 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>Fee saved Status</returns>
        /// 
        public int InsertOrUpdateFeeItem()
        {
            var MFeeData = new FeeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[11];
                sqlParams[0] = new SqlParameter("@ID", this.ID);
                sqlParams[1] = new SqlParameter("@FeeType", this.FeeType);
                sqlParams[2] = new SqlParameter("@Units", this.Units);
                sqlParams[3] = new SqlParameter("@Amount", this.Amount);
                sqlParams[4] = new SqlParameter("@Description", this.Description);
                sqlParams[5] = new SqlParameter("@IsAdhoc", this.IsAdhoc);
                sqlParams[6] = new SqlParameter("@IsArchived", this.IsArchived);
                sqlParams[7] = new SqlParameter("@UnitPrice", this.UnitPrice);
                sqlParams[8] = new SqlParameter("@SavedBy", this.SavedBy);
                sqlParams[9] = new SqlParameter("@WOID", this.WOID);
                sqlParams[10] = new SqlParameter("@InHouseComment", this.FeeInhouseComment);

                return ID = SqlHelper.ExecuteNonQuery(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPInsertOrUpdateFeeItem", sqlParams);
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return ID;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Description  : Get FeeType from database(MFeeType table). 
        /// Created By   : Shiva
        /// Created Date : 12 Sep 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns></returns>
        /// 
        public static FeeInfo GetMFeeType()
        {
            var MFeeData = new FeeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpGetMFeeType");
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var FeeItem = new WOFee();
                    FeeItem.FetchFeeType(FeeItem, safe);
                    MFeeData.FeeList.Add(FeeItem);
                }
                return MFeeData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return MFeeData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Exemplo n.º 16
0
    protected void BTN_ShowGoods_Click(object sender, EventArgs e)
    {
        IList <UserAdsInfo> list = new List <UserAdsInfo>();

        string nick = "";

        if (Request.Cookies["nick"] != null)
        {
            nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
        }
        else
        {
            nick = Session["snick"].ToString();
        }

        CateService      cateDal  = new CateService();
        IList <CateInfo> cateList = cateDal.SelectAllCateByNick(nick).ToList();

        UserAdsService userAdsDal = new UserAdsService();

        foreach (RepeaterItem item in Rpt_GoodsList.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("CBOX_Goods");
            if (cb.Checked)
            {
                UserAdsInfo info = new UserAdsInfo();
                info.AdsTitle     = ((Label)item.FindControl("LB_GoodsName")).Text;
                info.Id           = Guid.NewGuid();
                info.UserAdsState = 0;
                info.AdsUrl       = "http://item.taobao.com/item.htm?id=" + ((Label)item.FindControl("LB_GoodsId")).Text;
                string cateId = ((Label)item.FindControl("LB_CateId")).Text;

                IList <CateInfo> thiscList = cateList.Where(o => o.CateId == cateId).ToList();

                info.CateIds = ((Label)item.FindControl("LB_TaoBaoCId")).Text;
                string cname = thiscList.Count == 0 ? "" : thiscList[0].CateName;
                info.SellCateName = GetTaoBaoCName(info.CateIds, cname);
                info.AliWang      = nick;
                info.Nick         = nick;
                info.AdsPic       = ((Label)item.FindControl("LB_Img")).Text;
                info.Price        = decimal.Parse(((Label)item.FindControl("LB_Price")).Text);
                list.Add(info);
            }
        }
        if (list.Count == 0)
        {
            return;
        }


        IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();

        //投放的广告
        IList <UserAdsInfo> useradsList = userAdsDal.SelectAllUserAds(nick);

        //购买类型
        foreach (BuyInfo binfo in buyList)
        {
            //未过期的
            if (!binfo.IsExpied)
            {
                //收费类型
                FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == binfo.FeeId).ToList()[0];

                if (feeInfo.AdsCount > 0)
                {
                    int count = feeInfo.AdsCount > list.Count ? list.Count : feeInfo.AdsCount;

                    //已经投放了的该收费类型的广告集合
                    IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                    //真正可以添加的广告数量
                    int realcount = 0;
                    if (feeInfo.AdsCount - myUseradsList.Count <= 0)
                    {
                        realcount = 0;
                    }
                    else
                    {
                        realcount = (feeInfo.AdsCount - myUseradsList.Count) >= count ? count : feeInfo.AdsCount - myUseradsList.Count;
                    }

                    if (realcount > 0)
                    {
                        if (feeInfo.AdsType == 5)
                        {
                            //这里需要查询空闲的广告(或者说是可以用的广告位)
                            IList <UserAdsInfo> usedadsList = userAdsDal.SelectAllUsedAds();
                            IList <AdsInfo>     allads      = CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 5).ToList();
                            if (allads.Count > usedadsList.Count)
                            {
                                //得到没有使用的广告位
                                IList <AdsInfo> hasads = new List <AdsInfo>();
                                foreach (AdsInfo ainfo in allads)
                                {
                                    if (usedadsList.Where(o => o.AdsId == ainfo.AdsId).ToList().Count == 0)
                                    {
                                        hasads.Add(ainfo);
                                    }
                                }


                                for (int i = 0; i < realcount; i++)
                                {
                                    list[i].AddTime = DateTime.Now;
                                    list[i].AdsId   = GetRand(hasads);
                                    //不需要旺旺
                                    list[i].AliWang           = ""; //nick;
                                    list[i].FeeId             = binfo.FeeId;
                                    list[i].AdsShowStartTime  = DateTime.Now;
                                    list[i].AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                                    list[i].Nick         = nick;
                                    list[i].UserAdsState = 1;
                                    //不需要分类
                                    //string taoId = list[i].CateIds;
                                    list[i].CateIds = "";  // GetTaoBaoCId(taoId, ref taoId);
                                }
                            }
                            else
                            {
                                Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                            }
                            continue;
                        }

                        //可以放多少个
                        for (int i = 0; i < realcount; i++)
                        {
                            list[i].AddTime           = DateTime.Now;
                            list[i].AdsId             = GetRand(CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 1).ToList());
                            list[i].AliWang           = nick;
                            list[i].FeeId             = binfo.FeeId;
                            list[i].AdsShowStartTime  = DateTime.Now;
                            list[i].AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            list[i].Nick         = nick;
                            list[i].UserAdsState = 1;
                            string taoId = list[i].CateIds;
                            list[i].CateIds = GetTaoBaoCId(taoId, taoId);
                        }
                    }
                }
            }
        }

        foreach (UserAdsInfo info in list)
        {
            userAdsDal.InsertUserAds(info);
        }

        Response.Redirect("UserAdsList.aspx?istou=1");
    }
Exemplo n.º 17
0
        /// <summary>
        /// Description  : Get Fee Item by ID.
        /// Created By   : Shiva
        /// Created Date : 15 Sep 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>Fee Data</returns>
        /// 
        internal static object GetFeeItemByFeeID(int FeeID)
        {
            var MFeeData = new FeeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[1];
                sqlParams[0] = new SqlParameter("@FeeID", FeeID);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetWOFeeDetailsByFeeID", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Item = new WOFee();
                    Item.FetchFeeItemByFeeID(Item, safe);
                    MFeeData.FeeList.Add(Item);
                }
                return MFeeData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return MFeeData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Exemplo n.º 18
0
    protected void RPT_AdsList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "De")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            uasDal.DelteUserAds(id);
            Response.Redirect("UserAdsList.aspx");
        }
        if (e.CommandName == "Insert")
        {
            Guid        id   = new Guid(e.CommandArgument.ToString());
            UserAdsInfo info = uasDal.SelectUserAdsById(id);
            string      nick = "";
            if (Request.Cookies["nick"] != null)
            {
                nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
            }
            else
            {
                nick = Session["snick"].ToString();
            }
            IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();
            bool            noads   = true;
            //投放的广告
            IList <UserAdsInfo> useradsList = uasDal.SelectAllUserAds(nick);

            //购买类型
            foreach (BuyInfo binfo in buyList)
            {
                //未过期的
                if (!binfo.IsExpied)
                {
                    //收费类型
                    FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == binfo.FeeId).ToList()[0];

                    if (feeInfo.AdsCount > 0)
                    {
                        //已经投放了的该收费类型的广告集合
                        IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                        //真正可以添加的广告数量
                        int realcount = feeInfo.AdsCount - myUseradsList.Count;

                        if (realcount > 0)
                        {
                            if (feeInfo.AdsType == 5)
                            {
                                //这里需要查询空闲的广告(或者说是可以用的广告位)
                                IList <UserAdsInfo> usedadsList = uasDal.SelectAllUsedAds();
                                IList <AdsInfo>     allads      = CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 5).ToList();
                                if (allads.Count > usedadsList.Count)
                                {
                                    //得到没有使用的广告位
                                    IList <AdsInfo> hasads = new List <AdsInfo>();
                                    foreach (AdsInfo ainfo in allads)
                                    {
                                        if (usedadsList.Where(o => o.AdsId == ainfo.AdsId).ToList().Count == 0)
                                        {
                                            hasads.Add(ainfo);
                                        }
                                    }

                                    info.AddTime = DateTime.Now;
                                    info.AdsId   = GetRand(hasads);
                                    //不需要旺旺
                                    info.AliWang           = ""; //nick;
                                    info.FeeId             = binfo.FeeId;
                                    info.AdsShowStartTime  = DateTime.Now;
                                    info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                                    info.Nick         = nick;
                                    info.UserAdsState = 1;
                                    //不需要分类
                                    //string taoId = info.CateIds;
                                    info.CateIds = "";  // GetTaoBaoCId(taoId, ref taoId);
                                }
                                else
                                {
                                    Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                                }
                                continue;
                            }

                            info.AddTime           = DateTime.Now;
                            info.AdsId             = info.AdsId == Guid.Empty ? GetRand(CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 1).ToList()) : info.AdsId;
                            info.AliWang           = nick;
                            info.FeeId             = binfo.FeeId;
                            info.AdsShowStartTime  = DateTime.Now;
                            info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            info.Nick         = nick;
                            info.UserAdsState = 1;
                            string taoId = info.CateIds;
                            info.CateIds = GetTaoBaoCId(taoId, ref taoId);

                            info.Id = id;
                            uasDal.UpdateUserAdsState(info);
                            //
                            noads = false;

                            break;
                        }
                    }
                }
            }

            if (noads)
            {
                Response.Redirect("/qubie.html");
            }
            else
            {
                Response.Redirect("UserAdsList.aspx?istou=1");
            }
        }
        if (e.CommandName == "Result")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            Response.Redirect("ShowClick.aspx?id=" + id);
        }
        if (e.CommandName == "See")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            Response.Redirect("ShowAds.aspx?adsid=" + id);
        }
        if (e.CommandName == "Stop")
        {
            Guid id = new Guid(e.CommandArgument.ToString());
            uasDal.StopUserAds(2, id);
            Response.Redirect("UserAdsList.aspx");
        }
        if (e.CommandName == "Add")
        {
        }
    }
Exemplo n.º 19
0
 public void Set(FeeInfo feeInfo)
 {
     FeeInfo = feeInfo;
     SetExecutionOrder(nameof(FeeInfo));
 }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IList <AdsInfo> adsList = CacheCollection.GetAllAdsInfo();

            Random  rand = new Random();
            AdsInfo info = adsList[rand.Next(adsList.Count)];

            IList <UserAdsInfo> list = uasDal.SelectAllUserAdsByAdsId(info.AdsId, 1);

            IList <ClickInfo> clickList = clickDal.SelectAllClickCount(DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMdd"));

            //获取访问IP
            string ip = Request.ServerVariables["REMOTE_ADDR"];
            //获取当天已经访问来了的IP
            IList <ClickIPInfo> ipList = clickDal.SelectAllClickIPByDate(DateTime.Now.ToString("yyyyMMdd"));
            //和当前IP相同的
            ipList = ipList.Where(o => o.VisitIP == ip).ToList();

            foreach (ClickIPInfo ipinfo in ipList)
            {
                //已经访问了该广告
                IList <UserAdsInfo> hadlist = list.Where(o => o.Id == ipinfo.UserAdsId).ToList();
                if (hadlist.Count > 0)
                {
                    list.Remove(hadlist[0]);
                }
            }

            if (list.Count == 0)
            {
                return;
            }

            foreach (ClickInfo cinfo in clickList)
            {
                if (cinfo.ClickCount >= rand.Next(6, 15))//10)
                {
                    IList <UserAdsInfo> hadlist = list.Where(o => o.Id == cinfo.UserAdsId).ToList();

                    if (hadlist.Count > 0)
                    {
                        FeeInfo finfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == hadlist[0].FeeId).ToList()[0];
                        if (finfo.AdsType == 1)
                        {
                            if (finfo.AdsCount == 1)
                            {
                                list.Remove(hadlist[0]);
                            }
                            else
                            {
                                if (cinfo.ClickCount >= rand.Next(14, 23))//18)
                                {
                                    list.Remove(hadlist[0]);
                                }
                            }
                        }
                        if (finfo.AdsType == 5)
                        {
                            if (cinfo.ClickCount >= rand.Next(22, 33)) //27)
                            {
                                list.Remove(hadlist[0]);
                            }
                        }
                    }
                }
            }

            if (list.Count == 0)
            {
                return;
            }

            UserAdsInfo uinfo = list[0];
            if (list.Count > 1)
            {
                uinfo = list[rand.Next(list.Count)];
            }

            ClickIPInfo iinfo = new ClickIPInfo();
            iinfo.VisitIP   = ip;
            iinfo.ClickId   = Guid.NewGuid();
            iinfo.VisitDate = DateTime.Now.ToString("yyyyMMdd");
            iinfo.UserAdsId = uinfo.Id;
            clickDal.InsertClickIP(iinfo);

            string param = "id=" + uinfo.Id + "&url=" + uinfo.AdsUrl;
            Response.Redirect("getclick.aspx?" + HttpUtility.UrlEncode(param));
        }
    }
Exemplo n.º 21
0
    protected void BTN_Tui_Click(object sender, EventArgs e)
    {
        string nick = "";

        if (Request.Cookies["nick"] != null)
        {
            nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
        }
        else
        {
            nick = Session["snick"].ToString();
        }

        //购买类型
        IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();

        //投放的广告
        IList <UserAdsInfo> useradsList = userAdsDal.SelectAllUserAds(nick);

        bool notou = true;

        foreach (BuyInfo binfo in buyList)
        {
            //未过期的
            if (!binfo.IsExpied)
            {
                //收费类型
                FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == binfo.FeeId).ToList()[0];

                if (feeInfo.AdsCount > 0)
                {
                    //已经投放了的该收费类型的广告集合
                    IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                    //真正可以添加的广告数量
                    int         realcount = feeInfo.AdsCount - myUseradsList.Count;
                    UserAdsInfo info      = new UserAdsInfo();
                    info.AdsTitle     = TB_ShppName.Text.Trim();
                    info.Id           = Guid.NewGuid();
                    info.UserAdsState = 0;
                    info.AdsUrl       = TB_ShowUrl.Text.Trim();
                    string cateId = ViewState["shopcid"].ToString();

                    TaoBaoGoodsClassInfo tcinfo = new TaoBaoGoodsClassService().SelectGoodsClass(cateId);
                    info.CateIds = ViewState["shopcid"].ToString();
                    string cname = tcinfo == null ? "" : tcinfo.name;
                    info.SellCateName = GetTaoBaoCName(info.CateIds, cname);
                    info.AliWang      = nick;
                    info.Nick         = nick;
                    info.AdsPic       = ShopImg;
                    //店铺图标
                    if (FUD_Img.HasFile && CheckImg())
                    {
                        Guid imgurl = Guid.NewGuid();
                        FUD_Img.SaveAs(Server.MapPath("~/adsimg") + "/" + imgurl + ".jpg");
                        info.AdsPic = "/adsimg/" + imgurl + ".jpg";
                    }

                    if (realcount > 0)
                    {
                        if (feeInfo.AdsType == 5)
                        {
                            //这里需要查询空闲的广告(或者说是可以用的广告位)
                            IList <UserAdsInfo> usedadsList = userAdsDal.SelectAllUsedAds();
                            IList <AdsInfo>     allads      = CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 5).ToList();
                            if (allads.Count > usedadsList.Count)
                            {
                                //得到没有使用的广告位
                                IList <AdsInfo> hasads = new List <AdsInfo>();
                                foreach (AdsInfo ainfo in allads)
                                {
                                    if (usedadsList.Where(o => o.AdsId == ainfo.AdsId).ToList().Count == 0)
                                    {
                                        hasads.Add(ainfo);
                                    }
                                }

                                info.AddTime = DateTime.Now;
                                info.AdsId   = GetRand(hasads);
                                //不需要旺旺
                                info.AliWang           = ""; //nick;
                                info.FeeId             = binfo.FeeId;
                                info.AdsShowStartTime  = DateTime.Now;
                                info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                                info.Nick         = nick;
                                info.UserAdsState = 1;
                                //不需要分类
                                //string taoId = list[i].CateIds;
                                info.CateIds = "";  // GetTaoBaoCId(taoId, ref taoId);
                            }
                            else
                            {
                                Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                            }
                        }
                        if (feeInfo.AdsType == 1)
                        {
                            info.AddTime           = DateTime.Now;
                            info.AdsId             = GetRand(CacheCollection.GetAllAdsInfo().Where(o => o.AdsType == 1).ToList());
                            info.AliWang           = nick;
                            info.FeeId             = binfo.FeeId;
                            info.AdsShowStartTime  = DateTime.Now;
                            info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            info.Nick         = nick;
                            info.UserAdsState = 1;
                            string taoId = info.CateIds;
                            info.CateIds = GetTaoBaoCId(taoId, taoId);
                        }

                        notou = false;
                    }

                    userAdsDal.InsertUserAds(info);
                    break;
                }
            }
        }

        if (notou)
        {
            Response.Redirect("UserAdsList.aspx");
        }
        else
        {
            Response.Redirect("UserAdsList.aspx?istou=1");
        }
    }
Exemplo n.º 22
0
        private Control BuildRegistrantFeeControl( RegistrationTemplateFee fee, FeeInfo feeInfo, RegistrantInfo registrant, bool setValues )
        {
            if ( feeInfo.Quantity > 0 )
            {
                var rlField = new RockLiteral();
                rlField.ID = string.Format( "rlFee_{0}_{1}_{2}", registrant.Id, fee.Id, feeInfo.Option );
                rlField.Label = fee.Name;

                if ( !string.IsNullOrWhiteSpace( feeInfo.Option ) )
                {
                    rlField.Label += " - " + feeInfo.Option;
                }

                if ( feeInfo.Quantity > 1 )
                {
                    rlField.Text = string.Format( "({0:N0} @ {1:C2}) {2:C2}",
                    feeInfo.Quantity, feeInfo.Cost, feeInfo.TotalCost );
                }
                else
                {
                    rlField.Text = feeInfo.TotalCost.ToString( "C2" );
                }

                return rlField;
            }

            return null;
        }
Exemplo n.º 23
0
        public static BPValidationRequest FromFeeInfo(this BPValidationRequest validationRequest, FeeInfo feeInfo)
        {
            validationRequest.MgiSessionID = feeInfo.MgiSessionID;
            validationRequest.SendAmount   = feeInfo.SendAmounts.SendAmount ?? 0m;
            validationRequest.FeeAmount    = feeInfo.SendAmounts.TotalSendFees;

            return(validationRequest);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Description  : To get Fee Items by WOID.
        /// Created By   : Shiva
        /// Created Date : 12 Sep 2014
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>Fee data</returns>
        /// 
        public static FeeInfo GetFeeItemsByWOID(int WOID, int startPage, int resultPerPage)
        {
            var MFeeData = new FeeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[3];
                sqlParams[0] = new SqlParameter("@WOID", WOID);
                sqlParams[1] = new SqlParameter("@startPage", startPage);
                sqlParams[2] = new SqlParameter("@resultPerPage", resultPerPage);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetFeeItemDetailsByWOID", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Item = new WOFee();
                    Item.FetchFeeItemsByWOID(Item, safe);
                    MFeeData.FeeList.Add(Item);
                    MFeeData.FeeCount = Convert.ToInt32(reader["FeeCount"]);
                }
                reader.NextResult();
                while (reader.Read())
                {
                    var Instate = new FeeInstate();
                    Instate.FetchFeeInstate(Instate, safe);
                    MFeeData.FEEInstate.Add(Instate);
                }

                reader.NextResult();
                while (reader.Read())
                {
                    var ActionRules = new FeeActionRules();
                    ActionRules.FetchFeeActionRules(ActionRules, safe);
                    MFeeData.FEEActionRules.Add(ActionRules);
                }

                return MFeeData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return MFeeData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }
Exemplo n.º 25
0
 public static SendValidationRequest FromFeeInfo(this SendValidationRequest sendValReq, FeeInfo feeInfo)
 {
     sendValReq.MgiSessionID       = feeInfo.MgiSessionID;
     sendValReq.SendAmount         = feeInfo.SendAmounts.SendAmount.GetValueOrDefault();
     sendValReq.SendCurrency       = feeInfo.SendAmounts.SendCurrency;
     sendValReq.PromoCodes         = feeInfo.PromotionInfos?.Select(x => x.PromotionCode).ToList();
     sendValReq.DestinationCountry = feeInfo.DestinationCountry;
     sendValReq.ServiceOption      = feeInfo.ServiceOption;
     sendValReq.ReceiveCurrency    = feeInfo.ReceiveAmounts.ReceiveCurrency;
     if (!string.IsNullOrWhiteSpace(feeInfo.ReceiveAgentID))
     {
         sendValReq.ReceiveAgentID = feeInfo.ReceiveAgentID;
     }
     return(sendValReq);
 }
Exemplo n.º 26
0
        public static SendValidationRequest NewRequestWithRequiredFieldValues(SenderLookupInfo senderInfo, FeeInfo feeInfo, Dictionary <string, string> infoKeysWithGroupTypes, List <InfoBase> fieldsToCollect, string thirdPartyType)
        {
            var newReq = NewRequestWithBaseData();

            var reqFldValues = GetFieldValues(fieldsToCollect.OfType <FieldToCollectInfo>(), senderInfo, infoKeysWithGroupTypes, thirdPartyType);

            newReq.FieldValues.AddRange(reqFldValues);

            if (newReq.FieldValues.Exists(x => x.InfoKey == InfoKeyNames.sender_Occupation))
            {
                var senderOccupationFld = newReq.FieldValues.First(x => x.InfoKey == InfoKeyNames.sender_Occupation);
                if ((senderOccupationFld.Value.ToLower() != "other") && (newReq.FieldValues.Exists(x => x.InfoKey == InfoKeyNames.sender_OccupationOther)))
                {
                    var senderOtherOccupationFld = newReq.FieldValues.First(x => x.InfoKey == InfoKeyNames.sender_OccupationOther);
                    newReq.FieldValues.Remove(senderOtherOccupationFld);
                }
            }
            return(newReq);
        }
Exemplo n.º 27
0
    protected void BTN_Tui_Click(object sender, EventArgs e)
    {
        string nick = "";

        if (Request.Cookies["nick"] != null)
        {
            nick = HttpUtility.UrlDecode(Request.Cookies["nick"].Value); //"nick";
        }
        else
        {
            nick = Session["snick"].ToString();
        }

        if (DDL_AdsType.SelectedValue == Guid.Empty.ToString() || DDL_App.SelectedValue == Guid.Empty.ToString() || DDL_Position.SelectedValue == Guid.Empty.ToString())
        {
            Page.RegisterStartupScript("通知", "<script>alert('请选择投放的应用,类型以及位置,请按您购买的服务类型选择!');</script>");
            return;
        }

        //购买类型
        IList <BuyInfo> buyList = CacheCollection.GetAllBuyInfo().Where(o => o.Nick == nick).ToList();

        //投放的广告
        IList <UserAdsInfo> useradsList = userAdsDal.SelectAllUserAds(nick);

        bool notou = true;

        //新的添加广告方法
        if (buyList.Count > 0)
        {
            if (!buyList[0].IsExpied)
            {
                SiteAdsInfo sadsinfo = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList()[0];

                FeeInfo feeInfo = CacheCollection.GetAllFeeInfo().Where(o => o.FeeId == buyList[0].FeeId).ToList()[0];
                //已经投放了的该收费类型的广告集合
                IList <UserAdsInfo> myUseradsList = useradsList.Where(o => o.FeeId == feeInfo.FeeId && o.UserAdsState == 1).ToList();

                int calScore = 0;
                calScore = feeInfo.Score;
                for (int i = 0; i < myUseradsList.Count; i++)
                {
                    SiteAdsInfo sainfo = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id == myUseradsList[i].AdsId).ToList()[0];
                    calScore -= sainfo.Score;
                }

                UserAdsInfo info = new UserAdsInfo();
                info.AdsTitle     = TB_ShppName.Text.Trim();
                info.Id           = Guid.NewGuid();
                info.UserAdsState = 0;
                info.AdsUrl       = TB_ShowUrl.Text.Trim();
                string cateId = ViewState["shopcid"].ToString();

                TaoBaoGoodsClassInfo tcinfo = new TaoBaoGoodsClassService().SelectGoodsClass(cateId);
                info.CateIds = ViewState["shopcid"].ToString();
                string cname = tcinfo == null ? "" : tcinfo.name;
                info.SellCateName = GetTaoBaoCName(info.CateIds, cname);
                info.AliWang      = nick;
                info.Nick         = nick;
                info.AdsPic       = ShopImg;
                //店铺图标
                if (FUD_Img.HasFile && CheckImg())
                {
                    Guid imgurl = Guid.NewGuid();
                    FUD_Img.SaveAs(Server.MapPath("~/adsimg") + "/" + imgurl + ".jpg");
                    info.AdsPic = "/adsimg/" + imgurl + ".jpg";
                }
                //不能继续投放
                if (calScore < sadsinfo.Score)
                {
                }
                //可以投放
                else
                {
                    if (sadsinfo.AdsCount != -1)
                    {
                        //这里需要查询空闲的广告(或者说是可以用的广告位)
                        IList <UserAdsInfo> usedadsList = userAdsDal.SelectAllUsedAds();
                        IList <SiteAdsInfo> allads      = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList();
                        if (allads.Count > 0 && allads[0].AdsCalCount > 0)
                        {
                            info.AddTime = DateTime.Now;
                            info.AdsId   = new Guid(DDL_Position.SelectedValue);
                            //不需要旺旺
                            info.AliWang           = ""; //nick;
                            info.FeeId             = buyList[0].FeeId;
                            info.AdsShowStartTime  = DateTime.Now;
                            info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                            info.Nick         = nick;
                            info.UserAdsState = 1;
                            //不需要分类
                            //string taoId = list[i].CateIds;
                            info.CateIds = "";  // GetTaoBaoCId(taoId, ref taoId);
                        }
                        else
                        {
                            Page.RegisterStartupScript("通知", "<script>alert('请联系我们的客服人员为您添加广告');</script>");
                        }
                    }
                    else
                    {
                        info.AddTime           = DateTime.Now;
                        info.AdsId             = new Guid(DDL_Position.SelectedValue);
                        info.AliWang           = nick;
                        info.FeeId             = buyList[0].FeeId;
                        info.AdsShowStartTime  = DateTime.Now;
                        info.AdsShowFinishTime = DateTime.Now.AddDays(feeInfo.ShowDays);
                        info.Nick         = nick;
                        info.UserAdsState = 1;
                        string taoId = info.CateIds;
                        info.CateIds = GetTaoBaoCId(taoId, taoId);
                    }
                    notou = false;
                }

                string uid  = CacheCollection.GetAllSiteList().Where(o => o.SiteId.ToString() == DDL_App.SelectedValue).ToList()[0].SiteUrl;
                int    area = CacheCollection.GetAllSiteAdsInfo().Where(o => o.Id.ToString() == DDL_Position.SelectedValue).ToList()[0].PositionCode;
                int    typ  = 0;
                if (DDL_AdsType.SelectedValue == "1A4AB7A8-49A1-41FC-A5A6-788FD582DB82" || DDL_AdsType.SelectedValue == "7CE41706-582D-4270-82C4-81420F923D6A")
                {
                    typ = 0;
                }
                if (DDL_AdsType.SelectedValue == "68A5E23C-6CFD-427D-BD0E-1E2B1B160875" || DDL_AdsType.SelectedValue == "C1F928EF-CA82-4FED-B960-CA33FCE417E9")
                {
                    typ = 1;
                }
                if (DDL_AdsType.SelectedValue == "813F256D-D83A-43CE-8CC4-273C965DBF84")
                {
                    typ = 2;
                }
                Guid ggid = Guid.Empty;

                if (info.AdsId != Guid.Empty)
                {
                    ggid = PostIphone.InsertAds(uid, area, typ, info.AdsPic, info.AdsUrl, info.Price, info.AdsTitle);
                    if (ggid == Guid.Empty)
                    {
                        Page.RegisterStartupScript("通知", "<script>alert('发送添加广告错误');</script>");
                        return;
                    }
                    userAdsDal.InsertUserAds(info, ggid);
                }
            }
        }

        //if (notou)
        //    Response.Redirect("UserAdsList.aspx");
        //else
        Response.Redirect("UserAdsList.aspx?istou=1");
    }
Exemplo n.º 28
0
        /// <summary>
        /// Description  : To get All Fee Items.
        /// Created By   : Pavan
        /// Created Date : 23 Apr 2015
        /// Modified By  :
        /// Modified Date:
        /// </summary>
        /// <returns>Fee data</returns>
        /// 
        public static FeeInfo GetAllFeeItems(int startPage, int resultPerPage, string clientID, string SourceID, string WO, string Type, string IsBilled, string IsArchived, string IsAdhoc, string OrderBy, string FromDate, string ToDate, int ACCPACStatus)
        {
            var MFeeData = new FeeInfo();

            System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame();
            System.Reflection.MethodBase methodBase = stackFrame.GetMethod();
            log.Debug("Start: " + methodBase.Name);
            try
            {
                SqlParameter[] sqlParams = new SqlParameter[13];
                sqlParams[0] = new SqlParameter("@startPage", startPage);
                sqlParams[1] = new SqlParameter("@resultPerPage", resultPerPage);
                sqlParams[2] = new SqlParameter("@clientID", clientID);
                sqlParams[3] = new SqlParameter("@SourceID", SourceID);
                sqlParams[4] = new SqlParameter("@WO", WO);
                sqlParams[5] = new SqlParameter("@Type", Type);
                sqlParams[6] = new SqlParameter("@IsBilled", IsBilled);
                sqlParams[7] = new SqlParameter("@IsArchived", IsArchived);
                sqlParams[8] = new SqlParameter("@IsAdhoc", IsAdhoc);
                sqlParams[9] = new SqlParameter("@OrderBy", OrderBy);
                sqlParams[10] = new SqlParameter("@FromDate", HelperClasses.ConvertDateFormat(FromDate));
                sqlParams[11] = new SqlParameter("@ToDate", HelperClasses.ConvertDateFormat(ToDate));
                sqlParams[12] = new SqlParameter("@ACCPACStatus", ACCPACStatus);
                var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SPGetAllFeeItems", sqlParams);
                var safe = new SafeDataReader(reader);
                while (reader.Read())
                {
                    var Item = new WOFee();
                    Item.FetchFeeItemsByWOID(Item, safe);
                    MFeeData.FeeList.Add(Item);
                    MFeeData.FeeCount = Convert.ToInt32(reader["FeeCount"]);
                }
                reader.NextResult();
                while (reader.Read())
                {
                    var Instate = new FeeInstate();
                    Instate.FetchFeeInstate(Instate, safe);
                    MFeeData.FEEInstate.Add(Instate);
                }

                reader.NextResult();
                while (reader.Read())
                {
                    var ActionRules = new FeeActionRules();
                    ActionRules.FetchFeeActionRules(ActionRules, safe);
                    MFeeData.FEEActionRules.Add(ActionRules);
                }

                return MFeeData;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex);
                return MFeeData;
            }
            finally
            {
                log.Debug("End: " + methodBase.Name);
            }
        }