private void initConfig() { nl = new NumberLimit(); nl.Active = "num_limit_active"; nl.dateCancel = "date_cancel"; nl.dateCreate = "date_create"; nl.dateModi = "date_modi"; nl.dateStart = "date_start"; nl.Id = "num_limit_id"; nl.monthId = "month_id"; nl.number = "number1"; nl.periodId = "period1"; nl.remark = "num_limit_remark"; nl.staffCancel = "staff_cancel"; nl.staffCreate = "staff_create"; nl.staffModi = "staff_modi"; nl.StatusStart = "status_start"; nl.yearId = "year_id"; nl.yearLimitId = "year_limit_id"; nl.monthLimitId = "month_limit_id"; nl.periodLimitId = "period1_limit"; nl.dateEnd = "date_end"; nl.table = "t_number_limit"; nl.pkField = "num_limit_id"; }
private void btn_Save_Click(object sender, EventArgs e) { try { int limitnumber = (int)ud_LimitValue.Value; if (!IsLimitNumberExist(limitnumber)) { NumberLimit m_numberlimit = new NumberLimit() { LimitNumber = limitnumber }; m_numberlimit.ID = DbHelper.Db.Insert <NumberLimit>(m_numberlimit); _m_NumberLimits.Add(m_numberlimit); dgv_LimitList.Rows.Add(limitnumber.ToString()); } else { MessageBox.Show(" " + limitnumber + " 重复添加限制编号。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } HideLimit(); } catch (Exception ex) { MessageBox.Show("错误内容:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static void Del(int index) { NumberLimit info = NumberInfos[index]; Dal_Limit.Del(info.Id); NumberInfos.RemoveAt(index); }
public void Test4() { var fileA = new BackupFile("/Users/egorius/Desktop/Homework/OOP/Labs/Lab4/Lab4/FileB.txt"); var fileB = new BackupFile("/Users/egorius/Desktop/Homework/OOP/Labs/Lab4/Lab4/FileA.txt"); var fileC = new BackupFile("/Users/egorius/Desktop/Homework/OOP/Labs/Lab4/Lab4/FileA.txt"); var backup = new Backup(new List <BackupFile>() { fileA }); // 1 files, Size 1 var nLim = new NumberLimit(3); var memLim = new MemoryLimit(6); backup.Add(fileB); backup.MakeFullRestorePoint(); // 2 files, Size 2 backup.Add(fileC); backup.MakeFullRestorePoint(); // 3 files, Size 3 Thread.Sleep(500); var tLim = new TimeLimit(DateTime.Now); Thread.Sleep(500); backup.MakeFullRestorePoint(); // 3 files, Size 3 // Backup: 3 files, 4 RestorePoint, total size 9 backup.AddLimit(nLim); backup.AddLimit(memLim); backup.AddLimit(tLim); backup.PushItToTheLimit(); Assert.AreEqual(3, backup.RestorePoints.Count); }
public static int Update(NumberLimit info) { using (SQLiteConnection conn = (SQLiteConnection)DapperHelper.GetInstance()) { string query = @" Update NumberLimit set LimitNumber = @LimitNumber where Id = @Id "; return(conn.Execute(query, info)); } }
public static int Add(NumberLimit info) { using (SQLiteConnection conn = (SQLiteConnection)DapperHelper.GetInstance()) { string query = @" Insert Into NumberLimit( LimitNumber ) values( @LimitNumber ) ; select last_insert_rowid() ;"; return(conn.Query <int>(query, info).SingleOrDefault()); } }
public NumberLimit selectByPk(String saleId) { NumberLimit item = new NumberLimit(); String sql = ""; DataTable dt = new DataTable(); sql = "Select * From " + nl.table + " Where " + nl.pkField + "='" + saleId + "'"; dt = conn.selectData(sql); if (dt.Rows.Count > 0) { item = setData(item, dt); } return(item); }
private static void Host_PostLimitNumberInfo(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e) { try { int index = e.Arguments[0].IntValue; NumberLimit info = LimitManager.NumberInfos[index]; string json = Utility.JsonSerializerBySingleData(info); e.SetReturnValue(json); } catch (Exception ex) { Log4Helper.ErrorInfo(ex.Message, ex); ViewCallFunction.ViewAlert(ex.Message); } }
public String insertNumberLimit(NumberLimit p) { NumberLimit item = new NumberLimit(); String chk = ""; item = selectByPk(p.Id); if (item.Id == "") { chk = insert(p); } else { chk = update(p); } return(chk); }
public List <NumberLimit> selectByNumberLimit() { List <NumberLimit> lnl = new List <NumberLimit>(); DataTable dt = nldb.selectAll(); for (int i = 0; i < dt.Rows.Count; i++) { NumberLimit nl = new NumberLimit(); nl.number = dt.Rows[i][nldb.nl.number].ToString(); nl.StatusStart = dt.Rows[i][nldb.nl.StatusStart].ToString(); nl.yearLimitId = dt.Rows[i][nldb.nl.yearLimitId].ToString(); nl.monthLimitId = dt.Rows[i][nldb.nl.monthLimitId].ToString(); nl.periodLimitId = dt.Rows[i][nldb.nl.periodLimitId].ToString(); //nl. = dt.Rows[i][nldb.nl.periodLimitId].ToString(); lnl.Add(nl); } return(lnl); }
public static bool Add(int number) { if (NumberInfos == null) { NumberInfos = new List <NumberLimit>(); } int count = NumberInfos.Where(e => e.LimitNumber == number).Count(); bool ret = count > 0; if (!ret) { NumberLimit info = new NumberLimit() { LimitNumber = number, }; info.Id = Dal_Limit.Add(info); NumberInfos.Add(info); } return(ret); }
private void setControl(String nlId) { nl = lc.nldb.selectByPk(nlId); txtInput.Text = nl.number; if (nl.StatusStart.Equals("1")) { setChkFalse(); chkImmediately.Checked = true; chkPeriod.Checked = false; } else if (nl.StatusStart.Equals("2")) { setChkTrue(); chkPeriod.Checked = true; chkPeriod.Checked = false; cboYear.Text = nl.yearLimitId; cboMonth.Text = lc.cf.getMonth(nl.monthLimitId); cboPeriod.Text = lc.cf.getPeriod(nl.periodLimitId); } else { setChkFalse(); chkImmediately.Checked = true; } txtNlId.Text = nl.Id; if (nl.Active.Equals("1") || nlId.Equals("")) { chkActive.Checked = true; ChkUnActive.Checked = false; btnUnActive.Visible = false; } else { chkActive.Checked = false; ChkUnActive.Checked = true; btnUnActive.Visible = true; } }
private NumberLimit setData(NumberLimit item, DataTable dt) { item.Active = dt.Rows[0][nl.Active].ToString(); item.dateCancel = dt.Rows[0][nl.dateCancel].ToString(); item.dateCreate = dt.Rows[0][nl.dateCreate].ToString(); item.dateModi = dt.Rows[0][nl.dateModi].ToString(); item.dateStart = dt.Rows[0][nl.dateStart].ToString(); item.Id = dt.Rows[0][nl.Id].ToString(); item.monthId = dt.Rows[0][nl.monthId].ToString(); item.number = dt.Rows[0][nl.number].ToString(); item.periodId = dt.Rows[0][nl.periodId].ToString(); item.remark = dt.Rows[0][nl.remark].ToString(); item.staffCancel = dt.Rows[0][nl.staffCancel].ToString(); item.staffModi = dt.Rows[0][nl.staffModi].ToString(); item.StatusStart = dt.Rows[0][nl.StatusStart].ToString(); item.yearId = dt.Rows[0][nl.yearId].ToString(); item.yearLimitId = dt.Rows[0][nl.yearLimitId].ToString(); item.monthLimitId = dt.Rows[0][nl.monthLimitId].ToString(); item.periodLimitId = dt.Rows[0][nl.periodLimitId].ToString(); item.dateEnd = dt.Rows[0][nl.dateEnd].ToString(); return(item); }
private String insert(NumberLimit p) { String sql = "", chk = ""; if (p.Id.Equals("")) { p.Id = p.getGenID(); } p.dateCreate = p.dateGenDB; p.remark = p.remark.Replace("''", "'"); //p.Remark = p.Remark.Replace("''", "'"); sql = "Insert Into " + nl.table + " (" + nl.pkField + "," + nl.Active + "," + nl.dateCancel + "," + nl.dateCreate + "," + nl.dateModi + "," + nl.dateStart + "," + nl.monthId + "," + nl.number + "," + nl.periodId + "," + nl.remark + "," + nl.staffCancel + "," + nl.staffModi + "," + nl.StatusStart + "," + nl.yearId + "," + nl.yearLimitId + "," + nl.monthLimitId + "," + nl.periodLimitId + "," + nl.dateEnd + ") " + "Values('" + p.Id + "','" + p.Active + "','" + p.dateCancel + "'," + p.dateCreate + ",'" + p.dateModi + "','" + p.dateStart + "','" + p.monthId + "','" + p.number + "','" + p.periodId + "','" + p.remark + "','" + p.staffCancel + "','" + p.staffModi + "','" + p.StatusStart + "','" + p.yearId + "','" + p.yearLimitId + "','" + p.monthLimitId + "','" + p.periodLimitId + "','" + p.dateEnd + "')"; try { chk = conn.ExecuteNonQuery(sql); chk = p.Id; } catch (Exception ex) { MessageBox.Show("Error " + ex.ToString(), "insert Customer"); } finally { } return(chk); }
private String update(NumberLimit p) { String sql = "", chk = ""; p.remark = p.remark.Replace("''", "'"); //p.saleName = p.saleName.Replace("''", "'"); p.dateModi = p.dateGenDB; sql = "Update " + nl.table + " Set " + nl.dateCancel + "='" + p.dateCancel + "', " + //nl.dateCreate + "='" + p.dateCreate + "', " + nl.dateModi + "=" + p.dateModi + ", " + //nl.dateStart + "='" + p.dateStart + "', " + nl.monthId + "='" + p.monthId + "', " + nl.number + "='" + p.number + "', " + nl.periodId + "='" + p.periodId + "', " + nl.remark + "='" + p.remark + "', " + //nl.staffCancel + "='" + p.staffCancel + "', " + //nl.staffModi + "='" + p.staffModi + "', " + //nl.StatusStart + "='" + p.StatusStart + "', " + nl.yearId + "='" + p.yearId + "', " + nl.yearLimitId + "='" + p.yearLimitId + "', " + nl.monthLimitId + "='" + p.monthLimitId + "', " + nl.periodLimitId + "='" + p.periodLimitId + "' " + "Where " + nl.pkField + "='" + p.Id + "'"; try { chk = conn.ExecuteNonQuery(sql); } catch (Exception ex) { MessageBox.Show("Error " + ex.ToString(), "update Customer"); } finally { } return(chk); }
private void initConfig() { iniFile = new IniFile(Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini"); initC = new InitConfig(); //regE = new RegEdit(); //MessageBox.Show("aaa " + Environment.CurrentDirectory + "\\" + Application.ProductName + ".ini", "LottoryControl StatusServer" + initC.StatusServer.ToLower()); GetConfig(); //MessageBox.Show("bbb", "LottoryControl"); cf = new Config1(); //MessageBox.Show("ccc", "LottoryControl"); conn = new ConnectDB(initC); ratedb = new RateDB(conn); saledb = new SaleDB(conn); sfdb = new StaffDB(conn); thodb = new ThooDB(conn); lotdb = new LottoDB(conn); rwdb = new RewardDB(conn); fldb = new FlockDB(conn); srdb = new SaleRateDB(conn); cudb = new CustomerDB(conn); imgdb = new ImageDB(conn); nldb = new NumberLimitDB(conn); //MessageBox.Show("ddd", "LottoryControl"); rate = new Rate(); sale = new Sale(); staff = new Staff(); tho = new Thoo(); lot = new Lotto(); rw = new Reward(); fl = new FLock(); sr = new SaleRate(); cu = new Customer(); img = new Image1(); nl = new NumberLimit(); r2Down = new Rate(); r2Tod = new Rate(); r2Up = new Rate(); r3Up = new Rate(); r3Tod = new Rate(); r3Down = new Rate(); rUp = new Rate(); rDown = new Rate(); //MessageBox.Show("bbb", "LottoryControl"); rUp = ratedb.selectByPk("up"); rDown = ratedb.selectByPk("down"); r3Up = ratedb.selectByPk("3up"); r3Tod = ratedb.selectByPk("3tod"); r3Down = ratedb.selectByPk("3down"); r2Down = ratedb.selectByPk("2down"); r2Up = ratedb.selectByPk("2up"); lTho = thodb.setData(); setThoColor(); lsr = srdb.selectSRAll(); ls = saledb.selectSAll(); lnl = selectByNumberLimit(); //cboThoo = new ComboBox(); cbosf = new ComboBox(); //cboSale = new ComboBox(); //cboThoo = thodb.getCboThoo(cboThoo); cbosf = sfdb.getCboStaff(cbosf); //cboSale = saledb.getCboSale(cboSale); }
public static int Update(NumberLimit info) { return(Dal_Limit.Update(info)); }