Exemple #1
0
 public int InsertCardInfo(CardInfo card)
 {
     using (CardInfoDA cardInfoDA = new CardInfoDA())
     {
         return(cardInfoDA.InsertCardInfo(card));
     }
 }
Exemple #2
0
 public void DeleteCardInfo(bool isForStudent, string id)
 {
     using (CardInfoDA cardInfoDA = new CardInfoDA())
     {
         cardInfoDA.DeleteCardInfo(isForStudent, id);
     }
 }
Exemple #3
0
        public void WriteCardInfoExcel(string savePath)
        {
            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                new CardInfoRule().WriteCardInfoExcel(cardInfoDA.GetExportCard(), savePath);
//				new CardInfoRule().WriteCardInfoExcel(cardInfoDA.GetAllCardInfo(),savePath);
            }
        }
Exemple #4
0
        //退学
        public int StuLeaveSchool(string id)
        {
            int rowAffected = 0;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                rowAffected = cardInfoDA.StuLeaveSchool(id);
            }

            return(rowAffected);
        }
Exemple #5
0
        public int UpdateTeaCardState(string cardNumber)
        {
            int rowAffected = 0;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                rowAffected = cardInfoDA.UpdateTeaCardState(cardNumber);
            }

            return(rowAffected);
        }
Exemple #6
0
        public int DeleteTeaCardInfo(string cardNumber)
        {
            int rowAffected = 0;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                rowAffected = cardInfoDA.DeleteTeaCardInfo(cardNumber);
            }

            return(rowAffected);
        }
Exemple #7
0
        public int InsertTeaCardInfo(CardInfo card)
        {
            int rowAffected = 0;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                rowAffected = cardInfoDA.InsertTeaCardInfo(card);
            }

            return(rowAffected);
        }
Exemple #8
0
        public DataSet GetTeaCardByID(string teaID)
        {
            DataSet CardInfoList = null;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                CardInfoList = cardInfoDA.GetTeaCardByID(teaID);
            }

            return(CardInfoList);
        }
Exemple #9
0
        public DataSet GetTeaBatchCardInfo()
        {
            DataSet batchCardInfoList = null;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                batchCardInfoList = cardInfoDA.GetTeaBatchCardInfo();
            }

            return(batchCardInfoList);
        }
Exemple #10
0
        public DataSet GetNoCardTeachers()
        {
            DataSet noCardTeachers = null;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                noCardTeachers = cardInfoDA.GetNoCardTeachers();
            }

            return(noCardTeachers);
        }
Exemple #11
0
        public DataSet GetNoCardStudents()
        {
            DataSet noCardStudents = null;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                noCardStudents = cardInfoDA.GetNoCardStudents();
            }

            return(noCardStudents);
        }
Exemple #12
0
        public DataSet GetTeaCardInfoList()
        {
            DataSet CardInfoList = null;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                CardInfoList = cardInfoDA.GetTeaCardInfoList();
            }

            return(CardInfoList);
        }
Exemple #13
0
        public int GetCardCount(string cardNumber)
        {
            int rowAffected = 0;

            using (CardInfoDA cardInfoDA = new CardInfoDA())
            {
                rowAffected = cardInfoDA.GetCardCount(cardNumber);
            }

            return(rowAffected);
        }
