示例#1
0
        //
        private List <Model.luceneconfig> GetDicValues()
        {
            List <Model.luceneconfig> list = new List <Model.luceneconfig>();

            BLL.channel bll = new BLL.channel();
            DataTable   dt  = bll.GetList(0, "", "sort_id asc,id desc").Tables[0];

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    HiddenField hidControl  = FindControl("control_hide_" + dr["id"].ToString()) as HiddenField;
                    CheckBox    cbControl   = FindControl("control_checkbox_" + dr["id"].ToString()) as CheckBox;
                    TextBox     txtLastId   = FindControl("control_lastid_" + dr["id"].ToString()) as TextBox;
                    TextBox     txtLastTime = FindControl("control_lasttime_" + dr["id"].ToString()) as TextBox;
                    //添加
                    Model.luceneconfig model = new Model.luceneconfig();
                    model.id     = Utils.StrToInt(txtLastId.Text.Trim(), 0);
                    model.name   = hidControl.Value;
                    model.status = cbControl.Checked == true ? 1 : 0;
                    string time = txtLastTime.Text.Trim();
                    if (null != time && time.Length > 0)
                    {
                        DateTime t;
                        if (DateTime.TryParse(time, out t))
                        {
                            model.update = t;
                        }
                    }
                    list.Add(model);
                }
            }
            return(list);
        }
示例#2
0
        /// <summary>
        /// 获取配置文件
        /// </summary>
        /// <returns></returns>
        public List <Model.luceneconfig> Load()
        {
            List <Model.luceneconfig> list = new List <Model.luceneconfig>();
            XmlNode     root   = doc.SelectSingleNode("Lucene");
            XmlNodeList xnList = root.ChildNodes;

            if (xnList.Count > 0)
            {
                for (int i = 0; i < xnList.Count; i++)
                {
                    XmlElement         xe    = (XmlElement)xnList.Item(i);
                    Model.luceneconfig model = new Model.luceneconfig();
                    model.name   = xe.Name;
                    model.id     = Utils.StrToInt(xe.SelectSingleNode("lastid").InnerText, 0);
                    model.status = Utils.StrToInt(xe.SelectSingleNode("status").InnerText, 0);
                    string time = xe.SelectSingleNode("lasttime").InnerText;
                    if (null != time)
                    {
                        DateTime t;
                        if (DateTime.TryParse(time, out t))
                        {
                            model.update = t;
                        }
                    }
                    list.Add(model);
                }
            }
            return(list);
        }