public bool DealJson(ref object errorMg)
        {
            RetrunInfo retrunInfo = new RetrunInfo()
            {
                TrueOrFalse = false
            };

            try
            {
                var p = JToken.Parse(errorMg.ToString());
                if (p["state"].ToString().ToLower().Equals("true"))
                {
                    retrunInfo.TrueOrFalse = true;
                }
                retrunInfo.result     = p["msg"].ToString();
                retrunInfo.ResultCode = p["code"].ToString();
                if (retrunInfo.ResultCode != null && retrunInfo.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                errorMg = retrunInfo;
                return(true);
            }
            catch
            {
                retrunInfo.result      = "未连接服务器";
                retrunInfo.TrueOrFalse = false;
                errorMg = retrunInfo;
                return(false);
            }
        }
 public void Flush()
 {
     if (IsEdit)
     {
         return;
     }
     lock (issn.Text)
     {
         object         isbn     = issn.Text;
         SelectLocalDAL localDAL = new SelectLocalDAL();
         if (localDAL.SelectLoacl(ref isbn))
         {
             RetrunInfo info = isbn 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.Text            = periodicalChooseControl.info.name;
                     fkTypeCode.Text      = periodicalChooseControl.info.fkTypeCode;
                     fkTypeName.Text      = periodicalChooseControl.info.fkTypeName;
                     fkPressName.Text     = periodicalChooseControl.info.fkPressName;
                     unifyNum.Text        = periodicalChooseControl.info.unifyNum;
                     parallelTitle.Text   = periodicalChooseControl.info.parallelTitle;
                     postIssueNumber.Text = periodicalChooseControl.info.postIssueNumber;
                     openBook.Text        = periodicalChooseControl.info.openBook;
                     issnPrice.Text       = periodicalChooseControl.info.issnPrice;
                     releaseCycle.Text    = periodicalChooseControl.info.releaseCycle;
                     remark.Text          = periodicalChooseControl.info.remark;
                     this.id = periodicalChooseControl.info.id;
                     GetCallNumberByIdDAL getCsDAL = new GetCallNumberByIdDAL();
                     object errorMsg = periodicalChooseControl.info.id;
                     if (getCsDAL.GetCallNumberById(ref errorMsg))
                     {
                         RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                         if (retrunInfo.TrueOrFalse)
                         {
                             this.callNumberInfo = retrunInfo.result as CallNumberInfo;
                             if (combox.SelectedIndex == 0)
                             {
                                 callNumber.Text = this.callNumberInfo.searchNumberOrderNum;
                             }
                             else
                             {
                                 callNumber.Text = this.callNumberInfo.searchNumberAuthorNum;
                             }
                         }
                     }
                     grid.ItemsSource = null;
                 }
             }
             else
             {
                 MessageBox.Show("失败提示:" + info.result);
             }
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="paramant">条件</param>
        /// <param name="Querypage">请求页</param>
        /// <returns></returns>
        public bool GetData(object paramant, int Querypage)
        {
            object errorMsg = paramant;
            GetPeriodicalHistoryDAL getBingHistoryDAL = new GetPeriodicalHistoryDAL();

            if (getBingHistoryDAL.GetPeriodicalHistory(ref errorMsg))
            {
                RetrunInfo retrunInfo = errorMsg as RetrunInfo;
                if (retrunInfo.TrueOrFalse)
                {
                    List <BingHistoryInfo> infos = retrunInfo.result as List <BingHistoryInfo>;
                    if (infos.Count <= 0)
                    {
                        DataVisible = Visibility.Hidden;
                        PICVisible  = Visibility.Visible;
                        PICState    = "../Images/无数据.jpg";
                        return(false);
                    }
                    else
                    {
                        DataVisible = Visibility.Visible;
                        PICVisible  = Visibility.Hidden;
                        countPage   = retrunInfo.page;
                        List <BingHistoryInfo> bingHistories = new List <BingHistoryInfo>();
                        int i = 1;
                        foreach (var temp in infos)
                        {
                            temp.number = (Querypage - 1) * 10 + i;
                            bingHistories.Add(temp);
                            i++;
                        }
                        List = bingHistories;
                        return(true);
                    }
                }
                else
                {
                    if (ServerSetting.IsOverDue)
                    {
                        ErrorPage errorPage = new ErrorPage(retrunInfo.result.ToString(), mainControl.mainWindow);
                        DialogHelper.ShowDialog(errorPage);
                        return(false);
                    }
                    else
                    {
                        DataVisible = Visibility.Hidden;
                        PICVisible  = Visibility.Visible;
                        PICState    = "../Images/未连接.png";
                        return(false);
                    }
                }
            }
            else
            {
                DataVisible = Visibility.Hidden;
                PICVisible  = Visibility.Visible;
                PICState    = "../Images/未连接.png";
                return(false);
            }
        }
Exemple #4
0
 public bool PeriadicalChange(ref object errorMsg)
 {
     try
     {
         string url = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/rfidEdit");
         Dictionary <string, object> keyValuePairs = errorMsg as Dictionary <string, object>;
         Http       http       = new Http(url, keyValuePairs);
         var        result     = JToken.Parse(http.HttpPut());
         RetrunInfo retrunInfo = new RetrunInfo();
         retrunInfo.result = result["msg"].ToString();
         if (result["state"].ToString().ToLower().Equals("false"))
         {
             retrunInfo.TrueOrFalse = false;
         }
         else
         {
             retrunInfo.TrueOrFalse = true;
         }
         retrunInfo.ResultCode = result["code"].ToString();
         if (retrunInfo.ResultCode.Contains("300"))
         {
             ServerSetting.IsOverDue = true;
         }
         errorMsg = retrunInfo;
         return(true);
     }
     catch
     {
         errorMsg = "未连接服务器";
         return(false);
     }
 }
Exemple #5
0
 public bool DeletePN(ref object errorMsg)
 {
     try
     {
         RetrunInfo    retrunInfo = new RetrunInfo();
         string        url        = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/deletePN");
         List <string> list       = errorMsg as List <string>;
         Dictionary <string, object> valuePairs = new Dictionary <string, object>();
         valuePairs.Add("ids", list.ToArray());
         Http http   = new Http(url, valuePairs);
         var  result = JToken.Parse(http.HttpDelete());
         retrunInfo.result = result["msg"].ToString();
         if (result["state"].ToString().ToLower().Equals("false"))
         {
             retrunInfo.TrueOrFalse = false;
         }
         else
         {
             retrunInfo.TrueOrFalse = true;
         }
         retrunInfo.ResultCode = result["code"].ToString();
         if (retrunInfo.ResultCode.Contains("300"))
         {
             ServerSetting.IsOverDue = true;
         }
         errorMsg = retrunInfo;
         return(true);
     }
     catch
     {
         errorMsg = "未连接服务器";
         return(false);
     }
 }
 public ISBNListControl(string ISBN, RetrunInfo info)
 {
     InitializeComponent();
     this.ISBN   = ISBN;
     DataContext = null;
     DataContext = new ISBNListViewModel(this, info);
     info        = null;
 }
Exemple #7
0
        public void DealJson(ref object errorMsg)
        {
            RetrunInfo retrunInfo = new RetrunInfo();

            try
            {
                var result = JToken.Parse(errorMsg.ToString());
                retrunInfo.ResultCode = result["code"].ToString();
                if (retrunInfo.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    retrunInfo.TrueOrFalse = false;
                    retrunInfo.result      = result["msg"].ToString();
                    errorMsg = retrunInfo;
                }
                if (result["state"].ToString().ToLower().Equals("true"))
                {
                    int count = result["row"].ToList().Count;
                    List <PeriodicalsInfo> infos = new List <PeriodicalsInfo>();
                    for (int i = 0; i < count; i++)
                    {
                        PeriodicalsInfo periodicalsInfo = new PeriodicalsInfo()
                        {
                            Number = i + 1,
                            id     = result["row"][i]["id"].ToString(),
                            issn   = result["row"][i]["issn"].ToString(),
                            // issnPrice = result["row"][i]["issnPrice"].ToString(),
                            author          = result["row"][i]["author"].ToString(),
                            name            = result["row"][i]["name"].ToString(),
                            fkTypeName      = result["row"][i]["fkTypeName"].ToString(),
                            fkPressName     = result["row"][i]["fkPressName"].ToString(),
                            releaseCycle    = result["row"][i]["releaseCycle"].ToString(),
                            unifyNum        = result["row"][i]["unifyNum"].ToString(),
                            fkTypeCode      = result["row"][i]["fkTypeCode"].ToString(),
                            postIssueNumber = result["row"][i]["postIssueNumber"].ToString(),
                            openBook        = result["row"][i]["openBook"].ToString(),
                            remark          = result["row"][i]["remark"].ToString(),
                            parallelTitle   = result["row"][i]["parallelTitle"].ToString()
                        };
                        infos.Add(periodicalsInfo);
                    }
                    retrunInfo.result      = infos;
                    retrunInfo.TrueOrFalse = true;
                    errorMsg = retrunInfo;
                }
            }
            catch
            {
                retrunInfo.TrueOrFalse = false;
                retrunInfo.result      = "未连接服务器";
                errorMsg = retrunInfo;
            }
        }
Exemple #8
0
        public bool HDHistory(ref object errorMsg)
        {
            try
            {
                RetrunInfo retrunInfo = new RetrunInfo();
                string     url        = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/selectBackissuePeriodicalRfidBindLog");
                Dictionary <string, object> keyValuePairs = errorMsg as Dictionary <string, object>;
                Http http   = new Http(url, keyValuePairs);
                var  result = JToken.Parse(http.HttpPosts());
                retrunInfo.result = result["msg"].ToString();
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    retrunInfo.TrueOrFalse = false;
                }
                else
                {
                    retrunInfo.TrueOrFalse = true;
                    var value = JToken.Parse(result["row"].ToString());
                    List <BingHistoryInfo> infos = new List <BingHistoryInfo>();
                    foreach (var temp in value.Children())
                    {
                        BingHistoryInfo info = new BingHistoryInfo()
                        {
                            name       = temp["periodicalName"].ToString(),
                            code       = temp["periodicalCode"].ToString(),
                            rfid       = temp["nowRfid"].ToString(),
                            callNumber = temp["callNumber"].ToString(),
                            person     = temp["fkHandleModeName"].ToString(),
                            createTime = temp["creatTime"].ToString(),
                            state      = temp["state"].ToString() == "0" ? "失败" : "成功"
                        };
                        infos.Add(info);
                    }
                    retrunInfo.result = infos;
                    retrunInfo.page   = result["total"].ToString().ToInt() / 10;
                    if (result["total"].ToString().ToInt() % 10 != 0)
                    {
                        retrunInfo.page++;
                    }
                }

                retrunInfo.ResultCode = result["code"].ToString();
                if (retrunInfo.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                errorMsg = retrunInfo;
                return(true);
            }
            catch
            {
                errorMsg = "未连接服务器";
                return(false);
            }
        }
Exemple #9
0
        public bool GetHDDCQK(ref object errorMsg)
        {
            try
            {
                RetrunInfo info     = new RetrunInfo();
                double     pageSize = Math.Pow(9, 10);
                string     url      = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/getHDDCQK?cataPeriodicalId=" + errorMsg.ToString());

                Http http   = new Http(url, null);
                var  result = JToken.Parse(http.HttpGet(url).ToString());
                info.ResultCode = result["code"].ToString();
                if (info.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                info.result = result["msg"].ToString();
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    info.TrueOrFalse = false;
                }
                else
                {
                    info.TrueOrFalse = true;
                    List <HDDCQKInfo> list = new List <HDDCQKInfo>();
                    int count = result["row"].ToList().Count;
                    for (int i = 0; i < count; i++)
                    {
                        HDDCQKInfo hDDCQKInfo = new HDDCQKInfo()
                        {
                            IsCheck    = false,
                            number     = i + 1,
                            id         = result["row"][i]["id"].ToString(),
                            code       = result["row"][i]["code"].ToString(),
                            lendState  = result["row"][i]["lendState"].ToString(),
                            callNumber = result["row"][i]["callNumber"].ToString(),
                            price      = result["row"][i]["price"].ToString(),
                            anumber    = result["row"][i]["anumber"].ToString(),
                            snumber    = result["row"][i]["snumber"].ToString()
                        };
                        list.Add(hDDCQKInfo);
                    }
                    info.result = list;
                }
                errorMsg = info;
                return(true);
            }
            catch
            {
                errorMsg = "未连接服务器";
                return(false);
            }
        }
Exemple #10
0
        public bool GetPN(ref object errorMsg)
        {
            RetrunInfo retrunInfo = new RetrunInfo();

            try
            {
                string url  = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/getPN?cataPeriodicalId=" + errorMsg.ToString());
                Http   http = new Http(url, null);
                errorMsg = http.HttpGet(url);
                var result = JToken.Parse(errorMsg.ToString());
                errorMsg = result["msg"].ToString();
                retrunInfo.ResultCode = result["code"].ToString();
                if (retrunInfo.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                if (result["state"].ToString().ToLower().Equals("true"))
                {
                    retrunInfo.TrueOrFalse = true;
                    List <PNInfo> infos = new List <PNInfo>();
                    int           count = result["row"].Children().ToList().Count;
                    for (int i = 0; i < count; i++)
                    {
                        PNInfo info = new PNInfo()
                        {
                            aNumber            = result["row"][i]["aNumber"].ToString(),
                            sNumber            = result["row"][i]["sNumber"].ToString(),
                            fkCataPeriodicalId = result["row"][i]["id"].ToString(),
                            page  = result["row"][i]["page"].ToString(),
                            price = result["row"][i]["price"].ToString(),
                            publicationDateStr = result["row"][i]["publicationDateStr"].ToString(),
                            remark             = result["row"][i]["remark"].ToString()
                        };
                        infos.Add(info);
                    }
                    retrunInfo.result = infos;
                }
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    retrunInfo.TrueOrFalse = false;
                    retrunInfo.result      = result["msg"].ToString();
                }
                errorMsg = retrunInfo;
                return(true);
            }
            catch
            {
                errorMsg = "未连接服务器";
                return(false);
            }
        }
Exemple #11
0
        public PeriodicalViewModel(PeriodicalControl periodicalControl)
        {
            int i = 0;

            this.control = periodicalControl;
            while (i < 10)
            {
                MarCodeList.Add(new MarCodeInfo()
                {
                    PICBG = new BitmapImage(new Uri("02.png", UriKind.RelativeOrAbsolute)), VisibleState = System.Windows.Visibility.Hidden, VisibleState1 = System.Windows.Visibility.Hidden, VisibleState2 = System.Windows.Visibility.Hidden, VisibleState3 = System.Windows.Visibility.Hidden
                });
                i++;
            }
            GetPlaceListDAL listDAL  = new GetPlaceListDAL();
            object          errorMsg = null;

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

            try
            {
                var p = JToken.Parse(errorMsg.ToString());
                foreach (JToken jToken in p)
                {
                    var ken = jToken as JProperty;
                    if (ken.Name.ToLower() == "state" && ken.Value.ToString().ToLower() == "true")
                    {
                        retrunInfo.TrueOrFalse = true;
                    }
                    else if (ken.Name.ToLower() == "state" && ken.Value.ToString().ToLower() == "false")
                    {
                        retrunInfo.TrueOrFalse = false;
                    }
                    if (ken.Name.ToLower().Equals("msg"))
                    {
                        retrunInfo.result = ken.Value.ToString();
                    }
                    if (ken.Name.ToLower().Equals("code"))
                    {
                        retrunInfo.ResultCode = ken.Value.ToString();
                    }
                    if (ken.Name.ToLower().Equals("msg"))
                    {
                        retrunInfo.result = ken.Value.ToString();
                    }
                    if (retrunInfo.ResultCode != null && retrunInfo.ResultCode.Contains("300"))
                    {
                        ServerSetting.IsOverDue = true;
                    }
                }
                errorMsg = retrunInfo;
                return(retrunInfo.TrueOrFalse);
            }
            catch
            {
                retrunInfo.TrueOrFalse = false;
                retrunInfo.result      = "未连接服务器";
                errorMsg = retrunInfo;
                return(false);
            }
        }
Exemple #13
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 #14
0
        public void GetData()
        {
            object        errorMsg      = ServerSetting.parament;
            SelectListDAL selectListDAL = new SelectListDAL();
            bool          flag          = selectListDAL.SelectList(ServerSetting.@class, ref errorMsg);

            if (flag)
            {
                RetrunInfo       info  = errorMsg as RetrunInfo;
                List <QueryInfo> Lists = info.result as List <QueryInfo>;
                bool             flag2 = Lists.Count > 0;
                if (flag2)
                {
                    this.PICVisible    = Visibility.Hidden;
                    this.DataVisible   = Visibility.Visible;
                    ServerSetting.info = Lists;
                    this.List          = Lists;
                    this.LoadPage      = ServerSetting.loadPage.ToString();
                }
                else
                {
                    this.PICVisible          = Visibility.Visible;
                    this.PICState            = new BitmapImage(new Uri("../Images/������.jpg", UriKind.RelativeOrAbsolute));
                    this.DataVisible         = Visibility.Hidden;
                    ServerSetting.totalPages = 0;
                    ServerSetting.List       = null;
                    ServerSetting.loadPage   = 1;
                    ServerSetting.info       = null;
                }
            }
            else
            {
                this.PICVisible  = Visibility.Visible;
                this.PICState    = new BitmapImage(new Uri("../Images/���.png", UriKind.RelativeOrAbsolute));
                this.DataVisible = Visibility.Hidden;
                bool isOverDue = ServerSetting.IsOverDue;
                if (isOverDue)
                {
                    RetrunInfo info2     = errorMsg as RetrunInfo;
                    ErrorPage  errorPage = new ErrorPage(info2.result.ToString(), this.control.mainWindow);
                    DialogHelper.ShowDialog(errorPage);
                }
            }
        }
 public bool GetCallNumberById(ref object errorMsg)
 {
     try
     {
         string     url        = string.Format("{0}{1}", ServerSetting.UrlPath, "data/cata/book/bookcollection/currency/getBopSearchNumber?id=" + errorMsg.ToString());
         Http       http       = new Http(url, null);
         var        result     = JToken.Parse(http.HttpGet(url));
         RetrunInfo retrunInfo = new RetrunInfo();
         if (result["state"].ToString().ToLower().Equals("true"))
         {
             retrunInfo.TrueOrFalse = true;
         }
         else
         {
             retrunInfo.TrueOrFalse = false;
         }
         if (retrunInfo.TrueOrFalse)
         {
             CallNumberInfo info = new CallNumberInfo()
             {
                 searchNumberAuthorNum = result["row"]["searchNumberAuthorNum"].ToString(),
                 searchNumberOrderNum  = result["row"]["searchNumberOrderNum"].ToString()
             };
             retrunInfo.result = info;
         }
         else
         {
             retrunInfo.result = result["msg"].ToString();
         }
         errorMsg = retrunInfo;
         return(true);
     }
     catch
     {
         errorMsg = "未连接服务器";
         return(false);
     }
 }
Exemple #16
0
        public ISBNListViewModel(ISBNListControl control, RetrunInfo info)
        {
            this.control = control;
            PICState     = Visibility.Hidden;

            if (info.TrueOrFalse)
            {
                List = info.result as List <ISBNbookListInfo>;
            }
            else
            {
                control.grid.Visibility = Visibility.Hidden;
                PICState = Visibility.Visible;
                if (string.IsNullOrEmpty(info.ResultCode))
                {
                    ErrorPIC = new BitmapImage(new Uri("../images/未连接.png", UriKind.RelativeOrAbsolute));
                }
                else if (info.ResultCode.Equals("201"))
                {
                    ErrorPIC = new BitmapImage(new Uri("../images/无数据.jpg", UriKind.RelativeOrAbsolute));
                }
            }
        }
        public void DealJson(ref object errorMsg)
        {
            RetrunInfo info = new RetrunInfo();

            try
            {
                var result = JToken.Parse(errorMsg.ToString());
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    info.TrueOrFalse = false;
                }
                else
                {
                    info.TrueOrFalse = true;
                }
                info.result = result["msg"].ToString();
            }
            catch (Exception ex)
            {
                info.TrueOrFalse = false;
                info.result      = ex.Message;
            }
            errorMsg = info;
        }
Exemple #18
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 #19
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);
                     }
                 }
             }
         }
     }
 }
