Exemplo n.º 1
0
        private object QryTabContent(string topic)
        {
            var tc = new TabContent();

            var tbl = appConfig.s_config.GetTable(TableIdx.Document);
            var sb  = new SearchBuilder(tbl, m_cp);

            sb.Clear();
            sb.Add(DocumentTblInfo.ColIdx.topic.ToField(), topic);
            sb.Search();
            tc.docCols = new List <string> {
                DocumentTblInfo.ColIdx.title.ToAlias(),
                    DocumentTblInfo.ColIdx.topic.ToAlias(),
                    DocumentTblInfo.ColIdx.link.ToAlias(),
                    DocumentTblInfo.ColIdx.note.ToAlias(),
            };
            tc.recs = new List <DocRec>();
            foreach (DataRow row in sb.dc.m_dataTable.Rows)
            {
                var rec = new DocRec();
                rec.title = row[DocumentTblInfo.ColIdx.title.ToField()].ToString();
                rec.topic = row[DocumentTblInfo.ColIdx.topic.ToField()].ToString();
                rec.link  = row[DocumentTblInfo.ColIdx.link.ToField()].ToString();
                rec.note  = row[DocumentTblInfo.ColIdx.note.ToField()].ToString();
                tc.recs.Add(rec);
            }
            return(tc);
        }
Exemplo n.º 2
0
        private void FreeResByTask(string taskId)
        {
            //get all order
            var orderSB = new SearchBuilder(appConfig.s_config.GetTable(TableIdx.Order));

            orderSB.Clear();
            orderSB.Add(OrderTblInfo.ColIdx.Task.ToField(), taskId);
            orderSB.Search();

            var cnn = appConfig.s_contentProvider.GetCnn();
            int ret;

            foreach (DataRow row in orderSB.dc.m_dataTable.Rows)
            {
                var orderType = int.Parse(row[OrderTblInfo.ColIdx.Type.ToField()].ToString());
                FreeResByOrder(cnn, taskId, (OrderType)orderType);
            }

            //delete order
            var delOrderQry = string.Format("delete from {0} where {1}=@task_number",
                                            TableIdx.Order.ToDesc(), TaskTblInfo.ColIdx.Task.ToField());
            var delOrderCmd = new SQLiteCommand(delOrderQry, (SQLiteConnection)cnn);

            delOrderCmd.Parameters.Add(new SQLiteParameter("@task_number", taskId));
            ret = delOrderCmd.ExecuteNonQuery();
            Debug.WriteLine(string.Format("remove {0} orders", ret));
        }
Exemplo n.º 3
0
        protected virtual void SearchRes()
        {
            int n = m_srchBld.exprs.Count;

            for (int i = 0; i < m_srchCtrls.Count; i++)
            {
                m_srchCtrls[i].UpdateSearchParams(m_srchBld.exprs, m_srchBld.srchParams);
            }
            m_addedSrchCnd = m_srchBld.exprs.Count - n;
            m_srchBld.Search();

            for (int i = m_srchBld.exprs.Count - 1; i >= n; i--)
            {
                m_srchBld.exprs.RemoveAt(i);
                m_srchBld.srchParams.RemoveAt(i);
            }
        }
