Exemple #1
0
 public SalesclerkInfo(WelfareLotteryEntities entities, LotteryStation lottery) : this()
 {
     this.entities            = entities;
     station                  = lottery;
     collection               = new ObservableCollection <DBModels.Salesclerk>(lottery.Salesclerks);
     clerkListBox.ItemsSource = collection;
 }
 public RewardCardPage(LotteryStation station)
 {
     InitializeComponent();
     this.station             = station;
     _rewardCardInfos         = new ObservableCollection <RewardCardInfo>(station.RewardCardInfoes);
     lvRewardCard.ItemsSource = _rewardCardInfos;
     entities = (WelfareLotteryEntities)Application.Current.Resources["WelfareLotteryEntities"];
 }
Exemple #3
0
        //查看销售员
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button         btn     = sender as Button;
            LotteryStation station = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));
            SalesclerkInfo info    = new SalesclerkInfo(entities, station)
            {
                Owner        = Application.Current.MainWindow,
                clerkListBox = { IsEnabled = Tools.LoginUserHasRights() }
            };

            info.ShowDialog();
        }
Exemple #4
0
        //网点变更信息
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            Button             btn         = sender as Button;
            LotteryStation     station     = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));
            StationChangedInfo changedInfo = new StationChangedInfo(station)
            {
                Owner      = Application.Current.MainWindow,
                adGameType = { IsEnabled = Tools.LoginUserHasRights() }
            };

            changedInfo.ShowDialog();
        }
        public StationChangedInfo(LotteryStation s)
        {
            InitializeComponent();
            this.Icon = new DrawingImage();
            station   = s;
            entities  = (WelfareLotteryEntities)Application.Current.Resources["WelfareLotteryEntities"];

            cboAddedType.ItemsSource = entities.StationModifiedTypes.ToList();

            stationModifiedInfos      = new ObservableCollection <StationModifiedInfo>(station.StationModifiedInfoes);
            lvChangedMemo.ItemsSource = stationModifiedInfos;
        }
Exemple #6
0
        //查看网点照片
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Button         btn     = sender as Button;
            LotteryStation station = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));

            var result = JsonConvert.DeserializeObject <Dictionary <string, string> >(station.StationPicListSerialized);

            PhotoCollection photo = new PhotoCollection();

            result.Keys.ToList().ForEach(k => photo.Add(new Photo(k)
            {
                Image = u.ByteArrayToBitmapImage(Convert.FromBase64String(result[k]))
            }));

            ImageViewer viewer = new ImageViewer(photo)
            {
                ImageAllowDrop = Tools.LoginUserHasRights()
            };
            Window win = new Window
            {
                Width   = 400,
                Height  = 400,
                Content = viewer,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Owner = Application.Current.MainWindow
            };

            win.ShowDialog();

            if (!viewer.IsChanged)
            {
                return;
            }
            if (MessageBox.Show("是否提交更改变?", "提交", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                return;
            }
            var dicAllPhoto = viewer.Photos.ToDictionary(ph => ph.PhotoName, ph => ph.base64Value);

            station.StationPicListSerialized = JsonConvert.SerializeObject(dicAllPhoto);
            LoginedUserInfo us = Tools.GetLoginedUserInfo();

            entities.Logs.Add(new Log
            {
                UGuid    = us.UGuid,
                Username = us.UName,
                Memo     = $"更改编号为【{station.Id}】-网点编号为【{station.StationCode}】的网点照片",
                OptType  = (int)OptType.修改,
                OptTime  = DateTime.Now
            });
            entities.SaveChanges();
        }