Exemple #20
0
        public bool SelectOne(ref object errorMsg)
        {
            try
            {
                RetrunInfo retrunInfo = new RetrunInfo();
                string     url        = string.Format("{0}{1}", ServerSetting.UrlPath, "rfidmodule/rFIDPeriodicalr/selectOne?id=" + errorMsg.ToString());
                Http       http       = new Http(url, null);
                var        result     = JToken.Parse(http.HttpGet(url));

                errorMsg = result["msg"].ToString();
                retrunInfo.ResultCode = result["code"].ToString();
                if (retrunInfo.ResultCode.Contains("300"))
                {
                    ServerSetting.IsOverDue = true;
                }
                if (result["state"].ToString().ToLower().Equals("true"))
                {
                    retrunInfo.TrueOrFalse = true;
                    PeriodicalsInfo info = new PeriodicalsInfo()
                    {
                        id   = result["row"]["cataTbPeriodicalInfo"]["id"].ToString(),
                        issn = result["row"]["cataTbPeriodicalInfo"]["issn"].ToString(),
                        // issnPrice = result["row"]["cataTbPeriodicalInfo"]["issnPrice"].ToString(),
                        author          = result["row"]["cataTbPeriodicalInfo"]["author"].ToString(),
                        name            = result["row"]["cataTbPeriodicalInfo"]["name"].ToString(),
                        fkTypeName      = result["row"]["cataTbPeriodicalInfo"]["fkTypeName"].ToString(),
                        fkPressName     = result["row"]["cataTbPeriodicalInfo"]["fkPressName"].ToString(),
                        releaseCycle    = result["row"]["cataTbPeriodicalInfo"]["releaseCycle"].ToString(),
                        unifyNum        = result["row"]["cataTbPeriodicalInfo"]["unifyNum"].ToString(),
                        fkTypeCode      = result["row"]["cataTbPeriodicalInfo"]["fkTypeCode"].ToString(),
                        postIssueNumber = result["row"]["cataTbPeriodicalInfo"]["postIssueNumber"].ToString(),
                        openBook        = result["row"]["cataTbPeriodicalInfo"]["openBook"].ToString(),
                        remark          = result["row"]["cataTbPeriodicalInfo"]["remark"].ToString(),
                        parallelTitle   = result["row"]["cataTbPeriodicalInfo"]["parallelTitle"].ToString()
                    };
                    PeriodicalCollectionInfo periodicalCollectionInfo = new PeriodicalCollectionInfo()
                    {
                        id                = result["row"]["id"].ToString(),
                        code              = result["row"]["code"].ToString(),
                        callNumber        = result["row"]["callNumber"].ToString(),
                        available         = result["row"]["available"].ToString(),
                        lendingPermission = result["row"]["lendingPermission"].ToString(),
                        hkPrice           = result["row"]["hkPrice"].ToString(),
                        hkRemark          = result["row"]["hkRemark"].ToString(),
                        placeCode         = result["row"]["placeCode"].ToString(),
                        RFID              = result["row"]["rfid"].ToString()
                    };
                    info.collectionInfo = periodicalCollectionInfo;
                    PNInfo pNInfo = new PNInfo()
                    {
                        fkCataPeriodicalId = result["row"]["periodicalTbNumber"]["id"].ToString(),
                        aNumber            = result["row"]["periodicalTbNumber"]["aNumber"].ToString(),
                        sNumber            = result["row"]["periodicalTbNumber"]["sNumber"].ToString(),
                        price = result["row"]["periodicalTbNumber"]["price"].ToString(),
                        page  = result["row"]["periodicalTbNumber"]["page"].ToString(),
                        publicationDateStr = result["row"]["periodicalTbNumber"]["publicationDate"].ToString(),
                        remark             = result["row"]["periodicalTbNumber"]["remark"].ToString()
                    };
                    info.pNInfo       = pNInfo;
                    retrunInfo.result = info;
                    errorMsg          = retrunInfo;
                }
                if (result["state"].ToString().ToLower().Equals("false"))
                {
                    retrunInfo.TrueOrFalse = false;
                    retrunInfo.result      = result["msg"].ToString();
                }
                errorMsg = retrunInfo;
                return(true);
            }
            catch
            {
                errorMsg = "未连接服务器";
                return(false);
            }
        }
