コード例 #1
0
ファイル: IntegralResposity.cs プロジェクト: 842549829/Pool
        public DataTransferObject.Integral.IntegralConsumptionView GetIntegralConsumption(Guid id)
        {
            IntegralConsumptionView result = null;
            string sql = @"SELECT [ID] ,[CompnayId],[AccountNo] ,[AccountName],[AccountPhone],[DeliveryAddress],[ExpressCompany],[ExpressDelivery],[ConsumptionIntegral],[CommodityId],[CommodityName],[ExchangeTiem],[Exchange],[IntegralWay],[CommodityCount],[Remark],[Reason],[CompanyShortName]  FROM [dbo].[T_IntegralConsumption] WHERE ID = @ID1 ";

            AddParameter("ID1", id);
            using (var reader = ExecuteReader(sql))
            {
                while (reader.Read())
                {
                    result                     = new IntegralConsumptionView();
                    result.Id                  = reader.GetGuid(0);
                    result.CompnayId           = reader.GetGuid(1);
                    result.AccountNo           = reader.GetString(2);
                    result.AccountName         = reader.GetString(3);
                    result.AccountPhone        = reader.GetString(4);
                    result.DeliveryAddress     = reader.GetString(5);
                    result.ExpressCompany      = reader.GetString(6);
                    result.ExpressDelivery     = reader.GetString(7);
                    result.ConsumptionIntegral = reader.GetInt32(8);
                    result.CommodityId         = reader.GetGuid(9);
                    result.CommodityName       = reader.GetString(10);
                    result.ExchangeTiem        = reader.GetDateTime(11);
                    result.Exchange            = (ChinaPay.B3B.Common.Enums.ExchangeState)reader.GetByte(12);
                    result.Way                 = (ChinaPay.B3B.Common.Enums.IntegralWay)reader.GetByte(13);
                    result.CommodityCount      = reader.GetInt32(14);
                    result.Remark              = reader.GetString(15);
                    result.Reason              = reader.GetString(16);
                    result.CompanyShortName    = reader.GetString(17);
                }
            }
            return(result);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterOEMSkins("form.css");
            RegisterOEMSkins("page.css");

            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != null)
                {
                    IntegralConsumptionView view = IntegralServer.GetIntegralConsumption(Guid.Parse(Request.QueryString["id"].ToString()));
                    if (view != null)
                    {
                        lblId.Text            = view.Id + "";
                        lblAccountName.Text   = view.AccountName;
                        lblAccountNo.Text     = view.AccountNo;
                        lblCommodityName.Text = view.CommodityName;
                        lblCount.Text         = view.CommodityCount + "";
                        lblIntegral.Text      = view.ConsumptionIntegral + "";
                        lblCompanyName.Text   = view.CompanyShortName;
                        lblPhone.Text         = view.AccountPhone;
                        txtNo.Text            = view.ExpressDelivery;
                        txtAddress.Text       = view.DeliveryAddress;
                        txtCompany.Text       = view.ExpressCompany;
                        txtRemark.Text        = view.Reason;
                    }
                    if (Request.QueryString["type"] == "chuli")
                    {
                        txtNo.ReadOnly      = false;
                        txtAddress.ReadOnly = false;
                        txtCompany.ReadOnly = false;
                        txtRemark.ReadOnly  = false;
                        btnSave.Enabled     = true;
                        btnSave.Visible     = true;
                        btnRefuse.Enabled   = true;
                        btnRefuse.Visible   = true;
                    }
                    else if (Request.QueryString["type"] == "look")
                    {
                        txtNo.ReadOnly      = true;
                        txtAddress.ReadOnly = true;
                        txtCompany.ReadOnly = true;
                        txtRemark.ReadOnly  = true;
                        btnSave.Enabled     = false;
                        btnSave.Visible     = false;
                        btnRefuse.Enabled   = false;
                        btnRefuse.Visible   = false;
                    }
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// 修改兑换状态
 /// </summary>
 /// <param name="view"></param>
 /// <returns></returns>
 public static void UpdateIntegralConsumption(Guid id, ChinaPay.B3B.Common.Enums.ExchangeState State, string operatorName, string no, string company, string address, string reason)
 {
     using (var cmd = Factory.CreateCommand())
     {
         var reposity = Factory.CreateIntegralReposity(cmd);
         cmd.BeginTransaction();
         try
         {
             reposity.UpdateIntegralConsumption(id, State, no, company, address, reason);
             //如果是拒绝兑换,将积分返回给用户,商品数量加回去
             if (State == ExchangeState.Refuse)
             {
                 IntegralConsumptionView view  = reposity.GetIntegralConsumption(id);
                 IntegralCount           count = new IntegralCount
                 {
                     CompnayId = view.CompnayId,
                     Integral  = view.ConsumptionIntegral
                 };
                 IntegralInfo integral = new IntegralInfo
                 {
                     CompnayId   = view.CompnayId,
                     AccessTime  = DateTime.Now,
                     IntegralWay = IntegralWay.RefuseExchange,
                     Remark      = reason,
                     Integral    = view.ConsumptionIntegral
                 };
                 count.Integral = integral.Integral;
                 if (count.Integral != 0)
                 {
                     reposity.InsertIntegralInfo(integral);
                     reposity.UpdateIntegralCount(count);
                     if (view.CommodityId.HasValue)
                     {
                         reposity.UpdateShelvesNum(view.CommodityId.Value, view.CommodityCount);
                     }
                 }
             }
             cmd.CommitTransaction();
         }
         catch (Exception)
         {
             cmd.RollbackTransaction();
             throw;
         }
     }
     saveUpdateLog("兑换状态", "处理中", State.GetDescription(), OperatorRole.Platform, id.ToString(), operatorName);
 }
コード例 #4
0
ファイル: IntegralResposity.cs プロジェクト: 842549829/Pool
        public IEnumerable <DataTransferObject.Integral.IntegralConsumptionView> GetIntegralConsumptionList(Core.Range <DateTime>?time, Common.Enums.IntegralWay?way, Guid?accountId, Common.Enums.ExchangeState state, Common.Enums.OEMCommodityState?oemstate, string falg, Guid?oemId, Pagination pagination)
        {
            List <IntegralConsumptionView> result = null;

            var    fields     = " [ID] ,[CompnayId] ,[AccountNo] ,[AccountName],[AccountPhone],[DeliveryAddress],[ExpressCompany],[ExpressDelivery],[ConsumptionIntegral],[CommodityId],[CommodityName],[ExchangeTiem],[Exchange],[IntegralWay],[CommodityCount],[Remark],[Reason],[CompanyShortName],OEMCommodityState,OEMName ";
            string iCondition = " ";

            var catelog      = "[dbo].[T_IntegralConsumption]";
            var orderbyFiled = "ExchangeTiem desc";

            if (oemstate.HasValue)
            {
                iCondition += " OEMCommodityState = " + (byte)oemstate + " AND ";
            }
            if (oemId.HasValue)
            {
                iCondition += " OEMID = '" + oemId.Value + "' AND ";
            }
            iCondition += " CONVERT(DATE,[ExchangeTiem]) >=  '" + time.Value.Lower.Date + "'";
            iCondition += " AND convert(date,[ExchangeTiem]) <= '" + time.Value.Upper.Date + "'";
            if (falg == "1")
            {
                if (way != Common.Enums.IntegralWay.All)
                {
                    iCondition += " AND (IntegralWay = " + (byte)way + " OR IntegralWay = " + (byte)IntegralWay.ExchangeSms + " )";
                }
            }
            else
            {
                if (way != Common.Enums.IntegralWay.All)
                {
                    iCondition += " AND IntegralWay = " + (byte)way + " ";
                }
            }
            if (accountId != null)
            {
                iCondition += " AND CompnayId = '" + accountId + "'";
            }
            else if (state != Common.Enums.ExchangeState.All)
            {
                iCondition += " AND Exchange = " + (byte)state;
            }
            AddParameter("@iField", fields);
            AddParameter("@iCatelog", catelog);
            AddParameter("@iCondition", iCondition);
            AddParameter("@iOrderBy", orderbyFiled);
            AddParameter("@iPagesize", pagination.PageSize);
            AddParameter("@iPageIndex", pagination.PageIndex);
            AddParameter("@iGetCount", pagination.GetRowCount);
            var totalCount = AddParameter("@oTotalCount");

            totalCount.DbType    = System.Data.DbType.Int32;
            totalCount.Direction = System.Data.ParameterDirection.Output;
            using (var reader = ExecuteReader("dbo.P_Pagination", System.Data.CommandType.StoredProcedure))
            {
                result = new List <IntegralConsumptionView>();
                while (reader.Read())
                {
                    IntegralConsumptionView view = new IntegralConsumptionView();
                    view.Id                  = reader.GetGuid(0);
                    view.CompnayId           = reader.GetGuid(1);
                    view.AccountNo           = reader.GetString(2);
                    view.AccountName         = reader.GetString(3);
                    view.AccountPhone        = reader.GetString(4);
                    view.DeliveryAddress     = reader.GetString(5);
                    view.ExpressCompany      = reader.GetString(6);
                    view.ExpressDelivery     = reader.GetString(7);
                    view.ConsumptionIntegral = reader.GetInt32(8);
                    view.CommodityId         = reader.GetGuid(9);
                    view.CommodityName       = reader.GetString(10);
                    view.ExchangeTiem        = reader.GetDateTime(11);
                    view.Exchange            = (ChinaPay.B3B.Common.Enums.ExchangeState)reader.GetByte(12);
                    view.Way                 = (ChinaPay.B3B.Common.Enums.IntegralWay)reader.GetByte(13);
                    view.CommodityCount      = reader.GetInt32(14);
                    view.Remark              = reader.GetString(15);
                    view.Reason              = reader.GetString(16);
                    view.CompanyShortName    = reader.GetString(17);
                    view.OEMCommodityState   = (OEMCommodityState)reader.GetByte(18);
                    view.OEMName             = reader.GetString(19);
                    result.Add(view);
                }
            }
            if (pagination.GetRowCount)
            {
                pagination.RowCount = (int)totalCount.Value;
            }
            return(result);
        }