Exemple #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            GetPNDAL getPN    = new GetPNDAL();
            object   errorMsg = fkCataPeriodicalId;

            if (getPN.GetPN(ref errorMsg))
            {
                RetrunInfo info = errorMsg as RetrunInfo;
                if (info.TrueOrFalse)
                {
                    ///弹出列表
                    List <PNInfo>   pNInfos         = info.result as List <PNInfo>;
                    PNChooseControl pNChooseControl = new PNChooseControl(pNInfos, mainControl.mainWindow);
                    pNChooseControl.fkCataPeriodicalId = fkCataPeriodicalId;
                    DialogHelper.ShowDialog(pNChooseControl);
                    if (pNChooseControl.info != null)
                    {
                        aNumber.Content      = pNChooseControl.info.aNumber;
                        sNumber.Text         = pNChooseControl.info.sNumber;
                        price.Text           = pNChooseControl.info.price;
                        page.Text            = pNChooseControl.info.page;
                        Remark.Text          = pNChooseControl.info.remark;
                        date.Text            = pNChooseControl.info.publicationDateStr;
                        periodicalTbNumberId = pNChooseControl.info.fkCataPeriodicalId;
                    }
                }
                else
                {
                    if (ServerSetting.IsOverDue)
                    {
                        ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                        DialogHelper.ShowDialog(errorPage);
                    }
                    else
                    {
                        MessageBox.Show("失败提示:" + info.result);
                    }
                }
            }
            else
            {
                MessageBox.Show(errorMsg.ToString());
            }
        }
Exemple #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ///删除
            PNInfo        pNInfo = grid.SelectedItem as PNInfo;
            List <string> list   = new List <string>()
            {
                pNInfo.fkCataPeriodicalId
            };
            DeletePNDAL pNDAL    = new DeletePNDAL();
            object      errorMsg = list;

            EdeitId = null;
            if (pNDAL.DeletePN(ref errorMsg))
            {
                RetrunInfo info = errorMsg as RetrunInfo;
                if (info.TrueOrFalse)
                {
                    GetPNDAL getPN = new GetPNDAL();
                    errorMsg = fkCataPeriodicalId;
                    if (getPN.GetPN(ref errorMsg))
                    {
                        info = errorMsg as RetrunInfo;
                        if (info.TrueOrFalse)
                        {
                            List <PNInfo> infos = info.result as List <PNInfo>;
                            grid.ItemsSource = null;
                            grid.ItemsSource = infos;
                        }
                        else
                        {
                            if (ServerSetting.IsOverDue)
                            {
                                ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainWindow);
                                DialogHelper.ShowDialog(errorPage);
                            }
                            else
                            {
                                MessageBox.Show("失败提示:" + info.result);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(errorMsg.ToString());
                    }
                }
                else
                {
                    if (ServerSetting.IsOverDue)
                    {
                        this.Close();
                        ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainWindow);
                        DialogHelper.ShowDialog(errorPage);
                    }
                    else
                    {
                        MessageBox.Show("失败提示:" + info.result);
                    }
                }
            }
            else
            {
                MessageBox.Show("失败提示:" + errorMsg.ToString());
            }
        }