Exemple #21
0
        private bool DealJson(ref object errorMsg)
        {
            try
            {
                bool       result = false;
                string     code   = "";
                var        p      = JToken.Parse(errorMsg.ToString());
                RetrunInfo info   = new RetrunInfo();
                string     a      = p["row"].ToString();
                foreach (JToken jToken in p)
                {
                    var ken = jToken as JProperty;
                    if (ken.Name.ToLower() == "state" && ken.Value.ToString().ToLower() == "true")
                    {
                        result = true;
                    }
                    else if (ken.Name.ToLower() == "state" && ken.Value.ToString().ToLower() == "false")
                    {
                        result = false;
                    }
                    else if (ken.Name.ToLower().Equals("code"))
                    {
                        code = ken.Value.ToString();
                    }
                    else if (ken.Name.ToLower().Equals("msg"))
                    {
                        info.result = ken.Value.ToString();
                    }
                }
                info.ResultCode  = code;
                info.TrueOrFalse = result;
                if (!result)
                {
                    errorMsg = info;
                    return(result);
                }
                foreach (JToken jToken in p)
                {
                    var kens = jToken as JProperty;
                    if (kens.Name.ToLower().Equals("row"))
                    {
                        foreach (JToken ken in kens.Value)
                        {
                            var Ken = ken as JProperty;
                            if (Ken.Name.ToLower().Equals("authorization"))
                            {
                                ServerSetting.Authorization = Ken.Value.ToString();
                            }
                            if (Ken.Name.ToLower().ToLower().Equals("authtbmanager"))
                            {
                                LoginInfo loginInfo = new LoginInfo();
                                loginInfo.UpdateDate = DateTime.Now.ToString("yyyy-MM-ss HH:mm:ss");
                                foreach (JToken j in Ken.Value)
                                {
                                    var jp = j as JProperty;
                                    switch (jp.Name.ToLower())
                                    {
                                    case "username":
                                        loginInfo.UserName     = jp.Value.ToString();
                                        ServerSetting.UserName = jp.Value.ToString();
                                        break;

                                    case "headeraddress":
                                        loginInfo.HeaderAddress     = jp.Value.ToString();
                                        ServerSetting.HeaderAddress = jp.Value.ToString();
                                        break;

                                    default:
                                        break;
                                    }
                                }
                                info.result = loginInfo;
                            }
                        }
                    }
                }
                errorMsg = info;
                return(result);
            }
            catch
            {
                errorMsg = "未连接服务器";
                return(false);
            }
        }
