Example #1
0
 public static TabInfo ToTabInfo(DataRow row)
 {
     TabInfo tab = new TabInfo();
     tab.billkey = (string)row["billkey"];
     tab.checkTime = (string)row["checkTime"];
     tab.createTime = (string)row["createTime"];
     tab.custCount = (int)(row["custCount"]);
     tab.envName = (string)row["envName"];
     tab.startTime = (string)row["startTime"];
     tab.status = (string)row["status"];
     tab.tabName = (string)row["tabName"];
     tab.id = (int)row["id"];
     return tab;
 }
Example #2
0
 public static void AddTabInfo(TabInfo tab)
 {
     string sql = "INSERT INTO `yooga`.`TabInfo`(`tabName`,`envName`,`status`,`createTime`,`startTime`,`checkTime`,`billkey`,`custCount`) VALUES (@tabName,@envName,@status,@createTime,@startTime,@checkTime,@billkey,@custCount)";
     try
     {
         DbUtil.ExecuteNonQuery(sql,
             new MySqlParameter("@tabName", tab.tabName),
             new MySqlParameter("@envName", tab.envName),
             new MySqlParameter("@status", tab.status),
             new MySqlParameter("@createTime", tab.createTime),
             new MySqlParameter("@startTime", tab.startTime),
             new MySqlParameter("@checkTime", tab.checkTime),
             new MySqlParameter("@billkey", tab.billkey),
             new MySqlParameter("@custCount", tab.custCount));
     }
     catch (Exception ex)
     {
         throw new Exception("新增失败" + ex.Message);
     }
 }
Example #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     string envName = cbEnv.Text.Trim();
     string tabName = tbTabName.Text.Trim();
     if (tabName == "" || envName == "")
     {
         MessageBox.Show("餐桌名称和餐桌环境不能为空");
     }
     else
     {
         TabInfo tab = new TabInfo();
         tab.billkey = "";
         tab.checkTime = "";
         tab.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         tab.custCount = 0;
         tab.envName = envName;
         tab.startTime = "";
         tab.status = "空闲";
         tab.tabName = tabName;
         TabInfoService.AddTabInfo(tab);
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
 }