void Create() { LimitC lc = new LimitC(); if (lc.Count == 0) { lc = new LimitC(); lc.Insert(new Limit() { Current_Date = lc.DateNow(), Date_End = lc.DatePeroidTime(), Date_Start = lc.DateNow() }); } else { lc = new LimitC(); lc.Update(new Limit() { Current_Date = lc.DateNow(), }); foreach (object obj in lc.GetRecord()) { Limit li = (Limit)obj; long trie = lc.GetTotalDay(new Limit() { Current_Date = li.Current_Date, Date_End = li.Date_End, Date_Start = li.Date_Start } ); if (trie > 0) { this.DialogResult = DialogResult.OK; username = user.Text; } else { lc = new LimitC(); lc.KillApp(new Limit() { Date_End = lc.DateKiller(), }); MessageBox.Show("30-Day Trial Version Finished !. Please Contact With Abdulaziz For More Information"); this.DialogResult = DialogResult.None; username = user.Text; } } } }
public void getAll(string sort) { lsv.Items.Clear(); EpisodeC episodes = new EpisodeC(); int c = 1; int lx = 0; foreach (Episode eps in episodes.GetEpisodeWithLimitStore(_query, sort)) { StoreC stores = new StoreC(); ListViewItem t = new ListViewItem(eps.Id.ToString()); t.SubItems.Add(c.ToString()); t.SubItems.Add(eps.Batch); try { ItemC items = new ItemC(); Item item = items.GetOneItem(eps.Item_id.ToString()); t.SubItems.Add(item.Name + "," + item.Size); t.SubItems.Add(item.Type.ToUpper()); } catch (Exception) { t.SubItems.Add("NULL"); Debug.WriteLine("Item table is null getall method in mainform.class"); } LimitC setdate = new LimitC(); t.SubItems.Add(setdate.SetDateWithoutDay(eps.Expdate)); t.SubItems.Add(stores.GetOneStore(new Store() { Id = eps.Stoke_id }).Name); t.SubItems.Add(eps.Amount.ToString() + eps.AmountType); // // notes for medicine string itemNote = ""; if (eps.Notes.Equals("")) { itemNote = getTimeline(eps.Expdate); } else { itemNote = getTimeline(eps.Expdate) + " *"; } t.SubItems.Add(itemNote); lsv.Items.Add(t); lsv.Items[lx].UseItemStyleForSubItems = false; if (setColor == Dates.EXP) { lsv.Items[lx].SubItems[8].BackColor = Color.Red; } if (setColor == Dates.NEAR) { lsv.Items[lx].SubItems[8].BackColor = Color.Orange; } if (setColor == Dates.ATTENTION) { lsv.Items[lx].SubItems[8].BackColor = Color.LightGreen; } if (setColor == Dates.SAFF) { lsv.Items[lx].SubItems[8].BackColor = Color.LightSalmon; } if (setColor == Dates.LONG) { lsv.Items[lx].SubItems[8].BackColor = Color.White; } c++; lx++; } c = 1; }