Exemple #22
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());
                }
            });
        }
Exemple #23
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 bool DealJson(ref object errorMsg)
        {
            RetrunInfo retrunInfo = new RetrunInfo()
            {
                TrueOrFalse = false
            };

            try
            {
                var p = JToken.Parse(errorMsg.ToString());
                foreach (JToken kens in p)
                {
                    var ken = kens as JProperty;
                    if (ken.Name.ToLower().Equals("state") && ken.Value.ToString().ToLower().Equals("true"))
                    {
                        retrunInfo.TrueOrFalse = true;
                    }
                    if (ken.Name.ToLower().Equals("code"))
                    {
                        retrunInfo.ResultCode = ken.Value.ToString();
                    }
                    if (ken.Name.ToLower().Equals("msg"))
                    {
                        retrunInfo.result = ken.Value.ToString();
                    }
                    if (retrunInfo.ResultCode != null && retrunInfo.ResultCode.Contains("300"))
                    {
                        ServerSetting.IsOverDue = true;
                    }
                }
                if (!retrunInfo.TrueOrFalse)
                {
                    errorMsg = retrunInfo;
                    return(false);
                }
                foreach (JToken kens in p)
                {
                    var ken = kens as JProperty;
                    if (ken.Name.ToLower().Equals("pages"))
                    {
                        ServerSetting.totalPages = ken.Value.ToInt();
                    }
                    if (ken.Name.ToLower().Equals("row"))
                    {
                        int index             = 1 + (ServerSetting.loadPage - 1) * 10;
                        List <QueryInfo> list = new List <QueryInfo>();
                        foreach (JToken jToken in ken.Value.ToList())
                        {
                            QueryInfo info = new QueryInfo()
                            {
                                num = index
                            };
                            foreach (JToken token in jToken)
                            {
                                var j = token as JProperty;
                                switch (j.Name.ToLower())
                                {
                                case "id":
                                    info.id = j.Value.ToString();
                                    break;

                                case "isbn":
                                    info.ISBN = j.Value.ToString();
                                    break;

                                case "name":
                                    info.BookName = j.Value.ToString();
                                    break;

                                case "author":
                                    info.Author = j.Value.ToString();
                                    break;

                                case "fkpressname":
                                    info.Press = j.Value.ToString();
                                    break;

                                case "publishingtime":
                                    info.PressDate = j.Value.ToString();
                                    break;

                                case "callnumber":
                                    info.CallNumber = j.Value.ToString();
                                    break;

                                case "price":
                                    info.Price = j.Value.ToString();
                                    break;

                                case "fktypename":
                                    info.ClassificationName = j.Value.ToString();
                                    break;

                                case "pagenumber":
                                    info.PageNumber = j.Value.ToString();
                                    break;

                                case "code":
                                    info.CorrectionCode = j.Value.ToString();
                                    break;

                                case "rfid":
                                    info.RFID = j.Value.ToString();
                                    break;

                                case "place":
                                    info.Place = j.Value.ToString();
                                    break;

                                case "bop":
                                    info.bop = j.Value.ToString();
                                    switch (info.bop)
                                    {
                                    case "0":
                                        info.bop = "图书";
                                        break;

                                    default:
                                        info.bop = "期刊";
                                        break;
                                    }
                                    break;

                                case "merge":
                                    info.merge = j.Value.ToString();
                                    break;
                                }
                            }
                            index++;
                            list.Add(info);
                        }
                        retrunInfo.result = list;
                        errorMsg          = retrunInfo;
                    }
                }
                return(true);
            }
            catch
            {
                retrunInfo.result = "未连接服务器";
                errorMsg          = retrunInfo;
                return(false);
            }
        }
        private bool DealJson(ref object errorMsg)
        {
            RetrunInfo retrunInfo = new RetrunInfo()
            {
                TrueOrFalse = false
            };

            try
            {
                var p = JToken.Parse(errorMsg.ToString());
                foreach (JToken jToken in p)
                {
                    var ken = jToken as JProperty;
                    if (ken.Name.ToLower() == "state" && ken.Value.ToString().ToLower() == "true")
                    {
                        retrunInfo.TrueOrFalse = true;
                    }
                    if (ken.Name.ToLower().Equals("msg"))
                    {
                        retrunInfo.result = ken.Value.ToString();
                    }
                    if (ken.Name.ToLower().Equals("code"))
                    {
                        retrunInfo.ResultCode = ken.Value.ToString();
                    }
                    if (ken.Name.ToLower().Equals("msg"))
                    {
                        retrunInfo.result = ken.Value.ToString();
                    }
                    if (retrunInfo.ResultCode != null && retrunInfo.ResultCode.Contains("300"))
                    {
                        ServerSetting.IsOverDue = true;
                    }
                }
                if (!retrunInfo.TrueOrFalse)
                {
                    errorMsg = retrunInfo;
                    return(false);
                }
                foreach (JToken jToken in p)
                {
                    var jProperty = jToken as JProperty;
                    if (jProperty.Name.ToLower() == "row")
                    {
                        List <PlaceInfo> placeInfos = new List <PlaceInfo>();
                        foreach (JToken kens in jProperty.Value)
                        {
                            PlaceInfo placeInfo = new PlaceInfo();
                            foreach (JToken ken in kens.Children())
                            {
                                var k = ken as JProperty;
                                switch (k.Name.ToLower())
                                {
                                case "name":
                                    placeInfo.PlaceName = k.Value.ToString();
                                    break;

                                case "code":
                                    placeInfo.id = k.Value.ToString();
                                    break;
                                }
                            }
                            placeInfos.Add(placeInfo);
                        }
                        retrunInfo.result = placeInfos;
                        errorMsg          = retrunInfo;
                        return(true);
                    }
                }
                return(true);
            }
            catch
            {
                retrunInfo.result      = "未连接服务器";
                retrunInfo.TrueOrFalse = false;
                errorMsg = retrunInfo;
                return(false);
            }
        }
 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();
             }
         }
     }
 }
        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 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 #30
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();
        }