Exemplo n.º 1
0
 public override void OnPageLoad(object sender, EventArgs e)
 {
     model                               = new AdvEffectMonitorVM();
     model.CompanyCode                   = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
     model.ChannelID                     = "1";
     QuerySection.DataContext            = model;
     this.dpkStartDate.SelectedRangeType = RangeType.Today;
     facade                              = new AdvEffectMonitorFacade(this);
     filter                              = new AdvEffectQueryFilter();
     comIsPhone.ItemsSource              = EnumConverter.GetKeyValuePairs <NYNStatus>(EnumConverter.EnumAppendItemType.All);
     comIsEmailConfirmed.ItemsSource     = EnumConverter.GetKeyValuePairs <NYNStatus>(EnumConverter.EnumAppendItemType.All);
     comIsValidSO.ItemsSource            = EnumConverter.GetKeyValuePairs <NYNStatus>(EnumConverter.EnumAppendItemType.All);
     CodeNamePairHelper.GetList("MKT", "AdvEffectMonitorOperationType", CodeNamePairAppendItemType.All, (obj2, args2) =>
     {
         comOperationType.ItemsSource = args2.Result;
         //comOperationType.SelectedIndex = 0;
     });
     CodeNamePairHelper.GetList("MKT", "SOAmtLevel", CodeNamePairAppendItemType.All, (obj2, args2) =>
     {
         cbSOAmtLevel.ItemsSource = args2.Result;
         loadedSoAmtLevel         = true;
         //  cbSOAmtLevel.SelectionChanged += new EventHandler<SelectionChangedEventArgs>(cbShowComment_SelectionChanged);
     });
     base.OnPageLoad(sender, e);
 }
Exemplo n.º 2
0
 private void Button_Search_Click(object sender, RoutedEventArgs e)
 {
     if (ValidationManager.Validate(this.QuerySection))
     {
         filter   = model.ConvertVM <AdvEffectMonitorVM, AdvEffectQueryFilter>();
         filterVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <AdvEffectQueryFilter>(filter);
         QueryResultGrid.QueryCriteria = this.filter;
         QueryResultGrid.Bind();
     }
 }
Exemplo n.º 3
0
        public virtual QueryResult QueryAdvEffect(AdvEffectQueryFilter filter)
        {
            int totalCount;
            var dataTable = ObjectFactory <IAdvertiserQueryDA> .Instance.QueryAdvEffect(filter, out totalCount);

            return(new QueryResult()
            {
                Data = dataTable,
                TotalCount = totalCount
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// 查询广告效果
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="callback"></param>
        public void QueryAdvEffect(AdvEffectQueryFilter filter, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };
            string relativeUrl = "/MKTService/AdvInfo/QueryAdvEffect";

            //restClient.Query<AdvEffectQueryRsp>(relativeUrl, filter, callback);
            restClient.QueryDynamicData(relativeUrl, filter, callback);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 数据全部导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QueryResultGrid_ExportAllClick(object sender, EventArgs e)
        {
            if (filterVM == null || this.QueryResultGrid.TotalCount < 1)
            {
                Window.Alert(ResNewsInfo.Information_ExportFailed);
                return;
            }
            ColumnSet col = new ColumnSet(this.QueryResultGrid);

            filter          = model.ConvertVM <AdvEffectMonitorVM, AdvEffectQueryFilter>();
            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()   //这个PagingInfo是我们在ECCentral.BizEntity里自己定义的,只有这3个属性
            {
                PageSize  = ConstValue.MaxRowCountLimit,
                PageIndex = 0,
                SortBy    = string.Empty
            };

            //col.Insert(0, "ProductId", ResRMAReports.Excel_ProductID, 20) .SetWidth("ProductName", 30);
            facade.ExportExcelFile(filterVM, new ColumnSet[] { col });
        }
Exemplo n.º 6
0
        public void ExportExcelFile(AdvEffectQueryFilter filter, ColumnSet[] columns)
        {
            string relativeUrl = "/MKTService/AdvInfo/QueryAdvEffect";

            restClient.ExportFile(relativeUrl, filter, columns);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 广告效果查询 /广告总计的价格查询
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public DataTable QueryAdvEffect(AdvEffectQueryFilter filter, out int totalCount)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("AdvEffectMonitor_GetAdvEffectMonitorList");

            string sortField = "SysNo";
            string sortType  = "Desc";

            if (filter.InDateFrom.HasValue && filter.InDateTo.HasValue && filter.InDateFrom.Equals(filter.InDateTo))
            {
                filter.InDateTo = filter.InDateTo.Value.AddDays(1);
            }

            if (filter.PageInfo != null && !string.IsNullOrEmpty(filter.PageInfo.SortBy))
            {
                sortField = filter.PageInfo.SortBy.Split(' ')[0].ToString();
                sortType  = filter.PageInfo.SortBy.Split(' ')[1].ToString();
            }

            cmd.SetParameterValue("@SortField", sortField);
            cmd.SetParameterValue("@SortType", sortType);
            cmd.SetParameterValue("@PageSize", filter.PageInfo.PageSize);
            cmd.SetParameterValue("@PageCurrent", filter.PageInfo.PageIndex);

            cmd.SetParameterValue("@CompanyCode", filter.CompanyCode);
            cmd.SetParameterValue("@OperationType", string.Format("%{0}%", filter.OperationType));
            cmd.SetParameterValue("@CMP", string.Format("%{0}%", filter.CMP));
            cmd.SetParameterValue("@IsPhone", filter.IsPhone);
            cmd.SetParameterValue("@IsEmailConfirmed", filter.IsEmailConfirmed);
            cmd.SetParameterValue("@CreateDateFrom", filter.InDateFrom);
            cmd.SetParameterValue("@CreateDateTo", filter.InDateTo);
            cmd.SetParameterValue("@SOID", string.Format("%{0}%", filter.SOID));
            cmd.SetParameterValue("@CustomerID", string.Format("%{0}%", filter.CustomerID));
            cmd.SetParameterValue("@IsValidSO", filter.IsValidSO.HasValue ? (int)filter.IsValidSO : -1);
            cmd.SetParameterValue("@SOStatus", filter.SOStatus.HasValue ? (int)filter.SOStatus : -999);
            if (filter.SOStatus == ECCentral.BizEntity.SO.SOStatus.OutStock && filter.IsRefund.HasValue)
            {
                cmd.SetParameterValue("@IsRefundSO", (int)filter.IsRefund);
            }
            else
            {
                cmd.SetParameterValue("@IsRefundSO", -1);
            }
            cmd.SetParameterValue("@MinSOAmt", filter.MinSOAmt);
            cmd.SetParameterValue("@MaxSOAmt", filter.MaxSOAmt);
            EnumColumnList enumList = new EnumColumnList();

            enumList.Add("IsPhone", typeof(ECCentral.BizEntity.MKT.NYNStatus));
            enumList.Add("IsEmailConfirmed", typeof(ECCentral.BizEntity.MKT.NYNStatus));
            DataTable dt = cmd.ExecuteDataTable(enumList);

            if (dt != null && dt.Rows.Count > 0)
            {
                totalCount = Convert.ToInt32(cmd.GetParameterValue("TotalCount"));
                DataColumn dc = new DataColumn("TotalSOAmount", typeof(decimal));
                dt.Columns.Add(dc);
                dt.Rows[0]["TotalSOAmount"] = Convert.ToDecimal(cmd.GetParameterValue("@TotalSOAmt"));
                return(dt);
            }
            else
            {
                totalCount = 0;
                return(dt);
            }


            //PagingInfoEntity pagingEntity = new PagingInfoEntity();
            //pagingEntity.SortField = filter.PageInfo.SortBy;
            //pagingEntity.MaximumRows = filter.PageInfo.PageSize;
            //pagingEntity.StartRowIndex = filter.PageInfo.PageIndex * filter.PageInfo.PageSize;

            //var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("AdvEffectMonitor_GetAdvEffectMonitorList");

            //using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, "A.SysNo DESC"))
            //{
            //    //sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "ChannelID", DbType.String, "@ChannelID", QueryConditionOperatorType.Equal, filter.ChannelID);

            //    sqlBuilder.ConditionConstructor.AddBetweenCondition(QueryConditionRelationType.AND, "A.CreateDate", DbType.DateTime, "@CreateDate", QueryConditionOperatorType.MoreThanOrEqual, QueryConditionOperatorType.LessThanOrEqual, filter.InDateFrom, filter.InDateTo);

            //    //sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(SO.SysNo IS NULL OR (SO.SOType <> 4 AND SO.SOType <> 5))");

            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.CMP", DbType.String, "@CMP", QueryConditionOperatorType.Like, filter.CMP);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.CompanyCode", DbType.String, "@CompanyCode", QueryConditionOperatorType.Equal, filter.CompanyCode);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.OperationType", DbType.String, "@OperationType", QueryConditionOperatorType.Like, filter.OperationType);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CI.CustomerID", DbType.String, "@CustomerID", QueryConditionOperatorType.Equal, filter.CustomerID);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.ReferenceSysNo", DbType.Int32, "@ReferenceSysNo", QueryConditionOperatorType.Equal, filter.SOSysNo);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CI.IsEmailConfirmed", DbType.Int32, "@IsEmailConfirmed", QueryConditionOperatorType.Equal, filter.IsEmailConfirmed);
            //    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CC.Status", DbType.Int32, "@CellPhoneConfirmed", QueryConditionOperatorType.Equal, filter.CellPhoneConfirmed);

            //    //订单有效性
            //    if (filter.IsValidSO == ECCentral.BizEntity.MKT.YNStatus.Yes)
            //        sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(SO.Status NOT IN (0,1,2,3,4,-6) OR (SO.Status = 4 AND SO.HaveAutoRMA=1) OR (SO.Status IS NULL AND A.OperationType NOT LIKE '%InstalmentOrder%' AND A.OperationType NOT LIKE '%Register%'))");
            //    else if (filter.IsValidSO == ECCentral.BizEntity.MKT.YNStatus.No)
            //        sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(SO.Status IN (0,1,2,3,-6) OR (SO.Status = 4 AND (SO.HaveAutoRMA <> 1 )))");//SO.HaveAutoRMA <> 1 OR SO.HaveAutoRMA IS NULL

            //    //订单状态
            //    if (filter.Status != -999)
            //    {
            //        if (filter.Status != -99)
            //            sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SO.Status", DbType.Int32, "@SOStatus", QueryConditionOperatorType.Equal, filter.Status);
            //        else
            //            sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "SO.Status = 4 AND SO.HaveAutoRMA = 1");
            //    }
            //    //if (filter.Status == 4)
            //    //    sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(SO.HaveRefund IS NULL)");

            //    if (filter.MaxSOAmt > 0 && filter.MinSOAmt >= 0)
            //        sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(" + filter.MinSOAmt + " < SO.SOAmt - SO.DiscountAmt AND " + filter.MaxSOAmt + " >= SO.SOAmt - SO.DiscountAmt)");
            //    else if (filter.MaxSOAmt == 0 && filter.MinSOAmt == 0)
            //        sqlBuilder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, "(SO.SOAmt - SO.DiscountAmt <= 0)");

            //    cmd.CommandText = sqlBuilder.BuildQuerySql();


            //    EnumColumnList enumList = new EnumColumnList();
            //    enumList.Add("SOStatus", typeof(ECCentral.BizEntity.SO.SOStatus));
            //    enumList.Add("CellPhoneConfirmed", typeof(ECCentral.BizEntity.MKT.NYNStatus));
            //    enumList.Add("IsEmailConfirmed", typeof(ECCentral.BizEntity.MKT.NYNStatus));
            //    enumList.Add("Rank", typeof(ECCentral.BizEntity.Customer.CustomerRank));

            //    //CodeNamePairColumnList pairList = new CodeNamePairColumnList();
            //    //pairList.Add("SOAmtLevel", "MKT", "SOAmtLevel");

            //    var dt = cmd.ExecuteDataTable(enumList);//, pairList);

            //    totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        decimal SOAmount = decimal.Parse(dr[1].ToString());
            //        if (SOAmount == 0)
            //            dr["ShowSOAmtLevel"] = "Z";
            //        else if (0 < SOAmount && SOAmount < 100)
            //            dr["ShowSOAmtLevel"] = "A";
            //        else if (100 < SOAmount && SOAmount < 300)
            //            dr["ShowSOAmtLevel"] = "B";
            //        else if (300 < SOAmount && SOAmount < 500)
            //            dr["ShowSOAmtLevel"] = "C";
            //        else if (500 < SOAmount && SOAmount < 800)
            //            dr["ShowSOAmtLevel"] = "D";
            //        else if (800 < SOAmount && SOAmount < 1000)
            //            dr["ShowSOAmtLevel"] = "E";
            //        else if (1000 < SOAmount && SOAmount < 1500)
            //            dr["ShowSOAmtLevel"] = "F";
            //        else if (1500 < SOAmount && SOAmount < 2000)
            //            dr["ShowSOAmtLevel"] = "G";
            //        else if (2000 < SOAmount && SOAmount < 3000)
            //            dr["ShowSOAmtLevel"] = "H";
            //        else if (3000 < SOAmount && SOAmount < 5000)
            //            dr["ShowSOAmtLevel"] = "I";
            //        else if (5000 < SOAmount && SOAmount < 8000)
            //            dr["ShowSOAmtLevel"] = "J";
            //        else if (8000 < SOAmount && SOAmount < 10000)
            //            dr["ShowSOAmtLevel"] = "K";
            //        else
            //            dr["ShowSOAmtLevel"] = "L";
            //    }
            //    return dt;
            //}
        }