Exemple #7
0
        //违规信息
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            Button         btn     = sender as Button;
            LotteryStation station = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));

            if (null == station)
            {
                return;
            }
            DockPanel panel = new DockPanel();

            TextBox resultBox = new TextBox
            {
                TextWrapping = TextWrapping.Wrap,
                IsEnabled    = Tools.LoginUserHasRights(),
                Text         = station.Violation,
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            panel.Children.Add(resultBox);

            Window win = new Window
            {
                SizeToContent = SizeToContent.Manual, Title = "违规信息", Icon = new DrawingImage(),
                Content       = panel, Width = 300, Height = 300, Owner = Application.Current.MainWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            win.Closing += (a, b) =>
            {
                //如数据库中已存储的与编辑的不同
                if (station.Violation == resultBox.Text)
                {
                    return;
                }
                if (MessageBoxResult.OK != MessageBox.Show("是否提交更改", "提示", MessageBoxButton.OKCancel))
                {
                    return;
                }
                station.Violation = resultBox.Text;
                LoginedUserInfo u = Tools.GetLoginedUserInfo();
                entities.Logs.Add(new Log
                {
                    UGuid    = u.UGuid,
                    Username = u.UName,
                    Memo     = $"编辑编号为【{station.Id}】-站点编号为【{station.StationCode}】的违规信息",
                    OptType  = (int)OptType.修改,
                    OptTime  = DateTime.Now
                });
                entities.SaveChanges();
            };
            win.ShowDialog();
        }
Exemple #8
0
        //福彩游戏类型
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            LotteryStation s = lvStationInfo.SelectedItem as LotteryStation;

            Button btn = sender as Button;

            if (null == s)
            {
                TextBlock block = VisualTreeHelper.GetChild(VisualTreeHelper.GetParent(btn), 0) as TextBlock;
                s = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(block.Text));
            }
            var aaaa = JsonConvert.DeserializeObject <string[]>(Convert.ToString(btn.Tag));
            SelectWelfareGameType type = new SelectWelfareGameType(aaaa);
            Window win = new Window {
                Content = type, SizeToContent = SizeToContent.Width, WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = Application.Current.MainWindow, MinWidth = 300, Height = 300
            };

            type.lvGameType.ItemsSource     = entities.WelfareLotteryGameTypes.ToList();
            type.GameTypeSelectedCollection = JsonConvert.DeserializeObject <StringCollection>(Convert.ToString(btn.Tag));
            win.ShowDialog();

            if (!type.ChangedResult)
            {
                return;
            }
            var    result    = type.GameTypeSelectedCollection;
            string serialize = JsonConvert.SerializeObject(result);

            s.WelfareGameTypeListSerialized = serialize;
            LoginedUserInfo u = Tools.GetLoginedUserInfo();

            entities.Logs.Add(new Log
            {
                UGuid    = u.UGuid,
                Username = u.UName,
                Memo     = $"编辑编号为【{s.Id}】-站点编号为【{s.StationCode}】的店面游戏类型",
                OptType  = (int)OptType.修改,
                OptTime  = DateTime.Now
            });
            entities.SaveChanges();
            btn.Tag = serialize;
        }
Exemple #9
0
        //双击查看详情
        private void lvStationInfo_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            LotteryStation s = lvStationInfo.SelectedItem as LotteryStation;

            if (null == s)
            {
                return;
            }

            StationInfoSingleDetails details = new StationInfoSingleDetails(s)
            {
                Owner = Application.Current.MainWindow
            };

            details.IsEnabledControl();
            details.ShowDialog();
            lvStationInfo.SelectedItem = null; //防止点击过一次后点击空白处还会自发 只有再次重新选择后才可以
            e.Handled = true;
            details.Close();
        }
Exemple #10
0
        public StationInfoSingleDetails(LotteryStation station)
        {
            InitializeComponent();

            entities = (WelfareLotteryEntities)Application.Current.Resources["WelfareLotteryEntities"];

            this.station = station;

            cmbStationRegion.ItemsSource = entities.StationRegions.ToList();

            manageTypeDictionary                   = entities.StationManageTypes.ToDictionary(key => key.TypeName, value => JsonConvert.DeserializeObject <List <string> >(value.DetailsListSerialized));
            cmbStationManageType.ItemsSource       = manageTypeDictionary.Keys;
            cmbStationManageType.SelectionChanged += CmbStationManageType_SelectionChanged;
            cmbStationRegion.ItemsSource           = entities.StationRegions.ToList();

            cboAdmin.ItemsSource = entities.Administrators.ToList();

            cbxListBox.lvGameType.ItemsSource = entities.WelfareLotteryGameTypes.ToList();

            InitControlValue();
        }
