示例#1
0
        /// <summary>
        /// 新增/修改会员信息
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(MachineConfigModel machineConfigInfo)
        {
            try
            {
                GenerateDal.BeginTransaction();

                if (!string.IsNullOrEmpty(machineConfigInfo.MachineId))
                {
                    DeleteData(machineConfigInfo.MachineId);
                }
                string userAccount = HttpContextHandler.GetHeaderObj("UserAccount").ToString();
                machineConfigInfo.UpdateDate = DateTime.Now;
                machineConfigInfo.Updater    = userAccount;
                GenerateDal.Create(machineConfigInfo);
                //需要插入机器下行表中待机器取
                MachineService mc = new MachineService();
                mc.PostToMachine(machineConfigInfo.MachineId, "t");
                GenerateDal.CommitTransaction();
                //操作日志
                OperationLogService operationService = new OperationLogService();
                operationService.PostData(new OperationLogModel()
                {
                    MachineId = machineConfigInfo.MachineId, OptContent = "机器配置添加"
                });
                return(1);
            }
            catch (Exception e)
            {
                GenerateDal.RollBack();
                return(0);
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(List <TunnelConfigModel> lstTunnelConfigInfo)
        {
            try
            {
                GenerateDal.BeginTransaction();
                if (lstTunnelConfigInfo.Count > 0)
                {
                    GenerateDal.Delete <TunnelConfigModel>(CommonSqlKey.DeleteTunnelConfig, lstTunnelConfigInfo[0]);
                }
                foreach (TunnelConfigModel tunnelConfigInfo in lstTunnelConfigInfo)
                {
                    tunnelConfigInfo.IsUsed = 1;
                    GenerateDal.Create(tunnelConfigInfo);
                }
                //向机器下行表里插入数据
                if (lstTunnelConfigInfo.Count > 0)
                {
                    MachineService ms = new MachineService();
                    ms.PostToMachine(lstTunnelConfigInfo[0].MachineId, "p");
                    //操作日志
                    OperationLogService operationService = new OperationLogService();
                    operationService.PostData(new OperationLogModel()
                    {
                        MachineId = lstTunnelConfigInfo[0].MachineId, OptContent = "货道配置添加"
                    });
                }
                GenerateDal.CommitTransaction();

                return(1);
            }
            catch (Exception e)
            {
                GenerateDal.RollBack();
                return(0);
            }
        }
示例#3
0
        public int UpdateStockWithMobile(List <TunnelInfoModel> lstTunnelInfo)
        {
            try
            {
                GenerateDal.BeginTransaction();
                foreach (TunnelInfoModel tunnelInfo in lstTunnelInfo)
                {
                    //decimal price = Convert.ToDecimal(GetPriceByWaresId(tunnelInfo.WaresId));
                    if (string.IsNullOrEmpty(tunnelInfo.GoodsStuId))
                    {
                        tunnelInfo.GoodsStuId = tunnelInfo.TunnelId;
                        tunnelInfo.CurrStatus = "1";
                        GenerateDal.Create <TunnelInfoModel>(tunnelInfo);
                    }
                    else
                    {
                        tunnelInfo.UpdateDate = DateTime.Now;
                        GenerateDal.Update(CommonSqlKey.UpdateTunnelCurrStock, tunnelInfo);
                    }

                    /*
                     * TunnelConfigModel tunnelConfig = new TunnelConfigModel();
                     * tunnelConfig.MachineId = tunnelInfo.MachineId;
                     * tunnelConfig.CabinetId = tunnelInfo.CabinetId;
                     * tunnelConfig.TunnelId = tunnelInfo.TunnelId;
                     * tunnelConfig.CashPrices = price;
                     * tunnelConfig.WpayPrices = price;
                     * tunnelConfig.AlipayPrices = price;
                     * tunnelConfig.IcPrices = price;
                     * tunnelConfig.WaresId = tunnelInfo.WaresId;
                     *
                     * GenerateDal.Update(CommonSqlKey.UpdateTunnelPrice, tunnelConfig);
                     */
                }
                MachineService ms = new MachineService();
                //往机器下行表里插入库存改变的数据
                ms.PostToMachine(lstTunnelInfo[0].MachineId, "st");
                //操作日志
                OperationLogService operationService = new OperationLogService();
                operationService.PostData(new OperationLogModel()
                {
                    MachineId = lstTunnelInfo[0].MachineId, OptContent = "手机补充库存"
                });

                /*
                 * TunnelConfigModel tunnelConfig = new TunnelConfigModel();
                 * tunnelConfig.MachineId = tunnelInfoInfo.MachineId;
                 * tunnelConfig.CabinetId = tunnelInfoInfo.CabinetId;
                 * tunnelConfig.TunnelId = tunnelInfoInfo.GoodsStuId;
                 * tunnelConfig.IsUsed = Convert.ToInt32(tunnelInfoInfo.CurrStatus);
                 * GenerateDal.Update(CommonSqlKey.UpdateTunnelConfigStatus, tunnelConfig);
                 */
                GenerateDal.CommitTransaction();
            }
            catch (Exception e)
            {
                GenerateDal.RollBack();
                return(0);
            }
            return(1);
        }