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();
        }
Example #2
0
 public void InsertRecord(Model_Records record)
 {
     string sql = string.Format("INSERT INTO "
                                  + "records (id,placeid,name,carnumbers,contactway,entertime) "
                                  + " VALUES('{0}','{1}','{2}','{3}','{4}','{5}')"
                                  , record.ReturnId(),record.ReturnPlaceid(),record.ReturnMasterName(),record.ReturnCarNumbers(),record.ReturnMasterContactWay(),record.ReturnEntertime().ToString());
     conn.DBcmd(sql);
 }
Example #3
0
 //结账操作
 public void FinishOneRecord(Model_Records record)
 {
     string sql = "UPDATE records " +
               " SET outtime='" + record.ReturnOutertime()
               + "',money='" + record.ReturnMoney() + "'" +
               " WHERE carnumbers='" + record.ReturnCarNumbers() + "'";
     conn.DBcmd(sql);
 }
        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 = "";
                }

            }
        }
Example #5
0
        //通过姓名和车牌号返回record,帮助判断数据库中是否存在这条记录
        public Model_Records ReturnRecordByNumbersAndName(string carnumbers,string name)
        {
            Model_Records record;
            string sql = "select * from records where name='" + name + "' and carnumbers='"+carnumbers+"'";
            DataSet dataset = conn.DBQuery(sql);
            DataTable datatable = dataset.Tables[0];
            if (datatable.Rows.Count > 0)
            {
                DataRow row = datatable.Rows[0];
                record = new Model_Records(
                   row["name"].ToString(),
                   row["carnumbers"].ToString(),
                   row["contactway"].ToString(),
                   Convert.ToInt32(row["placeid"].ToString()),
                   Convert.ToDateTime(row["entertime"])
                   );
            }
            else
            {
                record = null;
            }

            return record;
        }
Example #6
0
 //修改一条记录
 public static void UpdateInformation(Model_Records record)
 {
     dal_record.UpdateInformation(record);
 }
Example #7
0
 //完成一条记录,保存在记录表中
 public static void FinishOneRecord(Model_Records finishedrecord)
 {
     dal_record.FinishOneRecord(finishedrecord);
 }
Example #8
0
 //新建一条记录,等待支付
 public static void AddNewRecord(Model_Records newrecord)
 {
     dal_record.InsertRecord(newrecord);
 }
Example #9
0
 public Model_Records ReturnRecordsByCarnumbers(string carnumbers)
 {
     Model_Records record;
     string sql = "select * from records where carnumbers='" + carnumbers + "'";
     DataSet dataset = conn.DBQuery(sql);
     DataTable datatable = dataset.Tables[0];
     if (datatable.Rows.Count > 0)
     {
         DataRow row = datatable.Rows[0];
         if (row["outtime"].ToString()!=null)
         {
              record = new Model_Records (
            Convert.ToInt32(row["id"].ToString()),
            row["name"].ToString(),
            row["carnumbers"].ToString(),
            row["contactway"].ToString(),
            Convert.ToInt32(row["placeid"].ToString()),
            Convert.ToDateTime(row["entertime"]),
            Convert.ToDateTime(row["outtime"]),
            Convert.ToDouble(row["money"])
            );
         }
         else
         {
             record = new Model_Records(
         Convert.ToInt32(row["id"].ToString()),
         row["name"].ToString(),
         row["carnumbers"].ToString(),
         row["contactway"].ToString(),
         Convert.ToInt32(row["placeid"].ToString()),
         Convert.ToDateTime(row["entertime"])
         );
         }
     }
     else
     {
         record = null;
     }
     return record;
 }