Exemple #11
0
        //双机店查看体彩店信息
        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            if ((btn == null || btn.Cursor != Cursors.Hand))
            {
                return;
            }

            LotteryStation s = lvStationInfo.SelectedItem as LotteryStation ??
                               alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));

            if (!s.MachineType)
            {
                return;
            }

            if (null == s.SportLottery)
            {
                SportLottery lottery = new SportLottery
                {
                    Owner       = Application.Current.MainWindow,
                    cboGameType =
                    {
                        ItemsSource       = entities.SportLotteryGameTypes.ToList(),
                        DisplayMemberPath = "GameType"
                    }
                };
                var result = lottery.ShowDialog();
                if (!result.GetValueOrDefault() || null == lottery.Sport)
                {
                    return;
                }
                s.SportLottery = lottery.Sport;

                entities.SaveChanges();
                LoginedUserInfo userInfo = Tools.GetLoginedUserInfo();
                entities.Logs.Add(new Log
                {
                    UGuid    = userInfo.UGuid,
                    Username = userInfo.UName,
                    Memo     = $"为网点编号为【{s.StationCode}】的网点添加体彩店信息,编号为【{lottery.Sport.Id}】",
                    OptType  = (int)OptType.新增,
                    OptTime  = DateTime.Now
                });
                entities.SaveChanges();
            }
            else
            {
                SportLottery lottery = new SportLottery(s.SportLottery)
                {
                    Owner       = Application.Current.MainWindow,
                    cboGameType =
                    {
                        ItemsSource       = entities.SportLotteryGameTypes.ToList(),
                        DisplayMemberPath = "GameType"
                    }
                };
                var result = lottery.ShowDialog();
                if (!result.GetValueOrDefault() || null == lottery.Sport)
                {
                    return;
                }
                s.SportLottery = lottery.Sport;
                LoginedUserInfo userInfo = Tools.GetLoginedUserInfo();
                entities.Logs.Add(new Log
                {
                    UGuid    = userInfo.UGuid,
                    Username = userInfo.UName,
                    Memo     = $"为网点编号为【{s.StationCode}】的网点编辑体彩店信息,编号为【{lottery.Sport.Id}】",
                    OptType  = (int)OptType.修改,
                    OptTime  = DateTime.Now
                });
                entities.SaveChanges();
            }
        }
Exemple #12
0
        //机主信息
        private void Button_Click_7(object sender, RoutedEventArgs e)
        {
            Button         btn     = sender as Button;
            LotteryStation station = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));

            if (null == station)
            {
                return;
            }
            string[] hostPhoneNum = station.HostPhoneNum.Split('⊙');

            HostInformation hostInfo = new HostInformation
            {
                txtHostPhoneNum1       = { Text = hostPhoneNum[0] },
                txtHostPhoneNum2       = { Text = hostPhoneNum[1] },
                txtHostIdentityAddress = { Text = station.HostIdentityAddress },
                txtHostName            = { Text = station.HostName },
                txtHostIdentityNo      = { Text = station.HostIdentityNo },
                HostBase64Pic          = { Source = u.ByteArrayToBitmapImage(Convert.FromBase64String(station.HostBase64Pic)) }
            };

            hostInfo.EnableAllControl();

            var result = JsonConvert.DeserializeObject <Dictionary <string, string> >(station.HostBase64IdentityPic);

            PhotoCollection photo = hostInfo.hostIdentityPic.Photos;

            result.Keys.ToList().ForEach(k => photo.Add(new Photo(k)
            {
                Image = u.ByteArrayToBitmapImage(Convert.FromBase64String(result[k]))
            }));

            Window win = new Window
            {
                Width  = 350,
                Height = 450,
                Owner  = Application.Current.MainWindow,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Content = hostInfo
            };

            win.Closing += (a, b) =>
            {
                bool changed = false;

                string hostPhoneNum1 = hostInfo.txtHostPhoneNum1.GetTextBoxText();
                string hostPhoneNum2 = hostInfo.txtHostPhoneNum2.GetTextBoxText();

                string hostN = hostInfo.txtHostName.GetTextBoxText();
                if (!hostN.IsNullOrEmpty())
                {
                    changed          = station.HostName != hostN;
                    station.HostName = hostN;
                }
                if ((!hostPhoneNum1.IsNullOrEmpty() && !hostPhoneNum2.IsNullOrEmpty()))
                {
                    var t = $"{hostPhoneNum1}⊙{hostPhoneNum2}";
                    changed = changed || station.HostPhoneNum != t;
                    station.HostPhoneNum = t;
                }
                if (!hostInfo.txtHostIdentityNo.GetTextBoxText().IsNullOrEmpty())
                {
                    changed = changed || station.HostIdentityNo != hostInfo.txtHostIdentityNo.GetTextBoxText();
                    station.HostIdentityNo = hostInfo.txtHostIdentityNo.GetTextBoxText();
                }
                if (!hostInfo.txtHostIdentityAddress.GetTextBoxText().IsNullOrEmpty())
                {
                    changed = changed || station.HostIdentityAddress != hostInfo.txtHostIdentityAddress.GetTextBoxText();
                    station.HostIdentityAddress = hostInfo.txtHostIdentityAddress.GetTextBoxText();
                }
                if (null != hostInfo.HostPic)
                {
                    station.HostBase64Pic = hostInfo.HostPic;
                    changed = true;
                }
                if (hostInfo.hostIdentityPic.IsChanged)
                {
                    station.HostBase64IdentityPic = hostInfo.Identity;
                    changed = true;
                }

                if (changed)
                {
                    LoginedUserInfo us = Tools.GetLoginedUserInfo();
                    entities.Logs.Add(new Log
                    {
                        UGuid    = us.UGuid,
                        Username = us.UName,
                        Memo     = $"编辑编号为【{station.Id}】-站点编号为【{station.StationCode}】的机主信息",
                        OptType  = (int)OptType.修改,
                        OptTime  = DateTime.Now
                    });
                }

                entities.SaveChanges();
                btn.Content = station.HostName;
            };
            win.ShowDialog();
        }
