Exemplo n.º 1
0
        public string GetHistoryByPostID(int PostID)
        {
            string temp = string.Empty;
            try
            {
                Coe25DBDataContext db = new Coe25DBDataContext();
                List<tbl_History> history = (from m in db.tbl_Histories
                                             where m.PostID == PostID &&
                                                   m.IsFixed == false
                                             select m).ToList();
                db.Dispose();
                history.ForEach(delegate(tbl_History indexHistory)
                {
                    temp += "Post Id: " + indexHistory.PostID.ToString() + Environment.NewLine;
                    temp += "Date of triggered event: " + indexHistory.CreateDate + Environment.NewLine + Environment.NewLine;

                });

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return temp;
        }
Exemplo n.º 2
0
 public string getUniqueID()
 {
     Random rand = new Random();
     string temp = string.Empty;
     string UniqueID = string.Empty;
     bool running = true;
     try
     {
         Coe25DBDataContext db = new Coe25DBDataContext();
         while (running)
         {
             temp = rand.Next(0, 9).ToString();
             if (!string.IsNullOrEmpty(temp))
             {
                 UniqueID = UniqueID + temp;
             }
             if (UniqueID.Length == 5)
             {
                 var dbChecker = (from m in db.tbl_Clusters
                                  where m.UniqueCode == UniqueID
                                  select m).FirstOrDefault();
                 if (dbChecker != null)
                 {
                     UniqueID = string.Empty;
                 }
                 else
                 {
                     running = false;
                     break;
                 }
             }
         }
         db.Dispose();
     }
     catch (Exception)
     {
         throw;
     }
     return UniqueID;
 }
Exemplo n.º 3
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         tbl_Cluster cluster = new tbl_Cluster();
         cluster.UniqueCode = this.textBox2.Text;
         cluster.ClusterPhoneNumber = this.textBox1.Text;
         cluster.CreateDate = DateTime.UtcNow;
         Coe25DBDataContext db = new Coe25DBDataContext();
         db.tbl_Clusters.InsertOnSubmit(cluster);
         db.SubmitChanges();
         db.Dispose();
         CreateNewCluster = cluster.UniqueCode;
         this.Close();
     }
     catch { }
 }