Exemplo n.º 4
0
        private object QryTabContent(string grpId)
        {
            var tc   = new TabContent();
            var bgtb = appConfig.s_config.GetTable(TableIdx.Budgrp);
            var bgsb = new SearchBuilder(bgtb, m_cp);

            bgsb.Clear();
            bgsb.Add(BudgrpTblInfo.ColIdx.grp.ToField(), grpId);
            bgsb.Search();
            var bgrec = new BudgrpRec();

            for (int i = 0; i < bgsb.dc.m_dataTable.Rows.Count; i++)
            {
                var row = bgsb.dc.m_dataTable.Rows[i];
                bgrec.name  = row[BudgrpTblInfo.ColIdx.name.ToField()].ToString();
                bgrec.about = row[BudgrpTblInfo.ColIdx.about.ToField()].ToString();
                break;
            }
            tc.budgrpRec = bgrec;

            var trntb = appConfig.s_config.GetTable(TableIdx.Training);
            var trnsb = new SearchBuilder(trntb, m_cp);

            trnsb.Clear();
            trnsb.Add(TrainingTblInfo.ColIdx.bgrp.ToField(), grpId);
            trnsb.Search();
            tc.trngCols = new List <string> {
                TrainingTblInfo.ColIdx.date.ToAlias(),
                    TrainingTblInfo.ColIdx.topic.ToAlias(),
                    TrainingTblInfo.ColIdx.trnr.ToAlias(),
                    TrainingTblInfo.ColIdx.cmnt.ToAlias(),
                    TrainingTblInfo.ColIdx.star.ToAlias(),
            };
            tc.recs = new List <TrngRec>();
            foreach (DataRow row in trnsb.dc.m_dataTable.Rows)
            {
                var      trnrec   = new TrngRec();
                DateTime dateTime = (DateTime)row[TrainingTblInfo.ColIdx.date.ToField()];
                trnrec.date  = dateTime.ToString(lConfigMng.GetDisplayDateFormat());
                trnrec.topic = row[TrainingTblInfo.ColIdx.topic.ToField()].ToString();
                TrainingTblInfo.Trainer trainer = (TrainingTblInfo.Trainer) int.Parse(row[TrainingTblInfo.ColIdx.trnr.ToField()].ToString());
                trnrec.trainer = trainer.ToDesc();
                trnrec.cmnt    = row[TrainingTblInfo.ColIdx.cmnt.ToField()].ToString();
                TrainingTblInfo.Star star = (TrainingTblInfo.Star) int.Parse(row[TrainingTblInfo.ColIdx.star.ToField()].ToString());
                trnrec.star = star.ToDesc();
                tc.recs.Add(trnrec);
            }
            return(tc);
        }
Exemplo n.º 5
0
        protected void UpdateOrderResDGV(string orderIdCol, string resIdCol)
        {
            var tblInfo = appConfig.s_config.GetTable(m_tbl);

            orderResSB.Clear();
            orderResSB.Add(orderIdCol, m_curOrder);
            orderResSB.Search();
            orderResDGV.DataSource = orderResSB.dc.m_bindingSource;

            //build dict
            m_usedResDict.Clear();
            var rows = orderResSB.dc.m_dataTable.Rows;
            int i;

            for (i = 0; i < rows.Count; i++)
            {
                var key = rows[i][resIdCol].ToString();
                m_usedResDict.Add(key, -1); //not yet set res row index
            }
        }
Exemplo n.º 6
0
        private object QryTabContent(List <string> lst)
        {
            var tc   = new TabContent();
            var bgtb = appConfig.s_config.GetTable(TableIdx.Lecture);
            var bgsb = new SearchBuilder(bgtb, m_cp);

            bgsb.Clear();
            bgsb.Add(LectureTblInfo.ColIdx.lect.ToField(), lst);
            bgsb.Search();
            tc.recs = new List <LectRec>();
            for (int i = 0; i < bgsb.dc.m_dataTable.Rows.Count; i++)
            {
                var rec = new LectRec();
                var row = bgsb.dc.m_dataTable.Rows[i];
                rec.lect  = row[LectureTblInfo.ColIdx.lect.ToField()].ToString();
                rec.title = row[LectureTblInfo.ColIdx.title.ToField()].ToString();
                var auth = (LectureTblInfo.Author) int.Parse(row[LectureTblInfo.ColIdx.auth.ToField()].ToString());
                rec.auth = auth.ToDesc();
                var target = (LectureTblInfo.Target) int.Parse(row[LectureTblInfo.ColIdx.target.ToField()].ToString());
                rec.target = target.ToDesc();
                rec.topic  = row[LectureTblInfo.ColIdx.topic.ToField()].ToString();
                var date = (DateTime)row[LectureTblInfo.ColIdx.crt.ToField()];
                rec.crt     = date.ToString(lConfigMng.GetDisplayDateFormat());
                rec.content = row[LectureTblInfo.ColIdx.content.ToField()].ToString();
                rec.link    = row[LectureTblInfo.ColIdx.link.ToField()].ToString();
                tc.recs.Add(rec);
            }

            tc.cols = new List <string> {
                LectureTblInfo.ColIdx.title.ToAlias(),
                    LectureTblInfo.ColIdx.auth.ToAlias(),
                    LectureTblInfo.ColIdx.target.ToAlias(),
                    LectureTblInfo.ColIdx.topic.ToAlias(),
                    LectureTblInfo.ColIdx.crt.ToAlias(),
                    LectureTblInfo.ColIdx.content.ToAlias(),
                    LectureTblInfo.ColIdx.link.ToAlias(),
            };
            return(tc);
        }