Exemple #13
0
        //查看担保人
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            Button         btn     = sender as Button;
            LotteryStation station = alLotteryStations.FirstOrDefault(p => p.Id == Convert.ToInt32(btn.Tag));

            if (null == station)
            {
                return;
            }

            Grid          grid       = new Grid();
            RowDefinition definition = new RowDefinition {
                Height = GridLength.Auto
            };

            grid.RowDefinitions.Add(definition);
            grid.RowDefinitions.Add(new RowDefinition());

            WrapPanel panel = new WrapPanel();

            Grid.SetRow(panel, 0);

            TextBox inputBox = new TextBox
            {
                MinWidth = 150,
                Text     = station.GuaranteeName,
                Margin   = new Thickness(10, 5, 5, 0),
                Style    = this.FindResource("TextBoxCircleBorder") as Style
            };
            Button btnSumbit = new Button {
                Content = "完成修改", Margin = new Thickness(0, 5, 0, 0)
            };

            panel.Children.Add(new TextBlock {
                Text = "担保人姓名", Margin = new Thickness(0, 5, 5, 0), VerticalAlignment = VerticalAlignment.Center
            });
            panel.Children.Add(inputBox);
            panel.Children.Add(btnSumbit);
            grid.Children.Add(panel);

            var             result = JsonConvert.DeserializeObject <Dictionary <string, string> >(station.GuaranteeBase64IdentityPic);
            PhotoCollection photo  = new PhotoCollection();

            result.Keys.ToList().ForEach(k => photo.Add(new Photo(k)
            {
                Image = u.ByteArrayToBitmapImage(Convert.FromBase64String(result[k]))
            }));

            ImageViewer viewer = new ImageViewer(photo)
            {
                MaxDropPhoto = 2
            };

            Grid.SetRow(viewer, 1);
            grid.Children.Add(viewer);

            Window win = new Window
            {
                Title  = "担保人信息",
                Width  = 320,
                Height = 300,
                Owner  = Application.Current.MainWindow,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Content = grid
            };

            btnSumbit.Click += (s, er) =>
            {
                if (inputBox.GetTextBoxText() == station.GuaranteeName && !viewer.IsChanged)
                {
                    return;
                }
                if (viewer.IsChanged)
                {
                    station.GuaranteeBase64IdentityPic = JsonConvert.SerializeObject(viewer.Photos.ToDictionary(key => key.PhotoName, value => value.base64Value));
                }
                btn.Content = station.GuaranteeName = inputBox.GetTextBoxText();
                LoginedUserInfo u = Tools.GetLoginedUserInfo();
                entities.Logs.Add(new Log
                {
                    UGuid    = u.UGuid,
                    Username = u.UName,
                    Memo     = $"编辑编号为【{station.Id}】-站点编号为【{station.StationCode}】的担保人信息",
                    OptType  = (int)OptType.修改,
                    OptTime  = DateTime.Now
                });
                entities.SaveChanges(); win.Close();
            };

            panel.IsEnabled = viewer.ImageAllowDrop = Tools.LoginUserHasRights();

            win.ShowDialog();
        }
        private void btnAllSubmit_Click(object sender, RoutedEventArgs e)
        {
            #region 网点信息

            string stationCode            = txtStationCode.GetTextBoxText();
            string stationSpecificAddress = txtStationSpecificAddress.GetTextBoxText();
            string stationTarget          = txtStationTarget.GetTextBoxText();
            string stationPhoneNo         = txtStationPhoneNo.GetTextBoxText();

            if (stationCode.IsNullOrEmpty())
            {
                "输入网点编号".MessageBoxDialog();
                return;
            }
            if (stationSpecificAddress.IsNullOrEmpty())
            {
                "输入销售站详细地址".MessageBoxDialog();
                return;
            }
            if (stationTarget.IsNullOrEmpty())
            {
                "输入标的物".MessageBoxDialog();
                return;
            }
            if (stationPhoneNo.IsNullOrEmpty())
            {
                "输入网点电话".MessageBoxDialog();
                return;
            }

            StationRegion region = cmbStationRegion.SelectedItem as StationRegion;
            if (null == region)
            {
                "选择区域".MessageBoxDialog();
                return;
            }

            string manageType      = cmbStationManageType.Text;
            string manageTypeChild = cmbStationManageTypeChild.Text;
            if (manageType.IsNullOrEmpty() || manageTypeChild.IsNullOrEmpty())
            {
                "选择销售站类型".MessageBoxDialog();
                return;
            }

            string usableArea = txtUsableArea.GetTextBoxText();
            if (usableArea.IsNullOrEmpty())
            {
                "输入店面经营使用面积".MessageBoxDialog();
                return;
            }
            string rentDiscount = txtRentDiscount.GetTextBoxText();
            if (usableArea.IsNullOrEmpty())
            {
                "输入租金折价".MessageBoxDialog();
                return;
            }
            DateTime?establishedTime = datePickerCtl.SelectedDate;
            if (!establishedTime.HasValue)
            {
                "选择设立日期".MessageBoxDialog();
                return;
            }
            //销售站店面产权[0:租赁 1:自有]
            bool propertyRight = Convert.ToBoolean(cmbPropertyRight.SelectedIndex);
            //站点单双机情况[0:单机 1:双机]
            bool machineTpe = Convert.ToBoolean(cmbMachineType.SelectedIndex);
            //通讯类型[0:ADSL 1:CDMA]
            bool   communicationType  = Convert.ToBoolean(cmbCommunicationType.SelectedIndex);
            string relatedPhoneNetNum = txtRelatedPhoneNetNum.GetTextBoxText();
            if (relatedPhoneNetNum.IsNullOrEmpty())
            {
                "输入关联电话网络号".MessageBoxDialog();
                return;
            }
            //代销证编号
            string agencyNum = txtAgencyNum.GetTextBoxText();
            if (agencyNum.IsNullOrEmpty())
            {
                "输入代销证编号".MessageBoxDialog();
                return;
            }
            string depositCardNo = txtDepositCardNo.GetTextBoxText();
            if (depositCardNo.IsNullOrEmpty())
            {
                "输入交款卡卡号".MessageBoxDialog();
                return;
            }
            string violation = txtViolation.GetTextBoxText();//可不添

            Administrator admin = cboAdmin.SelectedItem as Administrator;
            if (null == admin)
            {
                "请选择管理员".MessageBoxDialog();
                return;
            }

            string guaranteeName = txtGuaranteeName.GetTextBoxText();
            if (guaranteeName.IsNullOrEmpty())
            {
                "输入担保人姓名".MessageBoxDialog();
                return;
            }
            PhotoCollection guaranteeCollection = GuaranteeIdentity.Photos;
            if (guaranteeCollection.Count != 2)
            {
                "请添加担保人身份证正反面照片!".MessageBoxDialog();
                return;
            }
            _guaranteePicBase64 = JsonConvert.SerializeObject(guaranteeCollection.ToDictionary(key => key.PhotoName, value => value.base64Value));

            #endregion

            #region 机主信息

            string hostName            = HostInformation.txtHostName.GetTextBoxText();
            string hostPhoneNum1       = HostInformation.txtHostPhoneNum1.GetTextBoxText();
            string hostPhoneNum2       = HostInformation.txtHostPhoneNum2.GetTextBoxText();
            string hostIdentityNo      = HostInformation.txtHostIdentityNo.GetTextBoxText();
            string hostIdentityAddress = HostInformation.txtHostIdentityAddress.GetTextBoxText();

            if (hostName.IsNullOrEmpty() || hostPhoneNum1.IsNullOrEmpty() || hostPhoneNum2.IsNullOrEmpty() || hostIdentityNo.IsNullOrEmpty() || hostIdentityAddress.IsNullOrEmpty())
            {
                "添写机主的完整信息".MessageBoxDialog();
                return;
            }

            // PhotoCollection hostPicCol = HostInformation.hostIdentityPic.Photos;
            if (HostInformation.DropImageCount != 2)
            {
                "请添加机主身份证正反面照片!".MessageBoxDialog();
                return;
            }
            #endregion

            PhotoCollection collection = ViewerStationPic.Photos;

            if (collection.Count < 1)
            {
                "请添加网点照片!".MessageBoxDialog();
                return;
            }

            ////查看是否有相同文件名的图片文件
            //if (collection.GroupBy(p=>System.IO.Path.GetFileName(p.Source)).Any(p => p.Count()>1))
            //{
            //    "请不要托入相同文件名的图片!".MessageBoxDialog();
            //    return;
            //}

            //文件名不可能重复
            var dicAllPhoto = collection.ToDictionary(photo => photo.PhotoName, photo => photo.base64Value);

            _allPhotoBase64 = JsonConvert.SerializeObject(dicAllPhoto);

            LotteryStation lottery = new LotteryStation
            {
                Administrator = admin,
                //AdminId = admin.Id,
                Salesclerks            = _addedSalesclerks,
                StationCode            = stationCode,
                StationPhoneNo         = stationPhoneNo,
                StationSpecificAddress = stationSpecificAddress,
                StationTarget          = stationTarget,
                StationRegion          = region,
                //RegionId = region.Id,
                MachineType    = machineTpe,
                ManageTypeName = manageType,
                ManageTypeProgencyListSerialized = manageTypeChild,//现没有多选 所以没有序列化
                StationPicListSerialized         = _allPhotoBase64,
                WelfareGameTypeListSerialized    = JsonConvert.SerializeObject(cbxListBox.GameTypeSelectedCollection),

                AgencyNum          = agencyNum,
                UsableArea         = usableArea,
                EstablishedTime    = establishedTime,
                RentDiscount       = rentDiscount,
                RelatedPhoneNetNum = relatedPhoneNetNum,
                Violation          = violation,
                PropertyRight      = propertyRight,
                CommunicationType  = communicationType,
                DepositCardNo      = depositCardNo,

                HostName              = hostName,
                HostIdentityNo        = hostIdentityNo,
                HostPhoneNum          = $"{hostPhoneNum1}⊙{hostPhoneNum2}",
                HostIdentityAddress   = hostIdentityAddress,
                HostBase64Pic         = HostInformation.HostPic,
                HostBase64IdentityPic = HostInformation.Identity,

                GuaranteeName = guaranteeName,
                GuaranteeBase64IdentityPic = _guaranteePicBase64
            };

            //如不用同一个上下文  这时会出现An entity object cannot be referenced by multiple instances of IEntityChangeTracker 或一个实体对象不能由多个 IEntityChangeTracker 实例引用的异常
            entities.LotteryStations.Add(lottery);
            LoginedUserInfo u = Tools.GetLoginedUserInfo();
            entities.Logs.Add(new Log
            {
                UGuid    = u.UGuid,
                Username = u.UName,
                Memo     = $"增加网点编号为【{stationCode}】的网点",
                OptType  = (int)OptType.新增,
                OptTime  = DateTime.Now
            });
            entities.SaveChanges();
            "录入成功".MessageBoxDialog();
        }