Ejemplo n.º 1
0
        //对获取的综合文本列表进行排序的方式
        private static int CompareKRVCATEGORY(KRV_CATEGORY x, KRV_CATEGORY y)
        {
            string comparecode_x = convertCode(x.CONTENT_CODE);//字符串排序方式,需要去掉content_code中间年份项,以按条目顺序排序。
            string comparecode_y = convertCode(y.CONTENT_CODE);

            return(string.Compare(comparecode_x, comparecode_y));
        }
Ejemplo n.º 2
0
        public void showContent(int category_id)
        {
            string text   = krDAO.getXML_CATEGORY_TEXT(category_id, "en");
            string toDel1 = "<IMG alt=\"\" src=\"http://krcon.krs.co.kr/images/icon/link.gif\">";
            string toDel2 = "<IMG alt=\"\" src=\"/images/icon/link.gif\">";
            string toDel3 = "<IMG style=\"BORDER-TOP: 0px solid; BORDER-RIGHT: 0px solid; BORDER-BOTTOM: 0px solid; BORDER-LEFT: 0px solid\" alt=Go! src=\"/images/icon/link.gif?fullpathlink=content\">";

            text = text.Replace(toDel1, "").Replace(toDel2, "").Replace(toDel3, "");
            this.wbContent.DocumentText = text;
            string       sql_info     = string.Format("Select * from krv_category where category_id={0} and locale_key='en'", category_id);
            KRV_CATEGORY krv_category = new KRV_CATEGORY(krDAO.doSelect(sql_info).Rows[0]);

            if (krv_category.IS_HEADER == false)
            {
                this.tbScope.Visible    = false;
                this.wbContent.Location = new Point(this.wbContent.Location.X, this.tbScope.Location.Y);
                wbContent.Height        = this.treeView1.Height;
            }
            else
            {
                this.tbScope.Visible    = true;
                this.wbContent.Location = wbContentLocation;
                this.wbContent.Height   = wbContentHeight;
            }
            this.tbScope.Text = makeScope.getScope(krv_category);
        }
Ejemplo n.º 3
0
        static public string shipScope(KRV_CATEGORY krv_category)
        {
            List <string> shipTypes = new List <string>();

            if (krv_category.SHIP_All == true)
            {
                shipTypes.Add("All Ships");
            }
            if (krv_category.SHIP_ALL_CARGO == true)
            {
                shipTypes.Add("All Cargo Ships");
            }
            if (krv_category.SHIP_OIL_TANKERS == true)
            {
                shipTypes.Add("Oil Tankers");
            }
            if (krv_category.SHIP_OILCHEMICAL_TANKERS == true)
            {
                shipTypes.Add("Oil / Chemical Tankers");
            }
            if (krv_category.SHIP_CHEMICAL_TANKERS == true)
            {
                shipTypes.Add("Chemical Tankers");
            }
            if (krv_category.SHIP_GAS_CARRIERS == true)
            {
                shipTypes.Add("Gas Carriers");
            }
            if (krv_category.SHIP_BULK_CARRIERS == true)
            {
                shipTypes.Add("Bulk Carriers");
            }
            if (krv_category.SHIP_OTHER_CARGO == true)
            {
                shipTypes.Add("Other Cargo Ship(Container, General Cargo, PCC...)");
            }
            if (krv_category.SHIP_ALL_PASSENGER == true)
            {
                shipTypes.Add("All Passenger Ships");
            }
            if (krv_category.SHIP_RORO_PASSENGER == true)
            {
                shipTypes.Add("Ro-Ro Passenger Ships");
            }
            if (krv_category.SHIP_PASSENGER == true)
            {
                shipTypes.Add("Passenger Ships");
            }
            if (krv_category.SHIP_HIGH_SPEED_CRAFT == true)
            {
                shipTypes.Add("High Speed Craft");
            }
            if (krv_category.SHIP_MODU == true)
            {
                shipTypes.Add("MODU");
            }
            return(string.Format("{0}", string.Join("、", shipTypes)));
        }
Ejemplo n.º 4
0
        public List <KRV_CATEGORY> tableToList(DataTable tbl)
        {
            List <KRV_CATEGORY> list = new List <KRV_CATEGORY>();

            foreach (DataRow row in tbl.Rows)
            {
                KRV_CATEGORY krv_category = new KRV_CATEGORY(row);
                list.Add(krv_category);
            }
            return(list);
        }