Exemple #3
0
        public PeriodicalChangeControl(MainControl mainControl, string id)
        {
            InitializeComponent();
            this.mainControl = mainControl;
            ServerSetting.OldEPClist.Clear();
            ServerSetting.EPClist.Clear();
            thread = new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    if (ServerSetting.rfid.IsOpen())
                    {
                        ServerSetting.rfid.Start();
                    }
                    this.Dispatcher.BeginInvoke((Action) delegate
                    {
                        lock (ServerSetting.EPClist)
                        {
                            if (ServerSetting.EPClist.Count == 0)
                            {
                                //  EPC.Clear();
                            }
                            else
                            {
                                string epc = ServerSetting.EPClist.Dequeue();
                                ServerSetting.EPClist.Enqueue(epc);
                                EPC.Text = epc;
                            }
                        }
                    });
                    Thread.Sleep(500);
                }
            }));
            thread.IsBackground = true;
            Task.Run(() => {
                object errorMsg           = id;
                SelectOneDAL selectOneDAL = new SelectOneDAL();
                if (selectOneDAL.SelectOne(ref errorMsg))
                {
                    RetrunInfo info = errorMsg as RetrunInfo;
                    if (info.TrueOrFalse)
                    {
                        this.Dispatcher.BeginInvoke((Action) delegate {
                            PeriodicalsInfo periodicalsInfo = info.result as PeriodicalsInfo;
                            Name.Text            = periodicalsInfo.name;
                            fkTypeCode.Text      = periodicalsInfo.fkTypeCode;
                            fkTypeName.Text      = periodicalsInfo.fkTypeName;
                            fkPressName.Text     = periodicalsInfo.fkPressName;
                            unifyNum.Text        = periodicalsInfo.unifyNum;
                            parallelTitle.Text   = periodicalsInfo.parallelTitle;
                            postIssueNumber.Text = periodicalsInfo.postIssueNumber;
                            openBook.Text        = periodicalsInfo.openBook;
                            issnPrice.Text       = periodicalsInfo.issnPrice;
                            releaseCycle.Text    = periodicalsInfo.releaseCycle;
                            remark.Text          = periodicalsInfo.remark;
                            fkCataPeriodicalId   = periodicalsInfo.id;

                            this.id         = periodicalsInfo.collectionInfo.id;
                            code.Text       = periodicalsInfo.collectionInfo.code;
                            callNumber.Text = periodicalsInfo.collectionInfo.callNumber;
                            issn.Text       = periodicalsInfo.issn;

                            Remark.Text          = periodicalsInfo.pNInfo.remark;
                            price.Text           = periodicalsInfo.pNInfo.price;
                            page.Text            = periodicalsInfo.pNInfo.page;
                            aNumber.Content      = periodicalsInfo.pNInfo.aNumber;
                            sNumber.Text         = periodicalsInfo.pNInfo.sNumber;
                            date.Text            = periodicalsInfo.pNInfo.publicationDateStr;
                            periodicalTbNumberId = periodicalsInfo.pNInfo.fkCataPeriodicalId;

                            ISBNbookListInfo = new ISBNbookListInfo()
                            {
                                fkTypeCode = periodicalsInfo.collectionInfo.callNumber.Split('/')[0].ToString(),
                                OrderNum   = periodicalsInfo.collectionInfo.callNumber.Split('/')[1].ToString()
                            };
                            EPC.Text = periodicalsInfo.collectionInfo.RFID;
                            if (periodicalsInfo.collectionInfo.available.Equals("0"))
                            {
                                available.IsChecked = false;
                            }
                            else
                            {
                                available.IsChecked = true;
                            }
                            if (periodicalsInfo.collectionInfo.lendingPermission.Equals("0"))
                            {
                                lendingPermission.IsChecked = false;
                            }
                            else
                            {
                                lendingPermission.IsChecked = true;
                            }

                            GetPlaceListDAL listDAL    = new GetPlaceListDAL();
                            List <PlaceInfo> PlaceList = new List <PlaceInfo>();
                            if (listDAL.GetPlaceList(ref errorMsg))
                            {
                                RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                                PlaceList             = retrunInfo.result as List <PlaceInfo>;
                                place.ItemsSource     = PlaceList;
                            }
                            foreach (var place in PlaceList)
                            {
                                if (place.id == periodicalsInfo.collectionInfo.placeCode)
                                {
                                    this.place.SelectedItem = place;
                                }
                            }
                        });
                    }
                    else
                    {
                        if (ServerSetting.IsOverDue)
                        {
                            ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                            DialogHelper.ShowDialog(errorPage);
                        }
                        else
                        {
                            MessageBox.Show("失败提示:" + info.result.ToString());
                        }
                    }
                }
                else
                {
                    MessageBox.Show("失败提示:" + errorMsg.ToString());
                }
            });
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            lock (ServerSetting.EPClist)
            {
                if (place.SelectedIndex < 0)
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选择馆藏地";
                    return;
                }

                if (string.IsNullOrEmpty(id))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选中需要合刊的刊期";
                    return;
                }
                if (string.IsNullOrEmpty(callNumber.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "索取号不能为空";
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未扫描到可用RFID";
                    return;
                }
                if (string.IsNullOrEmpty(code.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "书籍编码不能为空";
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未扫描到可用RFID";
                    return;
                }
                List <HDDCQKInfo> infos = grid.ItemsSource as List <HDDCQKInfo>;
                if (infos == null || infos.Count() <= 0)
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "未选中需要添加如刊期的子刊";
                    return;
                }

                string epc = null;
                if (ServerSetting.EPClist.Count <= 0)
                {
                    epc = EPC.Text;
                }
                else
                {
                    epc = ServerSetting.EPClist.Dequeue();
                }
                Dictionary <string, object> keyValuePairs = new Dictionary <string, object>();

                if ((bool)available.IsChecked)
                {
                    keyValuePairs.Add("available", 1);
                }
                else
                {
                    keyValuePairs.Add("available", 0);
                }
                if ((bool)lendingPermission.IsChecked)
                {
                    keyValuePairs.Add("lendingPermission", 1);
                }
                else
                {
                    keyValuePairs.Add("lendingPermission", 0);
                }
                var list = (from c in infos
                            select c.id).ToArray();
                keyValuePairs.Add("rfid", epc);
                keyValuePairs.Add("callNumber", callNumber.Text);
                keyValuePairs.Add("fkCataPeriodicalId", id);
                keyValuePairs.Add("code", code.Text);
                PlaceInfo placeInfo = place.SelectedItem as PlaceInfo;
                keyValuePairs.Add("placeCode", placeInfo.id);
                keyValuePairs.Add("ids", list);
                keyValuePairs.Add("hkPrice", hkPrice.Text.ToInt());
                keyValuePairs.Add("hkRemark", hkRemark.Text);
                if (!IsEdit)
                {
                    object errorMsg = keyValuePairs;
                    ///接口
                    AddHDDAL addHDDAL = new AddHDDAL();
                    EPC.Clear();
                    if (addHDDAL.AddHD(ref errorMsg))
                    {
                        RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                        if (retrunInfo.TrueOrFalse)
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#00E08E"));
                            BindState.Content    = "已绑定";
                            grid.ItemsSource     = null;
                            code.Clear();
                            EPC.Clear();
                        }
                        else
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                            BindState.Content    = "未绑定";
                            EPC.Clear();
                            if (ServerSetting.IsOverDue)
                            {
                                ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                                DialogHelper.ShowDialog(errorPage);
                            }
                        }
                    }
                    else
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                        BindState.Content    = "未绑定";
                    }
                    EPC.Clear();
                }
                else
                {
                    keyValuePairs.Add("id", EditId);
                    object errorMsg = keyValuePairs;
                    ///接口
                    HDEditDAL addHDDAL = new HDEditDAL();
                    if (addHDDAL.HDEdit(ref errorMsg))
                    {
                        RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                        if (retrunInfo.TrueOrFalse)
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#00E08E"));
                            BindState.Content    = "修改成功";
                        }
                        else
                        {
                            BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                            BindState.Content    = "修改失败";
                            if (ServerSetting.IsOverDue)
                            {
                                ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                                DialogHelper.ShowDialog(errorPage);
                            }
                        }
                    }
                    else
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                        BindState.Content    = "修改失败";
                    }
                }
            }
        }
Exemple #5
0
        private void OkBtn_Click(object sender, RoutedEventArgs e)
        {
            lock (ServerSetting.EPClist)
            {
                if (string.IsNullOrEmpty(code.Text))
                {
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    return;
                }
                string epc = ServerSetting.EPClist.Dequeue();
                Dictionary <string, object> keyValuePairs = new Dictionary <string, object>();
                if ((bool)available.IsChecked)
                {
                    keyValuePairs.Add("available", 1);
                }
                else
                {
                    keyValuePairs.Add("available", 0);
                }
                if ((bool)lendingPermission.IsChecked)
                {
                    keyValuePairs.Add("lendingPermission", 1);
                }
                else
                {
                    keyValuePairs.Add("lendingPermission", 0);
                }

                keyValuePairs.Add("callNumber", callNumber.Text);
                keyValuePairs.Add("code", code.Text);
                keyValuePairs.Add("rfid", epc);

                PlaceInfo placeInfo = place.SelectedItem as PlaceInfo;
                keyValuePairs.Add("placeCode", placeInfo.id);
                keyValuePairs.Add("fkCataPeriodicalId", fkCataPeriodicalId);
                keyValuePairs.Add("pNumberId", periodicalTbNumberId);
                keyValuePairs.Add("id", id);

                PeriadicalChangeDAL periadical = new PeriadicalChangeDAL();
                object errorMsg = keyValuePairs;
                if (periadical.PeriadicalChange(ref errorMsg))
                {
                    RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                    if (retrunInfo.TrueOrFalse)
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#00E08E"));
                        BindState.Content    = "修改成功";
                    }
                    else
                    {
                        BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                        BindState.Content    = "修改失败";
                        if (ServerSetting.IsOverDue)
                        {
                            ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                            DialogHelper.ShowDialog(errorPage);
                        }
                    }
                }
                else
                {
                    BindState.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)"#FF2E2E"));
                    BindState.Content    = "修改失败";
                }
            }
        }
        public BIssueSubscription_Control(MainControl mainControl, string id)
        {
            InitializeComponent();
            EPC.IsReadOnly   = true;
            this.mainControl = mainControl;
            this.EditId      = id;

            if (!string.IsNullOrEmpty(id))
            {
                IsEdit = true;
            }
            string          placeId  = ConfigurationManager.AppSettings["PlaceId"];
            GetPlaceListDAL listDAL  = new GetPlaceListDAL();
            object          errorMsg = null;

            ServerSetting.OldEPClist.Clear();
            ServerSetting.EPClist.Clear();
            PlaceInfo        Place     = new PlaceInfo();
            List <PlaceInfo> PlaceList = new List <PlaceInfo>();

            if (listDAL.GetPlaceList(ref errorMsg))
            {
                RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                PlaceList         = retrunInfo.result as List <PlaceInfo>;
                place.ItemsSource = PlaceList;
                if (PlaceList.Count > 0)
                {
                    if (!string.IsNullOrEmpty(placeId))
                    {
                        foreach (PlaceInfo info in PlaceList)
                        {
                            if (info.id == placeId)
                            {
                                Place = info;
                            }
                        }
                        mainControl.info.Place = Place.PlaceName;
                        ServerSetting.Place    = Place.PlaceName;
                        place.SelectedItem     = Place;
                    }
                    else
                    {
                        try
                        {
                            Place = PlaceList[0];
                            mainControl.info.Place = Place.PlaceName;
                            ServerSetting.Place    = Place.PlaceName;
                            Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //首先打开配置文件
                            cfa.AppSettings.Settings["PlaceId"].Value = Place.id;
                            cfa.Save(ConfigurationSaveMode.Modified);                                                   //保存配置文件
                            ConfigurationManager.RefreshSection("appSettings");                                         //刷新配置文件
                            place.SelectedItem = Place;
                        }
                        catch { }
                    }
                }
            }

            mainControl.thread = new Thread(new ThreadStart(() =>
            {
                while (true)
                {
                    if (ServerSetting.rfid.IsOpen())
                    {
                        ServerSetting.rfid.Start();
                    }
                    this.Dispatcher.BeginInvoke((Action) delegate
                    {
                        lock (ServerSetting.EPClist)
                        {
                            if (ServerSetting.EPClist.Count == 0)
                            {
                                // EPC.Clear();
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(EPC.Text))
                                {
                                    string epc = ServerSetting.EPClist.Dequeue();
                                    ServerSetting.EPClist.Enqueue(epc);

                                    EPC.Text = epc;
                                }
                                if (!string.IsNullOrEmpty(EditId))
                                {
                                    string epc = ServerSetting.EPClist.Dequeue();
                                    ServerSetting.EPClist.Enqueue(epc);

                                    EPC.Text = epc;
                                }
                            }
                        }
                    });
                    Thread.Sleep(500);
                }
            }));
            mainControl.thread.IsBackground = true;
            Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(id))
                {
                    errorMsg = id;
                    SelectHDOneDAL selectHDOneDAL = new SelectHDOneDAL();
                    if (selectHDOneDAL.SelectHDOne(ref errorMsg))
                    {
                        this.Dispatcher.BeginInvoke((Action) delegate
                        {
                            backBtn.Visibility = Visibility.Visible;
                            RetrunInfo info    = errorMsg as RetrunInfo;
                            if (info.TrueOrFalse)
                            {
                                PeriodicalsInfo periodicalsInfo = info.result as PeriodicalsInfo;
                                this.info            = periodicalsInfo;
                                Name.Text            = periodicalsInfo.name;
                                fkTypeCode.Text      = periodicalsInfo.fkTypeCode;
                                fkTypeName.Text      = periodicalsInfo.fkTypeName;
                                fkPressName.Text     = periodicalsInfo.fkPressName;
                                unifyNum.Text        = periodicalsInfo.unifyNum;
                                parallelTitle.Text   = periodicalsInfo.parallelTitle;
                                postIssueNumber.Text = periodicalsInfo.postIssueNumber;
                                openBook.Text        = periodicalsInfo.openBook;
                                issnPrice.Text       = periodicalsInfo.issnPrice;
                                releaseCycle.Text    = periodicalsInfo.releaseCycle;
                                remark.Text          = periodicalsInfo.remark;
                                this.id = periodicalsInfo.id;

                                hkPrice.Text       = periodicalsInfo.collectionInfo.hkPrice;
                                hkRemark.Text      = periodicalsInfo.collectionInfo.hkRemark;
                                code.Text          = periodicalsInfo.collectionInfo.code;
                                callNumber.Text    = periodicalsInfo.collectionInfo.callNumber;
                                issnMsg.Visibility = Visibility.Hidden;
                                issn.Text          = periodicalsInfo.issn;
                                EditId             = periodicalsInfo.collectionInfo.id;
                                ISBNbookListInfo   = new ISBNbookListInfo()
                                {
                                    fkTypeCode = periodicalsInfo.collectionInfo.callNumber.Split('/')[0].ToString(),
                                    OrderNum   = periodicalsInfo.collectionInfo.callNumber.Split('/')[1].ToString()
                                };
                                EPC.Text         = periodicalsInfo.collectionInfo.RFID;
                                grid.ItemsSource = periodicalsInfo.pNInfos;
                                if (periodicalsInfo.collectionInfo.available.Equals("0"))
                                {
                                    available.IsChecked = false;
                                }
                                else
                                {
                                    available.IsChecked = true;
                                }
                                if (periodicalsInfo.collectionInfo.lendingPermission.Equals("0"))
                                {
                                    lendingPermission.IsChecked = false;
                                }
                                else
                                {
                                    lendingPermission.IsChecked = true;
                                }
                                foreach (var place in PlaceList)
                                {
                                    if (place.id == periodicalsInfo.collectionInfo.placeCode)
                                    {
                                        this.place.SelectedItem = place;
                                    }
                                }
                            }
                            else
                            {
                                if (ServerSetting.IsOverDue)
                                {
                                    ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                                    DialogHelper.ShowDialog(errorPage);
                                }
                                else
                                {
                                    MessageBox.Show("失败提示:" + info.result.ToString());
                                }
                            }
                        });
                    }
                    else
                    {
                        MessageBox.Show(errorMsg.ToString());
                    }
                }
            });
        }
        private void ManageBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(id))
            {
                return;
            }
            object       errorMsg     = id;
            GetHDDCQKDAL getHDDCQKDAL = new GetHDDCQKDAL();

            if (getHDDCQKDAL.GetHDDCQK(ref errorMsg))
            {
                RetrunInfo info = errorMsg as RetrunInfo;
                if (info.TrueOrFalse)
                {
                    this.infos = info.result as List <HDDCQKInfo>;
                    List <HDDCQKInfo> lists = grid.ItemsSource as List <HDDCQKInfo>;
                    if (lists != null && lists.Count > 0)
                    {
                        foreach (var temp in lists)
                        {
                            foreach (var emp in infos)
                            {
                                if (temp.id == emp.id)
                                {
                                    emp.IsCheck = true;
                                }
                            }
                        }
                        var temps = (from c in lists
                                     where !(from d in infos
                                             select d.id).Contains(c.id)
                                     select c
                                     ).ToList();
                        foreach (var temp in temps)
                        {
                            temp.IsCheck = true;
                            infos.Add(temp);
                        }
                    }
                }
                else
                {
                    if (ServerSetting.IsOverDue)
                    {
                        ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                        DialogHelper.ShowDialog(errorPage);
                    }
                    else
                    {
                        MessageBox.Show("失败提示:" + info.result);
                    }
                }
            }
            FrequencyChooseControl frequencyChooseControl = new FrequencyChooseControl(infos);

            //DialogHelper.ShowDialog(frequencyChooseControl);
            frequencyChooseControl.ShowDialog();
            List <HDDCQKInfo> list = new List <HDDCQKInfo>();
            int    i          = 1;
            double countPrice = 0;

            foreach (var temp in frequencyChooseControl.infos)
            {
                HDDCQKInfo info = new HDDCQKInfo()
                {
                    number     = i,
                    anumber    = temp.anumber,
                    snumber    = temp.snumber,
                    price      = temp.price,
                    code       = temp.code,
                    id         = temp.id,
                    lendState  = GetState(temp.lendState),
                    callNumber = temp.callNumber
                };
                countPrice = info.price.ToDouble() + countPrice;
                list.Add(info);
                i++;
            }
            grid.ItemsSource   = null;
            grid.ItemsSource   = list;
            CountPrice.Content = "总价:" + countPrice;
        }
 private void LoginPassWord_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         IntPtr p        = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(LoginPassWord.SecurePassword);
         string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p);
         ///
         string LoginAccount = Account.Text;
         Account.Focus();
         if (string.IsNullOrEmpty(LoginAccount))
         {
             AccountError.Content = "登陆账户不可为空";
             return;
         }
         if (string.IsNullOrEmpty(password))
         {
             PassWordError.Content = "登陆密码不可为空";
             return;
         }
         LoginDAL loginDAL = new LoginDAL(LoginAccount, password);
         object   errorMsg = null;
         if (loginDAL.GetLoginResult(ref errorMsg))
         {
             ServerSetting.BarcodePrinterName  = null;
             ServerSetting.BookmarkPrinterName = null;
             ServerSetting.Account             = LoginAccount;
             ServerSetting.PassWord            = password;
             GetUserDAL.GetUser();
             ServerSetting.userInfo.PassWord = password;
             try
             {
                 Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //首先打开配置文件
                 cfa.AppSettings.Settings["Account"].Value = LoginAccount;
                 if (Check.IsChecked == true)
                 {
                     cfa.AppSettings.Settings["PassWord"].Value = password;
                     cfa.AppSettings.Settings["IsCheck"].Value  = "True";
                 }
                 else
                 {
                     cfa.AppSettings.Settings["IsCheck"].Value = "False";
                 }
                 cfa.Save(ConfigurationSaveMode.Modified);           //保存配置文件
                 ConfigurationManager.RefreshSection("appSettings"); //刷新配置文件
             }
             catch { }
             MainControl mainControl = new MainControl(mainWindow);
             mainWindow.gridControl.Children.Clear();
             mainWindow.gridControl.Children.Add(mainControl);
             mainControl.Focus();
         }
         else
         {
             try
             {
                 RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                 if (retrunInfo.ResultCode.Equals("301"))
                 {
                     AccountError.Content = retrunInfo.result.ToString();
                 }
                 if (retrunInfo.ResultCode.Equals("201"))
                 {
                     PassWordError.Content = retrunInfo.result.ToString();
                 }
             }
             catch
             {
                 ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainWindow);
                 errorPage.ShowDialog();
             }
         }
     }
 }
