Exemple #1
0
        //分页数据初始化
        protected override void StartLoad(int PageIndex, string strWhere)
        {
            Jf  bll = new Jf();
            int recordCount, pageCount;

            sb.Append(" ");
            string name = Request.Form["name"];
            string pt   = Request.Form["pt"];
            string jf   = Request.Form["jf"];

            if (!string.IsNullOrEmpty(name))
            {
                sb.AppendFormat(" and name='{0}'", name);
            }
            if (!string.IsNullOrEmpty(pt))
            {
                sb.AppendFormat(" and pt='{0}'", pt);
            }
            if (!string.IsNullOrEmpty(jf))
            {
                sb.AppendFormat(" and jf={0}", Convert.ToInt32(jf));
            }

            AspNetPager1.PageSize = 10;

            var DT = bll.GetListByPage("jf", "*", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, " ID ASC", sb.ToString(), out recordCount, out pageCount);


            AspNetPager1.RecordCount = recordCount;
            testList = new List <Jf_Model>();
            if (DT != null && DT.Rows.Count > 0)
            {
                foreach (DataRow item in DT.Rows)
                {
                    testList.Add(new Jf_Model
                    {
                        id   = Convert.ToInt32(item["id"]),
                        img  = Convert.ToString(item["img"]),
                        jf   = Convert.ToInt32(item["jf"]),
                        name = Convert.ToString(item["name"]),
                        pt   = Convert.ToString(item["pt"])
                    });
                }
            }
        }
Exemple #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SOSOshop.BLL.PromptInfo.Popedom("006006000");
         //testList = new SOSOshop.BLL.JF.Jf().list();
         StartLoad(1, null);
         //Literal1.Text =Convert.ToString(bll.GetList("Jf", "*", PageSize,PageIndex, true,"id",true, null,sb.ToString(), out recordCount, out pageCount));
     }
     if (ChangeHope.WebPage.PageRequest.GetFormString("operate") != string.Empty && ChangeHope.WebPage.PageRequest.GetFormInt("id") > 0)
     {
         string types = Request.Form["operate"].Trim();
         int    id    = ChangeHope.WebPage.PageRequest.GetFormInt("id");
         if (types == "del")
         {
             Jf bll = new Jf();
             bll.Delete(id);
         }
         Response.End();
         return;
     }
 }
