Ejemplo n.º 1
0
        private void Button_records_search_Click(object sender, EventArgs e)
        {
            this.dataGridView_records.Rows.Clear();
            Model_Records record;

            if (this.comboBox_records.SelectedItem.ToString() == "" || this.textBox_records.Text == "")
            {
                MessageBox.Show("查询方式有误,请重试!");
            }
            else
            {
                record = BLL_Records.ReturnSearchBy(this.comboBox_records.SelectedItem.ToString(), this.textBox_records.Text);
                if (record != null)
                {
                    int index = this.dataGridView_records.Rows.Add();
                    this.dataGridView_records.Rows[index].Cells["id"].Value         = record.ReturnId();
                    this.dataGridView_records.Rows[index].Cells["mastername"].Value = record.ReturnMasterName();
                    this.dataGridView_records.Rows[index].Cells["contactway"].Value = record.ReturnMasterContactWay();
                    this.dataGridView_records.Rows[index].Cells["placeid"].Value    = record.ReturnPlaceid();
                    this.dataGridView_records.Rows[index].Cells["carnumbers"].Value = record.ReturnCarNumbers();
                    this.dataGridView_records.Rows[index].Cells["Entertime"].Value  = record.ReturnEntertime();
                    this.dataGridView_records.Rows[index].Cells["leavetime"].Value  = record.ReturnOutertime();
                    TimeSpan timespan = DateTime.Now - Convert.ToDateTime(record.ReturnEntertime());
                    this.dataGridView_records.Rows[index].Cells["allstaytime"].Value = timespan.ToString();
                    this.dataGridView_records.Rows[index].Cells["money"].Value       = record.ReturnMoney();
                }
            }
        }
Ejemplo n.º 2
0
        private void Button_NextStep_Click(object sender, EventArgs e)
        {
            if (this.textBox_placeid.Text == "" || this.textBox_carnumbers.Text == "" || this.textBox_mastername.Text == "" || this.textBox_contactway.Text == "")
            {
                MessageBox.Show("输入项不能为空");
            }
            else
            {
                freecar = new Model_FreedomCars(Convert.ToInt32(this.textBox_placeid.Text),
                                                this.textBox_carnumbers.Text,
                                                this.textBox_mastername.Text,
                                                this.textBox_contactway.Text);
                if (BLL_FreedomCars.ReturnCarExist(freecar) == true)
                {
                    this.Button_NextStep.Visible    = false;
                    this.Button_NextStep.Enabled    = false;
                    this.Button_Allow_Leave.Visible = true;
                    this.Button_Allow_Leave.Enabled = true;

                    record = BLL_Records.ReturnRecordByNumbersAndName(
                        this.textBox_carnumbers.Text,
                        this.textBox_mastername.Text
                        );

                    record.SetOuttime(DateTime.Now);
                    record.SetMoney(10);

                    this.label_entertime.Text = record.ReturnEntertime();
                    this.label_leavetime.Text = record.ReturnOutertime();
                    this.label_timecost.Text  = record.ReturnAllStayTime();
                    this.label_moneycost.Text = record.ReturnMoney();
                    this.costlist.Visible     = true;
                }
                else
                {
                    MessageBox.Show("输入信息有误,请重新输入!");
                    this.textBox_carnumbers.Text = "";
                    this.textBox_contactway.Text = "";
                    this.textBox_mastername.Text = "";
                    this.textBox_placeid.Text    = "";
                }
            }
        }
Ejemplo n.º 3
0
        private void Button_Check_AllRecords_Click(object sender, EventArgs e)
        {
            this.dataGridView_records.Rows.Clear();
            DataSet           dataset = BLL_Records.ReturnAllRecords();
            DataRowCollection rows    = dataset.Tables[0].Rows;

            for (int i = 0; i < rows.Count; i++)
            {
                int index = this.dataGridView_records.Rows.Add();
                this.dataGridView_records.Rows[index].Cells["id"].Value         = rows[i]["id"];
                this.dataGridView_records.Rows[index].Cells["mastername"].Value = rows[i]["name"];
                this.dataGridView_records.Rows[index].Cells["contactway"].Value = rows[i]["contactway"];
                this.dataGridView_records.Rows[index].Cells["placeid"].Value    = rows[i]["placeid"];
                this.dataGridView_records.Rows[index].Cells["Entertime"].Value  = rows[i]["entertime"];
                this.dataGridView_records.Rows[index].Cells["leavetime"].Value  = rows[i]["outtime"];
                TimeSpan timespan = DateTime.Now - Convert.ToDateTime(rows[i]["entertime"]);
                this.dataGridView_records.Rows[index].Cells["allstaytime"].Value = timespan.TotalSeconds.ToString();
                this.dataGridView_records.Rows[index].Cells["money"].Value       = rows[i]["money"];
            }
        }
Ejemplo n.º 4
0
        private void Button_enter_allow_Click(object sender, EventArgs e)
        {
            DateTime timenow = DateTime.Now;
            //新建一个model,数据通过这个model进行传递
            Model_FreedomCars newcar = new Model_FreedomCars(
                Convert.ToInt32(this.textBox_placeid.Text),
                this.textBox_carnumbers.Text,
                this.textBox_mastername.Text,
                this.textBox_tel.Text,
                timenow
                );

            BLL_FreedomCars.EnterNewFreeCar(newcar);



            Model_Records newrecord = new Model_Records(
                this.textBox_mastername.Text,
                this.textBox_carnumbers.Text,
                this.textBox_tel.Text,
                Convert.ToInt32(this.textBox_placeid.Text),
                timenow
                );

            BLL_Records.AddNewRecord(newrecord);

            this.Close();

            //  records = new BLL_Records(
            //  this.textBox_mastername.Text,
            //  this.textBox_tel.Text,
            //  Convert.ToInt32(this.textBox_placeid.Text),
            //  this.textBox_carnumbers.Text
            //  );
            //records.SaveRecords();
        }
Ejemplo n.º 5
0
 private void Button_Allow_Leave_Click(object sender, EventArgs e)
 {
     BLL_FreedomCars.LeaveOneFreeCar(freecar);
     BLL_Records.FinishOneRecord(record);
     this.Close();
 }