Exemple #9
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            lock (BookCode.Text)
            {
                if (place.SelectedIndex < 0)
                {
                    error.Content      = "未选择馆藏地";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (periodicalInfo == null || string.IsNullOrEmpty(periodicalInfo.fkCataPeriodicalId))
                {
                    error.Content      = "未选中需要绑定的期刊";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(CallNumberTxt.Text))
                {
                    error.Content      = "索取号不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(periodicalInfo.pNumberId))
                {
                    error.Content      = "未选定子刊";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(BookCode.Text))
                {
                    error.Content      = "书籍编码不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (string.IsNullOrEmpty(EPC.Text))
                {
                    error.Content      = "书籍编码不能为空";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    return;
                }
                if (periodicalInfo == null)
                {
                    return;
                }
                if (lendingPermission.IsChecked.Value == true)
                {
                    periodicalInfo.lendingPermission = "1";
                }
                else
                {
                    periodicalInfo.lendingPermission = "0";
                }
                if (available.IsChecked.Value == true)
                {
                    periodicalInfo.available = "1";
                }
                else
                {
                    periodicalInfo.available = "0";
                }
                periodicalInfo.callNumber = CallNumberTxt.Text;
                periodicalInfo.code       = BookCode.Text;
                string epc = ServerSetting.EPClist.Dequeue();
                periodicalInfo.rfid = epc;

                if (ServerSetting.OldEPClist.Contains(epc))
                {
                    error.Content      = "RFID重复";
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    EPC.Clear();
                    return;
                }
                PlaceInfo placeInfo = place.SelectedItem as PlaceInfo;
                periodicalInfo.placeId = placeInfo.id;
                PeriodicalAddDAL periodicalAddDAL = new PeriodicalAddDAL();
                object           errorMsg         = periodicalInfo;
                if (periodicalAddDAL.PeriodicalAdd(ref errorMsg))
                {
                    RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                    if (!retrunInfo.TrueOrFalse)
                    {
                        Success.Visibility = Visibility.Hidden;
                        False.Visibility   = Visibility.Visible;
                        if (retrunInfo.result.Equals("RFID重复"))
                        {
                            ServerSetting.OldEPClist.Enqueue(epc);
                        }
                        if (ServerSetting.IsOverDue)
                        {
                            ErrorPage errorPage = new ErrorPage(error.Content.ToString(), mainControl.mainWindow);
                            DialogHelper.ShowDialog(errorPage);
                        }
                        error.Content       = retrunInfo.result.ToString();
                        BookCode.IsReadOnly = true;
                    }
                    else
                    {
                        Success.Visibility = Visibility.Visible;
                        False.Visibility   = Visibility.Hidden;
                        EPC.Clear();
                        ///成功列入已处理列
                        ServerSetting.OldEPClist.Enqueue(epc);
                        BookCode.IsReadOnly = true;
                        ///增加图片
                        List <MarCodeInfo> infos = MarCodeList.ItemsSource as List <MarCodeInfo>;
                        AddCell(infos, CallNumberTxt.Text);
                        int    index = CallNumberTxt.Text.IndexOf("/");
                        string str1  = "";
                        string str   = CallNumberTxt.Text.Substring(0, index + 1);
                        if (CallNumberTxt.Text.Length > index + 1)
                        {
                            str1 = CallNumberTxt.Text.Substring(index + 1, CallNumberTxt.Text.Length - index - 1);
                        }
                        CallNumberTxt.Text = str + (str1.ToInt() + 1).ToString();
                        error.Content      = "";
                        if (!string.IsNullOrEmpty(infos[infos.Count - 1].MarCode3))
                        {
                            MessageBox.Show("单次操作最多可打印40张书标,后续绑定将不再生成");
                        }
                    }
                }
                else
                {
                    Success.Visibility = Visibility.Hidden;
                    False.Visibility   = Visibility.Visible;
                    EPC.Clear();
                }
                BookCode.Clear();
            }
            EPC.Clear();
        }
Exemple #10
0
 private void Isbn_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         lock (Isbn.Text)
         {
             object         issn     = Isbn.Text;
             SelectLocalDAL localDAL = new SelectLocalDAL();
             if (localDAL.SelectLoacl(ref issn))
             {
                 RetrunInfo info = issn as RetrunInfo;
                 if (info.TrueOrFalse)
                 {
                     List <PeriodicalsInfo>  infos = info.result as List <PeriodicalsInfo>;
                     PeriodicalChooseControl periodicalChooseControl = new PeriodicalChooseControl(infos);
                     DialogHelper.ShowDialog(periodicalChooseControl);
                     if (periodicalChooseControl.info != null)
                     {
                         Name.Content            = periodicalChooseControl.info.name;
                         fkTypeCode.Content      = periodicalChooseControl.info.fkTypeCode;
                         fkTypeName.Content      = periodicalChooseControl.info.fkTypeName;
                         fkPressName.Content     = periodicalChooseControl.info.fkPressName;
                         Author.Content          = periodicalChooseControl.info.author;
                         unifyNum.Content        = periodicalChooseControl.info.unifyNum;
                         parallelTitle.Content   = periodicalChooseControl.info.parallelTitle;
                         postIssueNumber.Content = periodicalChooseControl.info.postIssueNumber;
                         openBook.Content        = periodicalChooseControl.info.openBook;
                         issnPrice.Content       = periodicalChooseControl.info.issnPrice;
                         releaseCycle.Content    = periodicalChooseControl.info.releaseCycle;
                         remark.Content          = periodicalChooseControl.info.remark;
                         periodicalInfo          = new PeriodicalInfo()
                         {
                             fkCataPeriodicalId = periodicalChooseControl.info.id,
                         };
                         ///弹出框
                         #region 索取号
                         GetCallNumberByIdDAL getCsDAL = new GetCallNumberByIdDAL();
                         object errorMsg = periodicalChooseControl.info.id;
                         if (getCsDAL.GetCallNumberById(ref errorMsg))
                         {
                             RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                             if (retrunInfo.TrueOrFalse)
                             {
                                 this.info = retrunInfo.result as CallNumberInfo;
                                 callNumbermsg.Visibility = Visibility.Hidden;
                                 if (combox.SelectedIndex == 0)
                                 {
                                     CallNumberTxt.Text = this.info.searchNumberOrderNum;
                                 }
                                 else
                                 {
                                     CallNumberTxt.Text = this.info.searchNumberAuthorNum;
                                 }
                             }
                         }
                     }
                     #endregion
                 }
                 else
                 {
                     if (ServerSetting.IsOverDue)
                     {
                         ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                         DialogHelper.ShowDialog(errorPage);
                     }
                     else
                     {
                         MessageBox.Show("失败提示:" + info.result);
                     }
                 }
             }
         }
     }
 }
        /// <summary>
        /// 弹出列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (string.IsNullOrEmpty(Isbn.Text))
            {
                return;
            }
            if (e.Key == Key.Enter)
            {
                object               errorMsg = Isbn.Text;
                ISBNListControl      iSBNListControl;
                GetBookListByISBNDAL iSBNDAL = new GetBookListByISBNDAL();
                iSBNDAL.GetBookListByISBN(ref errorMsg);

                RetrunInfo info = errorMsg as RetrunInfo;
                if (info.TrueOrFalse)
                {
                    iSBNListControl = new ISBNListControl(Isbn.Text, info);
                    DialogHelper.ShowDialog(iSBNListControl);
                    if (iSBNListControl.info != null)
                    {
                        mainControl.info         = iSBNListControl.info;
                        BookName.Content         = iSBNListControl.info.BookName;
                        Price.Content            = iSBNListControl.info.Price;
                        Author.Content           = iSBNListControl.info.Author;
                        Press.Content            = iSBNListControl.info.Press;
                        PressDate.Content        = iSBNListControl.info.PressDate;
                        CallNumber.Content       = iSBNListControl.info.CallNumber;
                        PageNumber.Content       = iSBNListControl.info.PageNumber;
                        Classification.Content   = iSBNListControl.info.Classification;
                        callNumbermsg.Visibility = Visibility.Hidden;
                    }
                    if (iSBNListControl.info == null)
                    {
                        return;
                    }
                    errorMsg = iSBNListControl.info.id;
                    GetCallNumberByIdDAL selectCataOrderByIDDAL = new GetCallNumberByIdDAL();
                    if (selectCataOrderByIDDAL.GetCallNumberById(ref errorMsg))
                    {
                        RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                        this.info = retrunInfo.result as CallNumberInfo;
                        try
                        {
                            if (combox.SelectedIndex == 0)
                            {
                                CallNumber.Content = this.info.searchNumberOrderNum;
                                CallNumberTxt.Text = this.info.searchNumberOrderNum;
                            }
                            else
                            {
                                CallNumber.Content = this.info.searchNumberAuthorNum;
                                CallNumberTxt.Text = this.info.searchNumberAuthorNum;
                            }
                        }
                        catch { }
                    }
                    else
                    {
                        if (ServerSetting.IsOverDue)
                        {
                            ErrorPage errorPage = new ErrorPage(errorMsg.ToString(), mainControl.mainWindow);
                            DialogHelper.ShowDialog(errorPage);
                        }
                    }
                }
                else
                {
                    if (ServerSetting.IsOverDue)
                    {
                        ErrorPage errorPage = new ErrorPage(info.result.ToString(), mainControl.mainWindow);
                        DialogHelper.ShowDialog(errorPage);
                        return;
                    }
                    else
                    {
                        error.Content = info.result + "";
                    }
                }
            }
        }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     lock (BookCode.Text)
     {
         if (mainControl.info == null)
         {
             return;
         }
         if (string.IsNullOrEmpty(mainControl.info.id))
         {
             error.Content      = "未选中需要绑定的书籍";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(EPC.Text))
         {
             error.Content      = "未扫描到可用RFID";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(CallNumberTxt.Text))
         {
             error.Content      = "索取号不能为空";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         if (string.IsNullOrEmpty(BookCode.Text))
         {
             error.Content      = "书籍编码不能为空";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             return;
         }
         mainControl.info.CallNumber = CallNumberTxt.Text;
         mainControl.info.EPC        = ServerSetting.EPClist.Dequeue();
         if (ServerSetting.OldEPClist.Contains(mainControl.info.EPC))
         {
             error.Content      = "RFID重复";
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             EPC.Clear();
             return;
         }
         mainControl.info.BookCdoe = BookCode.Text;
         AddRfidDAL addRfidDAL = new AddRfidDAL();
         object     errorMsg   = mainControl.info;
         if (addRfidDAL.AddRfid(ref errorMsg))
         {
             Success.Visibility = Visibility.Visible;
             False.Visibility   = Visibility.Hidden;
             EPC.Clear();
             ///成功列入已处理列
             ServerSetting.OldEPClist.Enqueue(mainControl.info.EPC);
             BookCode.IsReadOnly = true;
             ///增加图片
             List <MarCodeInfo> infos = MarCodeList.ItemsSource as List <MarCodeInfo>;
             AddCell(infos, mainControl.info.CallNumber);
             int    index = CallNumberTxt.Text.IndexOf("/");
             string str1  = "";
             string str   = CallNumberTxt.Text.Substring(0, index + 1);
             if (CallNumberTxt.Text.Length > index + 1)
             {
                 str1 = CallNumberTxt.Text.Substring(index + 1, CallNumberTxt.Text.Length - index - 1);
             }
             CallNumberTxt.Text          = str + (str1.ToInt() + 1).ToString();
             mainControl.info.CallNumber = CallNumberTxt.Text;
             error.Content = "";
             if (!string.IsNullOrEmpty(infos[infos.Count - 1].MarCode3))
             {
                 MessageBox.Show("单次操作最多可打印40张书标,后续绑定将不再生成");
             }
         }
         else
         {
             try
             {
                 RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                 if (retrunInfo.result.Equals("RFID重复"))
                 {
                     ServerSetting.OldEPClist.Enqueue(mainControl.info.EPC);
                 }
                 error.Content = retrunInfo.result.ToString();
             }
             catch
             { }
             Success.Visibility = Visibility.Hidden;
             False.Visibility   = Visibility.Visible;
             EPC.Clear();
             if (ServerSetting.IsOverDue)
             {
                 ErrorPage errorPage = new ErrorPage(error.Content.ToString(), mainControl.mainWindow);
                 DialogHelper.ShowDialog(errorPage);
             }
         }
         BookCode.Clear();
     }
     BookCode.IsReadOnly = true;
 }