Example #1
0
        /// <summary>
        /// 获得分店信息
        /// </summary>
        public static void GetDpId()
        {
            string     mac        = otherHelper.getMacAddrLocal();
            DepartInfo departInfo = new DepartInfo();

            departInfo.DpPCMAC = mac;
            departInfo         = departBLL.DepartSelectByMac(departInfo);
            departLocal        = departInfo;
        }
Example #2
0
        /// <summary>
        /// 载入设备和店铺信息
        /// </summary>
        private void LoadDeviceAndStore()
        {
            DeviceInfo deviceInfo = new DeviceInfo();
            string     localMac   = otherHelper.getMacAddrLocal();

            deviceInfo.DeviceMac = localMac;
            DeviceIDLabel.Text   = "设备号:" + localMac;
            // 查看数据库里有没有这个设备,没有则添加
            deviceInfo = deviceDal.SelectByMac(deviceInfo);
            if (deviceInfo == null)
            {
                // 插入新的设备信息
                deviceInfo           = new DeviceInfo();
                deviceInfo.DeviceMac = localMac;
                bool b = deviceDal.InsertDevice(deviceInfo);
                if (!b)
                {
                    deviceInfo.DeviceId = 0;
                    deviceInfo.StoreId  = 0;
                    MessageBox.Show("无法添加设备到数据库!", "警告");
                }
                else
                {
                    deviceInfo = deviceDal.SelectByMac(deviceInfo);
                }
            }
            StaticData.deviceLocal = deviceInfo;
            StoreInfo storeInfo;

            if (StaticData.deviceLocal.StoreId != 0)
            {
                storeInfo = storeDal.StoreSelectById(StaticData.deviceLocal.StoreId);
            }
            else
            {
                storeInfo              = new StoreInfo();
                storeInfo.StoreName    = "上海电机学院分店";
                storeInfo.StoreAddress = "上海浦东新区水华路300号";
            }
            StaticData.storeLocal = storeInfo;
            storeNameLabel.Text   = "所属店铺:" + StaticData.storeLocal.StoreName;
            storeAddrLabel.Text   = "店铺地址:" + StaticData.storeLocal.StoreAddress;
        }