Exemple #3
0
        // ОПС для всей программы
        public List <RPN_elem> Parse(List <Lexeme> lexemes)
        {
            rpn = new List <RPN_elem>();

            Stack <int>         label_stack      = new Stack <int>();
            Stack <State>       state_stack      = new Stack <State>();
            Stack <Action_type> additional_stack = new Stack <Action_type>();

            state_stack.Push(new State(Lexical_analyser.TYPE.Eof));
            state_stack.Push(new State(Non_terminal.Start));

            additional_stack.Push(Action_type.Empty);
            additional_stack.Push(Action_type.Empty);

            Stack <int> array_size_stack = new Stack <int>();

            String my_name = "";

            cur_lexeme = 0;

            //Таблица переменных
            Dictionary <string, Data_type> Table_of_vars = new Dictionary <string, Data_type>();

            while (state_stack.Count > 0)
            {
                State       Top_state  = state_stack.Pop();
                Action_type Top_action = additional_stack.Pop();
                Lexeme      cur_lex    = lexemes[cur_lexeme];

                if (Top_action != Action_type.Empty)
                {
                    int      i;
                    RPN_elem rpnElement = null;
                    switch (Top_action)
                    {
                    case Action_type.Get_name:
                        my_name = cur_lex.val;
                        break;

                    case Action_type.Int_declaration:
                        var newVariable = new Type_int_var();
                        Table_of_vars[my_name] = newVariable;
                        break;

                    case Action_type.Array_declaration:
                        var newArray = new Type_array(array_size_stack.Pop());
                        Table_of_vars[my_name] = newArray;
                        break;

                    case Action_type.Array_size:
                        array_size_stack.Push(int.Parse(cur_lex.val));
                        break;

                    case Action_type.Read:
                        rpnElement = new Read();
                        break;

                    case Action_type.Write:
                        rpnElement = new Write();
                        break;

                    case Action_type.Plus:
                        rpnElement = new Plus();
                        break;

                    case Action_type.Minus:
                        rpnElement = new Minus();
                        break;

                    case Action_type.Mul:
                        rpnElement = new Mul();
                        break;

                    case Action_type.Div:
                        rpnElement = new Div();
                        break;

                    case Action_type.Unar_plus:
                        rpnElement = new Unar_plus();
                        break;

                    case Action_type.Unar_minus:
                        rpnElement = new Unar_minus();
                        break;

                    case Action_type.Less:
                        rpnElement = new Less();
                        break;

                    case Action_type.Less_or_equal:
                        rpnElement = new Less_or_equal();
                        break;

                    case Action_type.More:
                        rpnElement = new More();
                        break;

                    case Action_type.More_or_equal:
                        rpnElement = new More_or_equal();
                        break;

                    case Action_type.Equal:
                        rpnElement = new Equal();
                        break;

                    case Action_type.Index:
                        rpnElement = new Index();
                        break;

                    case Action_type.Get:
                        rpnElement = new Get();
                        break;

                    case Action_type.Id:
                        if (Table_of_vars.ContainsKey(cur_lex.val))
                        {
                            rpnElement = new Put_data_type_to_stack(Table_of_vars[cur_lex.val]);
                        }
                        else
                        {
                            throw new Syntax_analyser_exception("Переменная не объявлена", cur_lex.line, cur_lex.char_pos);
                        }
                        break;

                    case Action_type.Num:
                        rpnElement = new Put_data_type_to_stack(new Type_number(int.Parse(cur_lex.val)));
                        break;

                    case Action_type.Auxiliary_action_1:
                        label_stack.Push(rpn.Count);
                        rpn.Add(new Put_data_type_to_stack(new Type_number()));
                        rpnElement = new Jf();
                        break;

                    case Action_type.Auxiliary_action_2:
                        i      = label_stack.Pop();
                        rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count + 2));
                        label_stack.Push(rpn.Count);
                        rpn.Add(new Put_data_type_to_stack(new Type_number(-1)));
                        rpnElement = new J();
                        break;

                    case Action_type.Auxiliary_action_3:
                        i      = label_stack.Pop();
                        rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count));
                        break;

                    case Action_type.Auxiliary_action_4:
                        label_stack.Push(rpn.Count);
                        break;

                    case Action_type.Auxiliary_action_5:
                        i      = label_stack.Pop();
                        rpn[i] = new Put_data_type_to_stack(new Type_number(rpn.Count + 2));
                        i      = label_stack.Pop();
                        rpn.Add(new Put_data_type_to_stack(new Type_number(i)));
                        rpn.Add(new J());
                        break;

                    default:
                        throw new Exception("Действие не выполнено");
                    }
                    if (rpnElement != null)
                    {
                        rpn.Add(rpnElement);
                    }
                }
                if (Top_state.Is_empty)
                {
                    continue;
                }

                if (Top_state.Is_terminal)
                {
                    //на вершине стека терминал
                    if (Top_state.Terminal == cur_lex.Type)
                    {
                        cur_lexeme++;
                    }
                    else
                    {
                        throw new Syntax_analyser_exception("Неожиданный символ " + cur_lex.Type.ToString(), cur_lex.line, cur_lex.char_pos);
                    }
                }
                else
                {
                    //на вершине стека нетерминал
                    Non_terminal nt = Top_state.Non_terminal;
                    if (!Table_of_rules.ContainsKey(nt) || !Table_of_rules[nt].ContainsKey(cur_lex.Type))
                    {
                        throw new Syntax_analyser_exception("Неожиданный символ ", cur_lex.line, cur_lex.char_pos);
                    }
                    Table_of_rules[nt][cur_lex.Type].Apply(state_stack);
                    Table_of_actions[nt][cur_lex.Type].Apply(additional_stack);
                }
            }
            return(rpn);
        }