Esempio n. 1
0
        /// <summary>
        /// 获取全部订单
        /// </summary>
        /// <returns>全部订单</returns>
        public IEnumerable GetAllCreateCatalogArray()
        {
            List <CreateCatalogList> result = new List <CreateCatalogList>();

            try
            {
                DataTable datatable = createDal.GetAllCatalogList();
                foreach (DataRow dr in datatable.Rows)
                {
                    CreateCatalogList createCatalogList = new CreateCatalogList()
                    {
                        Id               = (int)dr["编号"],
                        FirstAuthor      = dr["第一作者"].ToString(),
                        ISBN             = dr["ISBN号"].ToString(),
                        PositiveTitle    = dr["正题名"].ToString(),
                        PrimaryLiability = dr["第一责任"].ToString(),
                        DocumentType     = dr["文献类型"].ToString(),
                        CatalogingDate   = (DateTime)dr["编目日期"],
                    };
                    result.Add(createCatalogList);
                }
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 修改一条采访编目记录
        /// </summary>
        /// <param name="list">编目清单</param>
        /// <returns>修改成功与否</returns>
        public bool UpdateCatalogList(CreateCatalogList list, ref List <string> errorMsg)
        {
            bool result = false;

            try
            {
                if (list.Id == 0)
                {
                    errorMsg.Add("Id Error");
                    return(false);
                }
                if (!CreateCatalogList.isNull(list))                       //是否有空项
                {
                    if (CreateCatalogList.isNormative(list, ref errorMsg)) //是否符合规范
                    {
                        result = createDal.UpdateCatalogList(list);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
            return(result);
        }
Esempio n. 3
0
        public void AddCatalogListTest()
        {
            Tools.UserCaseHandle userCaseHandle = new Tools.UserCaseHandle(@"E:\大三课程文档汇总\软件工程\FunctionTest\Add_CreateCatalogList.xls");
            IEnumerable          createCatalog  = userCaseHandle.GetUserCases();
            List <string>        errorList      = new List <string>();

            foreach (var i in createCatalog)
            {
                Assert.AreEqual(false, createCatalogBll.AddCatalogList((CreateCatalogList)i, ref errorList));
            }
            CreateCatalogList list = new CreateCatalogList()
            {
                Id                = 1,
                ISBN              = "1234567890",
                PositiveTitle     = "阿衰正传" + DateTime.Now.Date.ToString("yy-MM-dd"),
                FirstAuthor       = "小七" + DateTime.Now.Date.ToString("yy-MM-dd"),
                PrimaryLiability  = "笑哈哈出版社" + DateTime.Now.Date.ToString("yy-MM-dd"),
                CatalogerId       = 1,
                CatalogingDate    = DateTime.Now,
                DocumentType      = "专著",
                PublishingHouseId = 1,
            };

            Assert.AreEqual(true, createCatalogBll.AddCatalogList(list, ref errorList));
        }
 /// <summary>
 /// 增加记录
 /// </summary>
 private void AddLog_Click(object sender, EventArgs e)
 {
     try
     {
         List <string> errorList = new List <string>();//创建一个错误列表
         //获取根据当前页面内容生成的订单(若有错误会被添加到错误列表中)
         CreateCatalogList list = GetCatalogList(ref errorList);
         //判断是否添加订单成功
         if (createCatalogBll.AddCatalogList(list, ref errorList))
         {
             MessageBox.Show("添加成功");
         }
         else
         {
             MessageBox.Show("添加失败");
             foreach (var i in errorList)
             {
                 MessageBox.Show(i);//逐条显示错误信息
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataBind();
 }
        /// <summary>
        /// 获取当前窗体所表示的清单
        /// </summary>
        /// <param name="error">错误列表</param>
        /// <returns>编目清单</returns>
        private CreateCatalogList GetCatalogList(ref List <string> error)
        {
            List <string> errorList = new List <string>();//错误列表

            //出版社Id
            int publisherId = ((KeyValuePair <int, string>)PublishingHouseComboBox.SelectedItem).Key;
            //编目人员ID
            int catalogerId = utilBll.GetUserIdFormNumber(CatalogerIdTextBox.Text);


            //根据页面内容构造清单
            CreateCatalogList list = new CreateCatalogList()
            {
                ISBN              = ISBNTextBox.Text,
                FirstAuthor       = AuthorTextBox.Text,
                PositiveTitle     = BookNameTextBox.Text,
                CatalogingDate    = CatalogDateTimePicker.Value,
                PublishingHouseId = publisherId,
                DocumentType      = DocumentTypeComboBox.Text,
                CatalogerId       = catalogerId,
                PrimaryLiability  = PrimaryLiabilityLabelTextBox.Text
            };

            error = errorList; //返回错误列表
            return(list);      //返回清单
        }
 private void btn_addCase_Click(object sender, EventArgs e)
 {
     try
     {
         List <string> errorList = new List <string>();//创建一个错误列表
         //获取根据当前页面内容生成的订单(若有错误会被添加到错误列表中)
         var list = new CreateCatalogList[] { GetCatalogList(ref errorList) };
         if (errorList.Count == 0)
         {
             if (userCaseHandle.AddUserCases(list.ToList()))
             {
                 MessageBox.Show("添加成功");
             }
         }
         else
         {
             MessageBox.Show("添加失败");
             foreach (var i in errorList)
             {
                 MessageBox.Show(i);//逐条显示错误信息
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataBind();
 }
        /// <summary>
        /// 增加一条直接编目记录
        /// </summary>
        /// <param name="list">编目清单</param>
        /// <returns>增加成功与否</returns>
        public bool AddCatalogList(CreateCatalogList list)
        {
            string sqlStr = "INSERT INTO tb_CatalogForm (" +
                            "ISBN," +
                            "PositiveTitle," +
                            "FirstAuthor," +
                            "PublishingHouseId," +
                            "DocumentType," +
                            "PrimaryLiability," +
                            "CatalogerId," +
                            "CatalogingDate" +
                            ")" +
                            "VALUES(" +
                            "@iSBN," +
                            "@positiveTitel," +
                            "@firstAuther," +
                            "@publishingHouseId," +
                            "@documentType," +
                            "@primaryLiability," +
                            "@catalogerId," +
                            "@catalogingDate" +
                            ")";

            //储存Datatable
            MySqlParameter[] para = new MySqlParameter[]//存储相应参数的容器
            {
                new MySqlParameter("@iSBN", list.ISBN),
                new MySqlParameter("@positiveTitel", list.PositiveTitle),
                new MySqlParameter("@firstAuther", list.FirstAuthor),
                new MySqlParameter("@publishingHouseId", list.PublishingHouseId),
                new MySqlParameter("@documentType", list.DocumentType),
                new MySqlParameter("@primaryLiability", list.PrimaryLiability),
                new MySqlParameter("@catalogerId", list.CatalogerId),
                new MySqlParameter("@catalogingDate", list.CatalogingDate),
            };
            int count = helper.ExecuteNonQuery(sqlStr, para, CommandType.Text);

            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 获取当前窗体所表示的清单
        /// </summary>
        /// <param name="error">错误列表</param>
        /// <returns>编目清单</returns>
        private CreateCatalogList GetCatalogList(ref List <string> error)
        {
            List <string> errorList = new List <string>();//错误列表


            //根据页面内容构造清单
            CreateCatalogList list = new CreateCatalogList()
            {
                ISBN              = ISBNTextBox.Text,
                FirstAuthor       = AuthorTextBox.Text,
                PublishingHouseId = int.Parse(publishingHouseTextBox.Text),
                PositiveTitle     = BookNameTextBox.Text,
                CatalogingDate    = CatalogDateTimePicker.Value,
                DocumentType      = DocumentTypeComboBox.Text,
                PrimaryLiability  = PrimaryLiabilityLabelTextBox.Text
            };

            error = errorList; //返回错误列表
            return(list);      //返回清单
        }
Esempio n. 9
0
        /// <summary>
        /// 增加一条编目记录
        /// </summary>
        /// <param name="list">编目列表</param>
        /// <param name="errorMsg">增加成功与否</param>
        /// <returns></returns>

        public bool AddCatalogList(CreateCatalogList list, ref List <string> errorMsg)
        {
            bool result = false;

            try
            {
                if (!CreateCatalogList.isNull(list))                       //是否有空项
                {
                    if (CreateCatalogList.isNormative(list, ref errorMsg)) //是否符合规范
                    {
                        result = createDal.AddCatalogList(list);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw ex;
            }
            return(result);
        }
Esempio n. 10
0
        public IEnumerable GetMoveCatalog()
        {
            List <CreateCatalogList> result = new List <CreateCatalogList>();

            try
            {
                DataTable datatable = createDal.GetAllQueryCatalogForm();
                foreach (DataRow dr in datatable.Rows)
                {
                    CreateCatalogList createCatalogList = new CreateCatalogList()
                    {
                        Id = (int)dr["编号"]
                    };
                    result.Add(createCatalogList);
                }
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 修改一条直接编目记录
        /// </summary>
        /// <param name="list">编目清单</param>
        /// <returns>修改成功与否</returns>
        public bool UpdateCatalogList(CreateCatalogList list)
        {
            string sqlStr = "UPDATE tb_CatalogForm SET " +
                            "ISBN=@iSBN, " +
                            "PositiveTitle=@positiveTitle, " +
                            "FirstAuthor=@firstAuthor, " +
                            "PublishingHouseId=@publishingHouseId, " +
                            "DocumentType=@documentType, " +
                            "PrimaryLiability=@primaryLiability, " +
                            "CatalogerId=@catalogerId, " +
                            "CatalogingDate=@catalogingDate " +
                            "where Id=@id;";

            //储存Datatable
            MySqlParameter[] para = new MySqlParameter[]//存储相应参数的容器
            {
                new MySqlParameter("@iSBN", list.ISBN),
                new MySqlParameter("@documentType", list.DocumentType),
                new MySqlParameter("@positiveTitle", list.PositiveTitle),
                new MySqlParameter("@firstAuthor", list.FirstAuthor),
                new MySqlParameter("@publishingHouseId", list.PublishingHouseId),
                new MySqlParameter("@primaryLiability", list.PrimaryLiability),
                new MySqlParameter("@catalogerId", list.CatalogerId),
                new MySqlParameter("@catalogingDate", list.CatalogingDate),
                new MySqlParameter("@id", list.Id),
            };
            int count = helper.ExecuteNonQuery(sqlStr, para, CommandType.Text);

            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 保存记录
 /// </summary>
 private void SaveLog_Click(object sender, EventArgs e)
 {
     try
     {
         List <string> errorList = new List <string>(); //创建一个错误列表
         //获取根据当前页面内容生成的清单(若有错误会被添加到错误列表中)
         string createId = idTextBox.Text;              //获取清单号
         int    id;
         if (!int.TryParse(createId, out id))           //将其转换为数字失败
         {
             MessageBox.Show("清单号错误");
             return;
         }
         CreateCatalogList list = GetCatalogList(ref errorList);
         list.Id = id;//设置清单号
         //判断是否添加清单成功
         if (createCatalogBll.UpdateCatalogList(list, ref errorList))
         {
             MessageBox.Show("修改成功");
         }
         else
         {
             MessageBox.Show("修改失败");
             foreach (var i in errorList)
             {
                 MessageBox.Show(i);//逐条显示错误信息
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     DataBind();                 //数据绑定
     ChangeControlEnableState(); //改变菜单按钮启用状态
 }
Esempio n. 13
0
        public bool MoveCatalog(int Id)
        {
            string sqlStr = " SELECT " +
                            " tb_CatalogForm.Id AS `编目编号`, " +
                            " tb_CatalogForm.ISBN AS ISBN, " +
                            " tb_CatalogForm.PositiveTitle AS `题目名称`, " +
                            " tb_CatalogForm.FirstAuthor AS `第一作者`, " +
                            " tb_CatalogForm.PublishingHouseId AS `出版社编号`, " +
                            " tb_CatalogForm.DocumentType AS `文献类型`, " +
                            " tb_CatalogForm.State AS `编目状态`  " +
                            " FROM " +
                            " tb_CatalogForm  " +
                            " WHERE " +
                            " tb_CatalogForm.Id = @id " +
                            " AND tb_CatalogForm.State = '未处理';";

            MySqlParameter[] paras = new MySqlParameter[]
            {
                new MySqlParameter("@id", Id),
            };
            DataTable dataTable = helper.ExecuteQuery(sqlStr, paras, CommandType.Text);

            if (dataTable.Rows.Count <= 0)
            {
                return(false);
            }
            DataRow           row = dataTable.Rows[0];
            CreateCatalogList createCatalogList = new CreateCatalogList()
            {
                Id                = int.Parse(row["编目编号"].ToString()),
                ISBN              = row["ISBN"].ToString(),
                PositiveTitle     = row["题目名称"].ToString(),
                FirstAuthor       = row["第一作者"].ToString(),
                PublishingHouseId = int.Parse(row["出版社编号"].ToString()),
                DocumentType      = row["文献类型"].ToString(),
            };

            sqlStr = "UPDATE tb_CatalogForm SET tb_CatalogForm.State='已处理' where tb_CatalogForm.state='未处理' and tb_CatalogForm.Id=@id";
            paras  = new MySqlParameter[]
            {
                new MySqlParameter("@id", createCatalogList.Id),
            };
            int count = helper.ExecuteNonQuery(sqlStr, paras, CommandType.Text);

            sqlStr = "INSERT INTO tb_CirculateBooks (" +
                     " tb_CirculateBooks.ISBN," +
                     " tb_CirculateBooks.FirstAuthor," +
                     " tb_CirculateBooks.DocumentType, " +
                     "tb_CirculateBooks.BookStatus, " +
                     "tb_CirculateBooks.OfficialTitle, " +
                     "tb_CirculateBooks.PublishingHouseId" +
                     " )VALUES" +
                     "(" +
                     "@iSBN," +
                     "@firstAuther," +
                     "@documentType," +
                     "@bookStatus," +
                     "@officialTitle," +
                     "@publishingHouseId" +
                     ")";
            paras = new MySqlParameter[]
            {
                new MySqlParameter("@iSBN", createCatalogList.ISBN),
                new MySqlParameter("@firstAuther", createCatalogList.FirstAuthor),
                new MySqlParameter("@documentType", createCatalogList.DocumentType),
                new MySqlParameter("@bookStatus", "可借阅"),
                new MySqlParameter("@officialTitle", createCatalogList.PositiveTitle),
                new MySqlParameter("@publishingHouseId", createCatalogList.PublishingHouseId),
            };
            count = helper.ExecuteNonQuery(sqlStr, paras, CommandType.Text);
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }