public MainWindow()
        {
            InitializeComponent();


            var EnterNewRes = new res();
        }
 public FormEditCategories(res.Item _preselItem)
     : this()
 {
     cb_cat.SelectedValue = _preselItem.catID;
     RefillItems(null, null);
     cb_existingItem.SelectedValue = _preselItem.id;
 }
Exemplo n.º 3
0
 public FormReports(res.Employee _curEmpl)
 {
     InitializeComponent();
     database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));
     curEmpl = _curEmpl;
     InitTypes();
 }
Exemplo n.º 4
0
        void helper_RequestCompleted_get_syc_list(object o)
        {
            string strres = (string)o;

            Debug.WriteLine(
                string.Format("helper_RequestCompleted_get_syc_list  ->  = {0}"
                              , strres));
            object            olist = fastJSON.JSON.Instance.ToObjectList(strres, typeof(List <res>), typeof(res));
            deleControlInvoke dele  = delegate(object ol)
            {
                List <res> resList = (List <res>)ol;
                if (resList.Count > 0)
                {
                    this.__lastTagTimeStamp = resList[0].time_stamp;
                    for (int i = 0; i < resList.Count; i++)
                    {
                        res temp = resList[i];
                        this.listBox1.Items.Add(temp.resID);
                        this.file_name_list.Add(temp.resID);
                    }
                }
            };

            this.Invoke(dele, olist);
        }
Exemplo n.º 5
0
        private void user_Load(object sender, EventArgs e)
        {
            this.Owner.Hide();
            toolStripLabel1.Text = "学号:" + ID;

            SqlDataAdapter sda = new SqlDataAdapter("Select Name From student where ID = '" + ID + "'", mycon);
            DataSet        Ds  = new DataSet();

            sda.Fill(Ds, "student");
            NAME = Ds.Tables[0].Rows[0][0].ToString().Trim();
            toolStripLabel2.Text = "姓名:" + NAME;
            项A.Visible           = true;
            项B.Visible           = true;
            项C.Visible           = true;
            项D.Visible           = true;
            正确.Visible           = false;
            错误.Visible           = false;
            textBox1.Visible     = false;

            一题.Enabled = false;
            一题.Enabled = false;
            标记.Enabled = false;
            交卷.Enabled = false;
            项A.Enabled = false;
            项B.Enabled = false;
            项C.Enabled = false;
            项D.Enabled = false;
            正确.Enabled = false;
            错误.Enabled = false;

            for (int i = 0; i < 25; i++)
            {
                RChoice[i] = new res(1, "", 1);
            }
        }
Exemplo n.º 6
0
        public FormEditEmplSet(res.Employee _curEmpl)
        {
            InitializeComponent();

            database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));
            Employees = from emp in database.EmployeeSet select emp;
            Appointments = from app in database.AppointmentSet select app;

            this.curEmpl = _curEmpl;

            cb_app_fill();
        }
Exemplo n.º 7
0
        public FormEditOrder(ref res.Employee curEmpl)
        {
            InitializeComponent();
            mode = (short)OrderMode.mode_new;
            curEmployee = curEmpl;
            lbl_num.Text = "Новый";
            #region database context & entities filling
            database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));
            curPositions = new List<PositionForOrder>();
            curOrder = res.Order.CreateOrder(-1, DateTime.Now, "Обработка", -1, -1);
            Items = from it in database.ItemSet select it;
            Categories = from cat in database.ItemCategorySet select cat;
            #endregion
            #region data sources
            cb_itemType.DataSource = Categories.ToArray();
            cb_itemType.DisplayMember = "name";
            cb_itemType.ValueMember = "id";

            DGV.DataSource = DGV_contentsT;
            #endregion
            #region event_bindings
            cb_itemType.SelectedValueChanged += new EventHandler(btn_addPos_check);
            cb_itemType.SelectedValueChanged += new EventHandler(this.cb_itemType_SelectedIndexChanged);

            cb_itemDesignation.SelectedIndexChanged += new EventHandler(this.cb_itemDesignation_SelectedIndexChanged);
            cb_itemDesignation.SelectedValueChanged += new EventHandler(this.num_itemCount_check);
            cb_itemDesignation.SelectedValueChanged += new EventHandler(btn_addPos_check);
            cb_itemDesignation.SelectedValueChanged += new EventHandler(num_itemCount_anull);

            num_itemCount.ValueChanged += new EventHandler(btn_addPos_check);
            num_itemCount.ValueChanged += new EventHandler(num_itemCount_ValueChanged);

            btn_addItem.Click += new EventHandler(btn_addItem_Click);
            btn_addItem.Click += new EventHandler(btn_rmItem_check);
            btn_addItem.Click += new EventHandler(DGV_contentsT_Refill);
            btn_addItem.Click += new EventHandler(this.btn_accept_check);

            btn_rmItem.Click += new EventHandler(btn_rmItem_Click);
            btn_rmItem.Click += new EventHandler(btn_rmItem_check);
            btn_rmItem.Click += new EventHandler(DGV_contentsT_Refill);
            btn_rmItem.Click += new EventHandler(this.btn_accept_check);

            btn_accept.Click += new EventHandler(btn_accept_Click);

            tb_Name.TextChanged += new EventHandler(this.btn_accept_check);
            tb_phone.TextChanged += new EventHandler(this.btn_accept_check);

            DGV.SelectionChanged += new EventHandler(btn_rmItem_check);
            DGV.CellValueChanged += new DataGridViewCellEventHandler(DGV_CellValueChanged);
            DGV.CellValueChanged += new DataGridViewCellEventHandler(DGV_contentsT_Refill);
            DGV.DataError += new DataGridViewDataErrorEventHandler(DGV_DataError);
            #endregion
        }
Exemplo n.º 8
0
        public FormIntake(res.Item _preselectedItem)
        {
            InitializeComponent();
            database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));

            FillCategories();

            cb_type.SelectedValue = _preselectedItem.catID;
            RefillItems();
            cb_designation.SelectedValue = _preselectedItem.id;
            checks(this, null);
        }
Exemplo n.º 9
0
        public FormEditEmplOne(ref res.Employee empl)
        {
            InitializeComponent();
            database = new res.Model1Container(RegistryInteractor.GetFromReg("Connection String"));
            Employees = from emp in database.EmployeeSet select emp;
            this.Empl = empl;
            lbl_username.Text = Empl.login;
            btn_loginChange.Enabled = false;

            #region event_bindings
            Empl.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.user_prop_changed);
            database.SavingChanges += new System.EventHandler(this.database_changing);
            #endregion
        }
Exemplo n.º 10
0
        public IActionResult EncryptAction(string str, string key, string iv)
        {
            res res = new res();

            res.str = str;
            res.key = key;

            str = EncryptHelper.Encrypt(str, key);

            res.kstr = str;

            str = EncryptHelper.Decrypt(str, key);

            res.text = str;

            return(Json(res));
        }
Exemplo n.º 11
0
        public archive_file.error initialize()
        {
            osd_file.error err = osdcore_global.m_osdfile.open(m_filename, OPEN_FLAG_READ, out m_archive_stream.osdfile, out m_archive_stream.length);
            if (err != osd_file.error.NONE)
            {
                return(archive_file.error.FILE_ERROR);
            }

            //global.osd_printf_verbose("un7z: opened archive file {0}\n", m_filename.c_str());

#if false
            CrcGenerateTable(); // FIXME: doesn't belong here - it should be called once statically

            SzArEx_Init(&m_db);
            m_inited = true;
            SRes const res = SzArEx_Open(&m_db, &m_look_stream.s, &m_alloc_imp, &m_alloc_temp_imp);
            if (res != SZ_OK)
            {
                osd_printf_error("un7z: error opening %s as 7z archive (%d)\n", m_filename.c_str(), int(res));
                switch (res)
                {
                case SZ_ERROR_UNSUPPORTED:  return(archive_file.error.UNSUPPORTED);

                case SZ_ERROR_MEM:          return(archive_file.error.OUT_OF_MEMORY);

                case SZ_ERROR_INPUT_EOF:    return(archive_file.error.FILE_TRUNCATED);

                default:                    return(archive_file.error.FILE_ERROR);
                }
            }

            return(archive_file::error::NONE);
#endif

            try
            {
                m_sharpCompressArchive = SevenZipArchive.Open(m_archive_stream.osdfile.stream);
            }
            catch (Exception e)
            {
                m_sharpCompressArchive = null;
                return(archive_file.error.FILE_ERROR);
            }

            return(archive_file.error.NONE);
        }