Exemple #14
0
        public void ImportCardExcelFile(string id, string name, string grade,
                                        string atClass, bool isStu, string savePath)
        {
            if (grade.Equals("全部"))
            {
                grade = string.Empty;
            }

            if (atClass.Equals("全部"))
            {
                atClass = string.Empty;
            }

            DataSet cardInfo;

            object[,] objData;

            string excelTempFilePath = AppDomain.CurrentDomain.BaseDirectory;

            Excel.Application         m_objExcel  = null;
            Excel.Workbooks           m_objBooks  = null;
            Excel._Workbook           m_objBook   = null;
            Excel.Sheets              m_objSheets = null;
            Excel._Worksheet          m_objSheet  = null;
            Excel.Range               m_objRange  = null;
            Excel.Font                m_objFont   = null;
            System.Reflection.Missing m_objOpt    = System.Reflection.Missing.Value;

            try
            {
                if (isStu)
                {
                    using (CardInfoDA cardInfoDA = new CardInfoDA())
                    {
                        cardInfo = cardInfoDA.GetStuCardNumberForExcel(id, name, grade, atClass);
                    }

                    if (cardInfo.Tables[0].Rows.Count > 0)
                    {
                        objData = new Object[cardInfo.Tables[0].Rows.Count, 7];

                        for (int i = 0; i < cardInfo.Tables[0].Rows.Count; i++)
                        {
                            objData[i, 0] = cardInfo.Tables[0].Rows[i][0].ToString();
                            objData[i, 1] = cardInfo.Tables[0].Rows[i][1].ToString();
                            objData[i, 2] = cardInfo.Tables[0].Rows[i][2].ToString();
                            objData[i, 3] = cardInfo.Tables[0].Rows[i][3].ToString();
                            objData[i, 4] = cardInfo.Tables[0].Rows[i][4].ToString();
                            objData[i, 5] = cardInfo.Tables[0].Rows[i][5].ToString();
                            objData[i, 6] = cardInfo.Tables[0].Rows[i][6].ToString();
                        }

                        m_objExcel = new Excel.Application();
                        m_objBooks = (Excel.Workbooks)m_objExcel.Workbooks;
                        m_objBook  = (Excel._Workbook)m_objBooks.Open(excelTempFilePath + @"report\StudentCardInfo.xls",
                                                                      m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt,
                                                                      m_objOpt, m_objOpt, m_objOpt);

                        m_objSheets = (Excel.Sheets)m_objBook.Sheets;
                        m_objSheet  = (Excel._Worksheet)(m_objSheets.get_Item(1));
                        m_objRange  = m_objSheet.get_Range("A3", m_objOpt);
                        m_objRange  = m_objRange.get_Resize(cardInfo.Tables[0].Rows.Count, 7);

                        m_objRange.Value = objData;

                        m_objRange.VerticalAlignment   = Excel.XlVAlign.xlVAlignCenter;
                        m_objRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                        m_objRange.WrapText            = true;
                        m_objRange.Borders.LineStyle   = System.Windows.Forms.BorderStyle.FixedSingle;
                        m_objFont      = m_objRange.Font;
                        m_objFont.Size = 9;

                        m_objBook.SaveAs(savePath, m_objOpt, m_objOpt,
                                         m_objOpt, m_objOpt, m_objOpt, Excel.XlSaveAsAccessMode.xlNoChange,
                                         m_objOpt, m_objOpt, m_objOpt, m_objOpt);
                        m_objBook.Close(false, m_objOpt, m_objOpt);
                        m_objExcel.Quit();

                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objFont);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objRange);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheet);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheets);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBook);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBooks);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objExcel);
                    }
                }
                else
                {
                    using (CardInfoDA cardInfoDA = new CardInfoDA())
                    {
                        cardInfo = cardInfoDA.GetTeaCardNumberForExcel(id, name, grade, atClass);
                    }

                    if (cardInfo.Tables[0].Rows.Count > 0)
                    {
                        objData = new Object[cardInfo.Tables[0].Rows.Count, 6];

                        for (int i = 0; i < cardInfo.Tables[0].Rows.Count; i++)
                        {
                            objData[i, 0] = cardInfo.Tables[0].Rows[i][0].ToString();
                            objData[i, 1] = cardInfo.Tables[0].Rows[i][1].ToString();
                            objData[i, 2] = cardInfo.Tables[0].Rows[i][2].ToString();
                            objData[i, 3] = cardInfo.Tables[0].Rows[i][3].ToString();
                            objData[i, 4] = cardInfo.Tables[0].Rows[i][4].ToString();
                            objData[i, 5] = cardInfo.Tables[0].Rows[i][5].ToString();
                        }

                        m_objExcel = new Excel.Application();
                        m_objBooks = (Excel.Workbooks)m_objExcel.Workbooks;
                        m_objBook  = (Excel._Workbook)m_objBooks.Open(excelTempFilePath + @"report\TeacherCardInfo.xls",
                                                                      m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt, m_objOpt,
                                                                      m_objOpt, m_objOpt, m_objOpt);

                        m_objSheets = (Excel.Sheets)m_objBook.Sheets;
                        m_objSheet  = (Excel._Worksheet)(m_objSheets.get_Item(1));
                        m_objRange  = m_objSheet.get_Range("A3", m_objOpt);
                        m_objRange  = m_objRange.get_Resize(cardInfo.Tables[0].Rows.Count, 6);

                        m_objRange.Value = objData;

                        m_objRange.VerticalAlignment   = Excel.XlVAlign.xlVAlignCenter;
                        m_objRange.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                        m_objRange.WrapText            = true;
                        m_objRange.Borders.LineStyle   = System.Windows.Forms.BorderStyle.FixedSingle;
                        m_objFont      = m_objRange.Font;
                        m_objFont.Size = 9;

                        m_objBook.SaveAs(savePath, m_objOpt, m_objOpt,
                                         m_objOpt, m_objOpt, m_objOpt, Excel.XlSaveAsAccessMode.xlNoChange,
                                         m_objOpt, m_objOpt, m_objOpt, m_objOpt);
                        m_objBook.Close(false, m_objOpt, m_objOpt);
                        m_objExcel.Quit();

                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objFont);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objRange);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheet);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objSheets);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBook);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objBooks);
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objExcel);
                    }
                }
            }
            catch (Exception ex)
            {
                Util.WriteLog(ex.Message, Util.EXCEPTION_LOG_TITLE);
            }
            finally
            {
                m_objFont   = null;
                m_objRange  = null;
                m_objSheet  = null;
                m_objSheets = null;
                m_objBook   = null;
                m_objBooks  = null;
                m_objExcel  = null;

                GC.Collect();
            }
        }