Ejemplo n.º 5
0
        public Tree <KRV_CATEGORY> getLinkNodeTree(KRV_CATEGORY krv_category)
        {
            string sql = string.Format("select * from krv_category where category_id={0} and locale_key='en'", krv_category.LINK_CATEGORY);
            List <KRV_CATEGORY> list = tableToList(krDAO.doSelect(sql));
            Tree <KRV_CATEGORY> node = new Tree <KRV_CATEGORY>();

            if (list.Count == 1)
            {
                node.Data = list[0];
            }
            return(node);
        }
Ejemplo n.º 6
0
        public KRV_CATEGORY get_KRV_CATEGORY_byID(int categoryID, string language = "en")
        {
            DataTable         dt       = new DataTable();
            KRV_CATEGORY      category = null;
            DataRow           row      = null;
            string            sql      = string.Format("select * from KRV_CATEGORY where CATEGORY_ID={0} and locale_key='{1}'", categoryID, language);
            SQLiteCommand     cmd      = new SQLiteCommand(sql, cnn);
            SQLiteDataAdapter adapter  = new SQLiteDataAdapter(sql, cnn);

            adapter.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                row      = dt.Rows[0];
                category = new KRV_CATEGORY(row);
            }
            return(category);
        }
Ejemplo n.º 7
0
        public Tree <KRV_CATEGORY> getNormalTree(KRV_CATEGORY krv_category)
        {
            string sql = string.Format("select * from krv_category where parent_category_id={0} and locale_key='en' order by category_order"
                                       , krv_category.CATEGORY_ID);
            List <KRV_CATEGORY> list = tableToList(krDAO.doSelect(sql));
            Tree <KRV_CATEGORY> root = new Tree <KRV_CATEGORY>();

            root.Data = krv_category;
            foreach (var item in list)
            {
                Tree <KRV_CATEGORY> node = new Tree <KRV_CATEGORY> {
                    Data = item
                };
                root.AddNode(node);
            }
            return(root);
        }
Ejemplo n.º 8
0
        public KRV_CATEGORY get_KRV_CATEGORY_byID(int categoryID, string language)
        {
            DataTable      dt       = new DataTable();
            KRV_CATEGORY   category = null;
            DataRow        row      = null;
            string         sql      = "select * from KRV_CATEGORY where CATEGORY_ID=" + categoryID + " and LOCALE_KEY='" + language + "'";
            SqlCommand     cmd      = new SqlCommand(sql, connect);
            SqlDataAdapter adapter  = new SqlDataAdapter(sql, connect);

            adapter.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                row      = dt.Rows[0];
                category = new KRV_CATEGORY(row);
            }
            return(category);
        }
Ejemplo n.º 9
0
        public Tree <KRV_CATEGORY> getChapterYearTree(KRV_CATEGORY krv_category)
        {
            string sql = string.Format("select * from krv_category where content_code like '{0}' and locale_key='en' order by content_code",
                                       krv_category.CHAPTER_YEAR_ROOT);
            List <KRV_CATEGORY> list = tableToList(krDAO.doSelect(sql));
            Tree <KRV_CATEGORY> tree = new Tree <KRV_CATEGORY> {
                Data = krv_category
            };

            foreach (var item in list)
            {
                item.CATEGORY_HEADER = item.CONTENT_HEADER;
                Tree <KRV_CATEGORY> node = new Tree <KRV_CATEGORY> {
                    Data = item
                };
                tree.AddNode(node);
            }
            return(tree);
        }
Ejemplo n.º 10
0
        //例如综合文本的II-2章的content_code=e.s.co.a01.022, 得到以该目录为根节点的树结构
        public Tree <KRV_CATEGORY> getIntegratedTree(KRV_CATEGORY krv_category)
        {
            string content_code      = krv_category.CONTENT_CODE;
            string queryCode         = krv_category.INTEGRATION_ROOT;// convertCode(content_code);//转化为e.s.__.a01.022形式
            string sql               = string.Format("select * from krv_category where content_code like '{0}.%' and locale_key='en' and IS_DYNAMIC_TREE=1  and DATE_BUILD_H is null", queryCode);
            List <KRV_CATEGORY> list = tableToList(krDAO.doSelect(sql));

            list.Sort(new Comparison <KRV_CATEGORY>(CompareKRVCATEGORY));                                                             //对获取的综合文本列表进行排序
            list = clearList(list);                                                                                                   //若某目录下有多个年份的子条目,则该目录也会有多年份的重复,需要清除掉重复的目录条目,保留最新的年份的目录记录。
            string    sql1 = string.Format("select * from krv_category where content_code ='{0}' and locale_key='en'", content_code); //添加父节点到列表的首位
            DataTable tbl1 = krDAO.doSelect(sql1);

            if (tbl1.Rows.Count == 1)
            {
                list.Insert(0, new KRV_CATEGORY(tbl1.Rows[0]));
            }
            getTitle(ref list);
            Tree <KRV_CATEGORY> tree = listToTree(list);//将排好序的列表,转化为树结构

            return(tree);
        }