Exemplo n.º 12
0
        //Calculates and returns the amount of thrust available at full throttle
        private res calculateThrustOld(Vessel v)
        {
            res r = new res();

            if (v.loaded)   //I might make an unloaded version later, but for now we'll stick with loaded vessels
            {
                foreach (Part p in v.parts)
                {
                    if (p.physicalSignificance == Part.PhysicalSignificance.FULL)
                    {
                        r.mass += p.mass;
                    }
                    r.mass += p.GetResourceMass();  //I suppose a part could have no physical significance, but its resources could?
                    // if ((p.State == PartStates.ACTIVE) || (p.State == PartStates.IDLE))
                    //{
                    foreach (PartModule pm in p.Modules)
                    {
                        if (pm.moduleName.Equals("ModuleEngines"))
                        {
                            ModuleEngines e = pm as ModuleEngines;

                            /*Log.Info("Engine: "+p.InternalModelName);
                             * String status = p.partName+" status: ";
                             * if (e.engineShutdown) status += "Shutdown ";
                             * if (e.getFlameoutState) status += "Flamed Out ";
                             * if (e.getIgnitionState) status += "Ignited ";
                             * if (e.isEnabled) status += "Enabled ";
                             * if (e.isOperational) status += "Operational ";
                             * status += e.status;
                             * status += e.statusL2;
                             * Log.Info(status); */
                            if ((e != null) && e.isOperational)
                            {
                                //Log.Info("Active engine!");
                                r.isp    += e.maxThrust / e.atmosphereCurve.Evaluate((float)v.staticPressurekPa);
                                r.thrust += e.maxThrust;
                            }
                        }
                    }
                    //}
                }
            }
            r.isp = r.thrust / r.isp;   //Weighted average of ISPs
            return(r);
        }
Exemplo n.º 13
0
 public FormEditOrder(ref res.Employee curEmpl, res.Item[] _preselItems)
     : this(ref curEmpl)
 {
     bool all = true;
     foreach (var item in _preselItems)
     {
         if (item.storeResidue >= 1)
         {
             curPositions.Add(new PositionForOrder { id = item.id, Наименование = item.ItemParameter.Single(par => par.ParameterCategory.name == "Наименование").valueTxt, Количество = 1 });
         }
         else
         {
             all = false;
         }
     }
     DGV_contentsT_Refill(null, null);
     if (!all) MessageBox.Show("Некоторых позиций в данный момент нет на складе, они не были добавлены в список");
 }
Exemplo n.º 14
0
        public ActionResult <res> Create([FromBody] res request)
        {
            var res = new Res
            {
                Id   = request.Id,
                Name = request.Name,
                Date = request.Date
            };

            context.reservation.Add(res);
            var success = context.SaveChanges() > 0;

            if (success)
            {
                return(res);
            }

            throw new Exception("Error searching reservations");
        }
