Пример #1
0
 private void MenuItem34_Click(System.Object sender, System.EventArgs e)
 {
     frmNewAppointBill frmnab = new frmNewAppointBill();
     frmnab.CreateSelectedTables();
     frmnab.CreateSelectedFoods();
     frmnab.TextBox1.Text = rms_var.GenNewAppointBillNo();
     frmnab.Label13.Text = "预订";
     frmnab.ShowDialog();
 }
Пример #2
0
        private void Button1_Click(System.Object sender, System.EventArgs e)
        {
            frmNewAppointBill frmnab = new frmNewAppointBill();
            frmnab.TextBox1.Enabled = false;
            frmnab.ComboBox2.Enabled = false;
            frmnab.TextBox1.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 0].ToString(); //订单编号
            frmnab.EditOpID = dgAppointBill[dgAppointBill.CurrentRowIndex, 10].ToString(); //操作员
            frmnab.TextBox3.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 1].ToString(); //客户名称
            frmnab.TextBox4.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 2].ToString(); //预订人
            frmnab.TextBox5.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 3].ToString(); //联系电话
            frmnab.DateTimePicker2.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 5].ToString(); //预订日期
            frmnab.EditTimeBlock = dgAppointBill[dgAppointBill.CurrentRowIndex, 6].ToString(); //时间段
            frmnab.NumericUpDown2.Text =dgAppointBill[dgAppointBill.CurrentRowIndex, 7].ToString(); //估计人数
            frmnab.NumericUpDown1.Text =dgAppointBill[dgAppointBill.CurrentRowIndex, 8].ToString(); //定金
            frmnab.TextBox6.Text = dgAppointBill[dgAppointBill.CurrentRowIndex, 11].ToString(); //备注
            //0=预订中 1=完成
            if (dgAppointBill[dgAppointBill.CurrentRowIndex, 9].ToString() == "1") //完成预定
            {
                frmnab.Label13.Text = "完成";
            }
            else//预定中
            {
                frmnab.Label13.ForeColor = Color.Red;
                frmnab.Label13.Text = "预订中";
            }

            frmnab.CreateSelectedTables();
            frmnab.CreateSelectedFoods();
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
            conn.ConnectionString = rms_var.ConnStr;
            try
            {
                //获取预订的桌台
                SqlCommand selectCMD = new SqlCommand();
                selectCMD.Connection = conn;
                selectCMD.CommandTimeout = 30;
                selectCMD.CommandText = "select name,tableno,tablename,peoplenumber from view_AppointTable where appointno='" + dgAppointBill[dgAppointBill.CurrentRowIndex, 0].ToString() + "'";
                SqlDataAdapter dbDA = new SqlDataAdapter();
                dbDA.SelectCommand = selectCMD;
                conn.Open();
                DataSet dbDS = new DataSet();
                dbDA.Fill(dbDS, "t1");
                for (int i = 0; i <= dbDS.Tables[0].Rows.Count - 1; i++)
                {
                    frmnab.AddTable(dbDS.Tables[0].Rows[i][0].ToString(),dbDS.Tables[0].Rows[i][1].ToString(),dbDS.Tables[0].Rows[i][2].ToString(),dbDS.Tables[0].Rows[i][3].ToString());
                }

                //获取预订的菜品
                selectCMD.CommandText = "select foodcode,foodname,unit,quantity,price,oprandi,taste from view_AppointFood where appointno='" + dgAppointBill[dgAppointBill.CurrentRowIndex, 0].ToString() + "'";
                dbDA.Fill(dbDS, "t2");
                for (int i = 0; i <= dbDS.Tables[1].Rows.Count - 1; i++)
                {
                    frmnab.AddFood(dbDS.Tables[1].Rows[i][0].ToString(),dbDS.Tables[1].Rows[i][1].ToString(),dbDS.Tables[1].Rows[i][2].ToString(),dbDS.Tables[1].Rows[i][3].ToString(),dbDS.Tables[1].Rows[i][4].ToString(), dbDS.Tables[1].Rows[i][5].ToString(),dbDS.Tables[1].Rows[i][6].ToString());
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }

            frmnab.ShowDialog();
            if (frmnab.DialogResult == DialogResult.OK)
            {
                LoadAppointBill(DateTimePicker1.Value.ToShortDateString(), DateTimePicker2.Value.ToShortDateString(), ComboBox1.Text, ComboBox2.Text);
            }
        }