Ejemplo n.º 11
0
        public void getTree(Tree <KRV_CATEGORY> root)
        {
            if (root == null)
            {
                return;
            }
            Tree <KRV_CATEGORY> tree         = new Tree <KRV_CATEGORY>();
            Tree <KRV_CATEGORY> root_parent  = root.Parent;
            KRV_CATEGORY        krv_category = root.Data;

            switch (krv_category.NODE_TYPE)
            {
            case 0:
                tree = getNormalTree(krv_category);
                break;

            case 1:
                tree = getLinkNodeTree(krv_category);
                getTree(tree);
                break;

            case 2:
                tree = getIntegratedTree(krv_category);
                break;

            case 3:
                tree = getChapterYearTree(krv_category);
                break;
            }
            root.Data = tree.Data;
            foreach (var node in tree.Nodes)
            {
                root.AddNode(node);
                if (krv_category.NODE_TYPE != 2)
                {
                    getTree(node);
                }
            }
        }
Ejemplo n.º 12
0
        static public string getScope(KRV_CATEGORY krv_category)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();
            StringBuilder sb        = new StringBuilder();
            string        builddate = DateToText(krv_category.DATE_BUILD_L, krv_category.DATE_BUILD_H);
            string        effDate   = DateToText(krv_category.DATE_EFFECTIVE);
            string        expDate   = DateToText(krv_category.DATE_EXP);

            if (!string.IsNullOrEmpty(effDate))
            {
                sb.Append(string.Format("生效日期:{0}\r\n", effDate));
            }
            if (!string.IsNullOrEmpty(expDate))
            {
                sb.Append(string.Format("失效日期:{0}\r\n", expDate));
            }
            if (builddate != string.Empty)
            {
                sb.Append(string.Format("安放龙骨日期:{0}\r\n", builddate));
            }
            string shipLength  = intToText(krv_category.LF_L, krv_category.LF_H);
            string shipLength1 = intToText(krv_category.LF_L_1, krv_category.LF_H_1);

            if (!string.IsNullOrEmpty(shipLength))
            {
                if (string.IsNullOrEmpty(shipLength1))
                {
                    sb.Append(string.Format("船长:{0}\r\n", shipLength));
                }
                else
                {
                    sb.Append(string.Format("船长:{0}或{1}\r\n", shipLength, shipLength1));
                }
            }
            string grossTon  = intToText(krv_category.GT_L, krv_category.GT_H);
            string grossTon1 = intToText(krv_category.GT_L_1, krv_category.GT_H_1);

            if (!string.IsNullOrEmpty(grossTon))
            {
                if (string.IsNullOrEmpty(grossTon1))
                {
                    sb.Append(string.Format("总吨:{0}\r\n", grossTon));
                }
                else
                {
                    sb.Append(string.Format("总吨:{0}或{1}\r\n", grossTon, grossTon1));
                }
            }
            string passNum  = intToText(krv_category.PASS_TOTAL_L, krv_category.PASS_TOTAL_H);
            string passNum1 = intToText(krv_category.PASS_TOTAL_L_1, krv_category.PASS_TOTAL_H_1);

            if (!string.IsNullOrEmpty(passNum))
            {
                if (string.IsNullOrEmpty(passNum1))
                {
                    sb.Append(string.Format("乘客数:{0}\r\n", passNum));
                }
                else
                {
                    sb.Append(string.Format("乘客数:{0}或{1}\r\n", passNum, passNum1));
                }
            }

            if (!string.IsNullOrEmpty(krv_category.NOTE))
            {
                sb.Append(string.Format("Note:{0}\r\n", krv_category.NOTE));
            }
            if (krv_category.IS_BACKTO == true)
            {
                sb.Append("回溯:此条款具有回溯效力,对所有现有船舶有效\r\n");
            }
            string contractdate = DateToText(krv_category.CONTRACT_DATE_L, krv_category.CONTRACT_DATE_H);
            string deliverydate = DateToText(krv_category.DELIVERY_DATE_L, krv_category.DELIVERY_DATE_H);

            if (contractdate != string.Empty)
            {
                sb.Append(string.Format("签订造船合同日期:{0}\r\n", contractdate));
            }
            if (deliverydate != string.Empty)
            {
                sb.Append(string.Format("交船日期:{0}\r\n", deliverydate));
            }
            string shipscope = shipScope(krv_category);

            if (!string.IsNullOrEmpty(shipscope))
            {
                sb.Append(string.Format("适用船舶:{0}", shipscope));
            }
            return(sb.ToString());
        }