Exemplo n.º 15
0
        private void  一题_Click(object sender, EventArgs e)
        {
            string answer = "";

            //获取选择题题号,答案与数据库中id对象
            if (QNum < 10)
            {
                if (项A.Checked)
                {
                    answer = "A";
                }
                if (项B.Checked)
                {
                    answer = "B";
                }
                if (项C.Checked)
                {
                    answer = "C";
                }
                if (项D.Checked)
                {
                    answer = "D";
                }
                RChoice[QNum] = new res(QNum + 1, answer, arychoice[QNum]);
            }
            //获取判断题题号,答案与数据库中id对象
            else if (QNum < 20)
            {
                if (正确.Checked)
                {
                    answer = "true";
                }
                if (错误.Checked)
                {
                    answer = "false";
                }
                RChoice[QNum] = new res(QNum + 1, answer, aryjudge[QNum - 10]);
            }
            //获取填空题题号,答案与数据库中id对象
            else if (QNum < 25)
            {
                answer        = textBox1.Text.Trim();
                RChoice[QNum] = new res(QNum + 1, answer, aryfilling[QNum - 20]);
            }

            项A.Checked    = false;
            项B.Checked    = false;
            项C.Checked    = false;
            项D.Checked    = false;
            正确.Checked    = false;
            错误.Checked    = false;
            textBox1.Text = "";

            if (QNum > 0)
            {
                QNum--;
            }


            //显示上一道选择题
            if (QNum < 10)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From choice where subject = '" + comboBox1.Text + "' and id = '" + arychoice[QNum] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "choice");
                label1.Text      = (QNum + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim() + "\n" + ds.Tables[0].Rows[0][3].ToString().Trim() + "\n" + ds.Tables[0].Rows[0][4].ToString().Trim() + "\n" + ds.Tables[0].Rows[0][5].ToString().Trim() + "\n" + ds.Tables[0].Rows[0][6].ToString().Trim();
                项A.Visible       = true;
                项B.Visible       = true;
                项C.Visible       = true;
                项D.Visible       = true;
                正确.Visible       = false;
                错误.Visible       = false;
                textBox1.Visible = false;
                if (RChoice[QNum].getans() != "")
                {
                    if (RChoice[QNum].getans() == "A")
                    {
                        项A.Checked = true;
                    }
                    if (RChoice[QNum].getans() == "B")
                    {
                        项B.Checked = true;
                    }
                    if (RChoice[QNum].getans() == "C")
                    {
                        项C.Checked = true;
                    }
                    if (RChoice[QNum].getans() == "D")
                    {
                        项D.Checked = true;
                    }
                }
            }
            //显示上一道判断题
            else if (QNum < 20)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From judge where subject = '" + comboBox1.Text + "' and id = '" + aryjudge[QNum - 10] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "judge");
                label1.Text      = (QNum + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim();
                项A.Visible       = false;
                项B.Visible       = false;
                项C.Visible       = false;
                项D.Visible       = false;
                正确.Visible       = true;
                错误.Visible       = true;
                textBox1.Visible = false;
                if (RChoice[QNum].getans() != "")
                {
                    if (RChoice[QNum].getans() == "true")
                    {
                        正确.Checked = true;
                    }
                    if (RChoice[QNum].getans() == "false")
                    {
                        错误.Checked = true;
                    }
                }
            }
            //显示上一道填空题
            else if (QNum < 25)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From filling where subject = '" + comboBox1.Text.Trim() + "' and id = '" + aryjudge[QNum - 20] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "filling");
                label1.Text      = (QNum + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim();
                项A.Visible       = false;
                项B.Visible       = false;
                项C.Visible       = false;
                项D.Visible       = false;
                正确.Visible       = false;
                错误.Visible       = false;
                textBox1.Visible = true;
                if (RChoice[QNum].getans() != "")
                {
                    textBox1.Text = RChoice[QNum].getans();
                }
            }

            foreach (Control cc in groupBox1.Controls)
            {
                if (cc.Text.Trim() == (QNum + 1).ToString().Trim())
                {
                    cc.BackColor = ColorTranslator.FromHtml("#00FF00");
                }
                else
                {
                    cc.BackColor = Control.DefaultBackColor;
                }
                foreach (int n in sign)
                {
                    if (n.ToString().Trim() == cc.Text.Trim())
                    {
                        cc.BackColor = ColorTranslator.FromHtml("#0000FF");
                    }
                }
            }
            foreach (Control cc in groupBox2.Controls)
            {
                if (cc.Text.Trim() == (QNum + 1).ToString().Trim())
                {
                    cc.BackColor = ColorTranslator.FromHtml("#00FF00");
                }
                else
                {
                    cc.BackColor = Control.DefaultBackColor;
                }
                foreach (int n in sign)
                {
                    if (n.ToString().Trim() == cc.Text.Trim())
                    {
                        cc.BackColor = ColorTranslator.FromHtml("#0000FF");
                    }
                }
            }
            foreach (Control cc in groupBox3.Controls)
            {
                if (cc.Text.Trim() == (QNum + 1).ToString().Trim())
                {
                    cc.BackColor = ColorTranslator.FromHtml("#00FF00");
                }
                else
                {
                    cc.BackColor = Control.DefaultBackColor;
                }
                foreach (int n in sign)
                {
                    if (n.ToString().Trim() == cc.Text.Trim())
                    {
                        cc.BackColor = ColorTranslator.FromHtml("#0000FF");
                    }
                }
            }
        }
 AddPurchase(res, purchase);
