public BasicResponse <PowerboxchargehistoryInfo> AddPowerboxchargehistory(PowerboxchargehistoryAddRequest powerboxchargehistoryRequest)
        {
            var _powerboxchargehistory        = ObjectConverter.Copy <PowerboxchargehistoryInfo, PowerboxchargehistoryModel>(powerboxchargehistoryRequest.PowerboxchargehistoryInfo);
            var resultpowerboxchargehistory   = _Repository.AddPowerboxchargehistory(_powerboxchargehistory);
            var powerboxchargehistoryresponse = new BasicResponse <PowerboxchargehistoryInfo>();

            powerboxchargehistoryresponse.Data = ObjectConverter.Copy <PowerboxchargehistoryModel, PowerboxchargehistoryInfo>(resultpowerboxchargehistory);
            return(powerboxchargehistoryresponse);
        }
Exemple #2
0
        /// <summary>
        /// 写放电记录
        /// </summary>
        /// <param name="fzh"></param>
        /// <param name="Mac"></param>
        public static void AddPowerboxchargehistory(int fzh, string mac)
        {
            PowerboxchargehistoryAddRequest powerboxchargehistoryRequest = new PowerboxchargehistoryAddRequest();

            powerboxchargehistoryRequest.PowerboxchargehistoryInfo     = new PowerboxchargehistoryInfo();
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.Id  = Basic.Framework.Common.IdHelper.CreateLongId().ToString();
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.Fzh = fzh.ToString();
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.Mac = mac;
            ClientItem clientItem = new ClientItem();

            if (Basic.Framework.Data.PlatRuntime.Items.ContainsKey(KeyConst.ClientItemKey))
            {
                clientItem = Basic.Framework.Data.PlatRuntime.Items[KeyConst.ClientItemKey] as ClientItem;
            }
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.UserName       = clientItem.UserName;
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.Stime          = DateTime.Now;
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.DischargeStime = DateTime.Parse("1900-01-01 00:00:00");
            //if (!string.IsNullOrEmpty(mac))
            //{//交换机放电,直接更新放电开始时间
            //    powerboxchargehistoryRequest.PowerboxchargehistoryInfo.DischargeStime = DateTime.Now;
            //}
            powerboxchargehistoryRequest.PowerboxchargehistoryInfo.DischargeEtime = DateTime.Parse("1900-01-01 00:00:00");
            powerboxchargehistoryService.AddPowerboxchargehistory(powerboxchargehistoryRequest);
        }