public bool IsUniqueRate(Rate rate)
 {
     DataRow[] rateRow = ticketsDataSet.Rate.Select("[rrate_name] ='" + rate.Name.ToString() + "'");
     if (rateRow.Length > 0)
         return false;
     return true;
 }
 bool IsUsedRate(Rate rate)
 {
     DataRow[] ratesUsedInTicketRows = ticketsDataSet.Ticket.Select("[trate_id] ='" + rate.ID.ToString() + "'");
     if (ratesUsedInTicketRows.Length > 0)
         return false;
     return true;
 }
Esempio n. 3
0
 private void DeleteRate_btn_Click(object sender, EventArgs e)
 {
     string name = DeleteRateName_cmbbox.Text.Trim();
     if (name != String.Empty)
     {
         deletedRate = new Rate(getRateId(), name);
         DialogResult = DialogResult.OK;
         return;
     }
     else
         MessageBox.Show("Спершу введіть значення кількості, яку бажаєте видалити");
 }
Esempio n. 4
0
 private void AddRate_btn_Click(object sender, EventArgs e)
 {
     string name = NewRateValue_txtbox.Text.Trim();
     if (name != String.Empty)
     {
         newRate = new Rate(name);
         DialogResult = DialogResult.OK;
         return;
     }
     else
         MessageBox.Show("Спершу введіть якесь значення ціни");
 }
 public bool AddRate(Common.Rate rate)
 {
     bool canAdd = IsUniqueRate(rate);
     if (canAdd)
     {
         Rate rateDB = new Rate();
         rateDB.rrate_name = rate.Name;
         dataBase.Rate.Add(rateDB);
         return true;
     }
     return false;
 }
 public bool DeleteRate(Rate rate)
 {
     bool canDeleteRate = IsUsedRate(rate);
     if (canDeleteRate)
     {
         Tr_Tick_DBDataSet.RateRow row = ticketsDataSet.Rate.FindByrrate_id(rate.ID);
         row.Delete();
         //ticketsDataSet.Price.RemovePriceRow(row);
         provider.UpdateAllData();
         return true;
     }
     return false;
 }
 List<Rate> GetRestPartsOfRate(DataRowCollection searchedRows)
 {
     if (searchedRows == null || searchedRows.Count == 0)
         return null;
     List<Rate> Rate = new List<Rate>();
     foreach (Tr_Tick_DBDataSet.RateRow rateRow in searchedRows)
     {
         Rate rate = new Rate();
         rate.ID = rateRow.rrate_id;
         rate.Name = rateRow.rrate_name;
         Rate.Add(rate);
     }
     return Rate;
 }
 public List<Common.Rate> GetAllRates()
 {
     if (dataBase.Rate == null)
         return null;
     List<Common.Rate> Rate = new List<Common.Rate>();
     foreach(var currRate in dataBase.Rate)
     {
         Common.Rate rate = new Common.Rate();
         rate.ID = currRate.rrate_id;
         rate.Name = currRate.rrate_name;
         Rate.Add(rate);
     }
     return Rate;
 }
 public bool AddRate(Rate rate)
 {
     bool canAdd = IsUniqueRate(rate);
     if (canAdd)
     {
         ticketsDataSet.Rate.AddRateRow(rate.Name);
         provider.UpdateAllData();
         /*List<Rate> rateList = new List<Rate>();
         DataRow[] rateRow = ticketsDataSet.Rate.Select("[rrate_name] ='" + rate.Name.ToString() + "'");
         foreach(DataRow tmpRate in rateRow)
         {
             rateList.Add(new Rate(Int32.Parse(tmpRate["rrate_id"].ToString()), tmpRate["rrate_name"].ToString()));
         }
         rate.ID = rateList[0].ID;*/
         return true;
     }
     return false;
 }
Esempio n. 10
0
 public void EnableSquareWave(Rate rate)
 {
     var value = (byte)((byte)rate | 0x10);
     WriteRam(ControlAddr, value);
 }