Exemplo n.º 17
0
        public FormEditOrder(ref res.Employee curEmpl, ref res.Order _presetOrder)
            : this(ref curEmpl)
        {
            this.curOrder = _presetOrder;
            this.mode = (short)OrderMode.mode_edit;
            lbl_num.Text = _presetOrder.id.ToString();
            this.lbl_num.Text = _presetOrder.id.ToString();
            foreach (var pos in _presetOrder.Position)
                this.curPositions.Add(new PositionForOrder { id = pos.itemID, Количество = pos.count, Наименование = pos.Item.ItemParameter.Single(par => par.ParameterCategory.name == "Наименование").valueTxt });
            this.tb_Name.Text = _presetOrder.Consumer.name;
            this.tb_phone.Text = _presetOrder.Consumer.phone;
            this.tb_email.Text = _presetOrder.Consumer.email;

            DGV_contentsT_Refill(this, null);
        }
Exemplo n.º 18
0
 Assert.IsTrue(ArrayEqual(res, res2));
Exemplo n.º 19
0
 public FormEditEmplSet(res.Employee _preselEmpl, res.Employee _curEmpl)
     : this(_curEmpl)
 {
     selEmpl = _preselEmpl;
     selEmpl_Changed();
 }
Exemplo n.º 20
0
 ptr <asyncIO> aio = addr(new asyncIO(res: make(chanresult, 0), ));
Exemplo n.º 21
0
 MapVectors(res, vectors);
Exemplo n.º 22
0
 public FormEditCategories(res.ItemCategory _presetCat)
     : this()
 {
     cb_cat.SelectedValue = _presetCat.id;
     RefillItems(null, null);
 }
Exemplo n.º 23
0
        private void 交卷_Click(object sender, EventArgs e)
        {
            //若该题未点击上下题按钮则该题答案未录入,需手动
            string answer1 = "";

            //获取选择题题号,答案与数据库中id对象
            if (QNum < 10)
            {
                if (项A.Checked)
                {
                    answer1 = "A";
                }
                if (项B.Checked)
                {
                    answer1 = "B";
                }
                if (项C.Checked)
                {
                    answer1 = "C";
                }
                if (项D.Checked)
                {
                    answer1 = "D";
                }
                RChoice[QNum] = new res(QNum + 1, answer1, arychoice[QNum]);
            }
            //获取判断题题号,答案与数据库中id对象
            else if (QNum < 20)
            {
                if (正确.Checked)
                {
                    answer1 = "true";
                }
                if (错误.Checked)
                {
                    answer1 = "false";
                }
                RChoice[QNum] = new res(QNum + 1, answer1, aryjudge[QNum - 10]);
            }
            //获取填空题题号,答案与数据库中id对象
            else if (QNum < 25)
            {
                answer1       = textBox1.Text.Trim();
                RChoice[QNum] = new res(QNum + 1, answer1, aryfilling[QNum - 20]);
            }
            //计算分数
            int score = 0;

            for (int i = 0; i < 10; i++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From choice where subject = '" + comboBox1.Text + "' and id = '" + arychoice[i] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "choice");
                if (RChoice[i].getans().Trim() == ds.Tables[0].Rows[0][7].ToString().Trim())
                {
                    score += 4;
                }
            }
            for (int i = 10; i < 20; i++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From judge where subject = '" + comboBox1.Text + "' and id = '" + aryjudge[i - 10] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "judge");
                if (RChoice[i].getans().Trim() == ds.Tables[0].Rows[0][3].ToString().Trim())
                {
                    score += 4;
                }
            }
            for (int i = 20; i < 25; i++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From filling where subject = '" + comboBox1.Text.Trim() + "' and id = '" + aryfilling[i - 20] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "filling");
                if (RChoice[i].getans().Trim() == ds.Tables[0].Rows[0][3].ToString().Trim())
                {
                    score += 4;
                }
            }
            MessageBox.Show("恭喜您!本次考试获得" + score + "分");
            //插入记录
            string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            mycon.Open();
            SqlDataAdapter da0 = new SqlDataAdapter("select * from score where ID=" + ID + " and subject='" + comboBox1.Text.ToString().Trim() + "'", mycon);
            DataSet        ds0 = new DataSet();

            da0.Fill(ds0, "score");
            if (ds0.Tables["score"].Rows.Count == 0)
            {
                SqlCommand cmd = new SqlCommand("insert into score(ID, Name, subject,score,date) values ('" + ID + "', '" + NAME + "', '" + comboBox1.Text + "', '" + score + "', '" + date + "')", mycon);
                cmd.ExecuteNonQuery();
                mycon.Close();
            }
            else
            {
                if (score > int.Parse(ds0.Tables["score"].Rows[0].ItemArray[3].ToString().Trim()))
                {
                    SqlCommand cmd = new SqlCommand("update score set score=" + score + " where ID=" + ID + " and subject='" + comboBox1.Text.ToString().Trim() + "'", mycon);
                    cmd.ExecuteNonQuery();
                    mycon.Close();
                }
            }

            //导出试卷及标准答案
            string myanswer = NAME + "的答案:\r\n";
            int    k        = 1;

            foreach (res s in RChoice)
            {
                myanswer += k + "." + s.getans() + "\r\n";
                k++;
            }
            string num       = DateTime.Now.Millisecond.ToString();
            string textname  = comboBox1.Text + "试卷" + num;
            string ExamPaper = "                         " + comboBox1.Text + "试题\r\n\r\n\r\n" + "一.选择题" + "\r\n";
            string answer    = "标准答案:\r\n";

            for (int j = 0; j < 10; j++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From choice where subject = '" + comboBox1.Text + "' and id = '" + arychoice[j] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "choice");
                ExamPaper += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim() + "\r\n" + ds.Tables[0].Rows[0][3].ToString().Trim() + "\r\n" + ds.Tables[0].Rows[0][4].ToString().Trim() + "\r\n" + ds.Tables[0].Rows[0][5].ToString().Trim() + "\r\n" + ds.Tables[0].Rows[0][6].ToString().Trim() + "\r\n\r\n";
                answer    += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][7].ToString().Trim() + " ";
            }
            answer    += "\r\n";
            ExamPaper += "\r\n" + "二.判断题" + "\r\n";
            for (int j = 10; j < 20; j++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From judge where subject = '" + comboBox1.Text + "' and id = '" + aryjudge[j - 10] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "judge");
                ExamPaper += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim() + "\r\n\r\n";
                answer    += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][3].ToString().Trim() + " ";
            }
            answer    += "\r\n";
            ExamPaper += "\r\n" + "三.填空题" + "\r\n";
            for (int j = 20; j < 25; j++)
            {
                SqlDataAdapter da = new SqlDataAdapter("Select * From filling where subject = '" + comboBox1.Text + "' and id = '" + aryfilling[j - 20] + "'", mycon);
                DataSet        ds = new DataSet();
                da.Fill(ds, "filling");
                ExamPaper += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][2].ToString().Trim() + "\r\n\r\n";
                answer    += (j + 1).ToString() + "." + ds.Tables[0].Rows[0][3].ToString().Trim() + " ";
            }
            ExamPaper += "\r\n" + answer;
            ExamPaper += "\r\n" + myanswer;
            System.IO.File.WriteAllText("E:\\SoftwareEngineeringProject\\ExamSystem\\ExamSystem\\生成试卷\\" + textname + ".txt", ExamPaper);
            Application.Exit();
        }
Exemplo n.º 24
0
 LogOutput(res, url, "GET");
Exemplo n.º 25
0
        public archive_file.error decompress(ListBytes buffer, uint32_t length)
        {
#if false
            // if we don't have enough buffer, error
            if (length < m_curr_length)
            {
                osd_printf_error("un7z: buffer too small to decompress %s from %s\n", m_curr_name.c_str(), m_filename.c_str());
                return(archive_file::error::BUFFER_TOO_SMALL);
            }

            // make sure the file is open..
            if (!m_archive_stream.osdfile)
            {
                m_archive_stream.currfpos = 0;
                osd_file::error const err = osd_file::open(m_filename, OPEN_FLAG_READ, m_archive_stream.osdfile, m_archive_stream.length);
                if (err != osd_file::error::NONE)
                {
                    osd_printf_error("un7z: error reopening archive file %s (%d)\n", m_filename.c_str(), int(err));
                    return(archive_file::error::FILE_ERROR);
                }
                osd_printf_verbose("un7z: reopened archive file %s\n", m_filename.c_str());
            }

            std::size_t offset(0);
            std::size_t out_size_processed(0);

            SRes const res = SzArEx_Extract(
                &m_db, &m_look_stream.s, m_curr_file_idx,               // requested file
                &m_block_index, &m_out_buffer, &m_out_buffer_size,      // solid block caching
                &offset, &out_size_processed,                           // data size/offset
                &m_alloc_imp, &m_alloc_temp_imp);                       // allocator helpers
            if (res != SZ_OK)
            {
                osd_printf_error("un7z: error decompressing %s from %s (%d)\n", m_curr_name.c_str(), m_filename.c_str(), int(res));
                switch (res)
                {
                case SZ_ERROR_UNSUPPORTED:  return(archive_file::error::UNSUPPORTED);

                case SZ_ERROR_MEM:          return(archive_file::error::OUT_OF_MEMORY);

                case SZ_ERROR_INPUT_EOF:    return(archive_file::error::FILE_TRUNCATED);

                default:                    return(archive_file::error::DECOMPRESS_ERROR);
                }
            }

            // copy to destination buffer
            std::memcpy(buffer, m_out_buffer + offset, (std::min <std::size_t>)(length, out_size_processed));
            return(archive_file::error::NONE);
#endif
            int cur = 0;
            foreach (var entry in m_sharpCompressArchive.Entries)
            {
                if (cur++ == m_curr_file_idx)
                {
                    MemoryStream stream = new MemoryStream((int)entry.Size);
                    entry.WriteTo(stream);
                    stream.Seek(0, SeekOrigin.Begin);
                    int bufferPos = 0;
                    while (bufferPos < stream.Length)
                    {
                        buffer[bufferPos++] = Convert.ToByte(stream.ReadByte());
                    }

                    return(archive_file.error.NONE);
                }
            }

            return(archive_file.error.FILE_ERROR);
        }
Exemplo n.º 26
0
 // Run parser (State effect)
 var(res, rest) = jsonParser.runState(str2);