コード例 #1
0
        public static void recordTran(string item, int amt)
        {
            MakerspaceDataDataContext db = new MakerspaceDataDataContext();
            Tran trans = new Tran {
                UNI = App.UNI, amount = amt, ItemName = item, date = DateTime.Now, Id = System.Guid.NewGuid()
            };

            db.Trans.InsertOnSubmit(trans);
            try { db.SubmitChanges(); }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #2
0
        public static void subtractFromInventory(string item, int amtTaken)
        {
            MakerspaceDataDataContext db = new MakerspaceDataDataContext();
            var inv = from e in db.Inventories
                      where e.ItemID == item
                      select e;

            foreach (var i in inv)
            {
                i.AmountInStock = i.AmountInStock - amtTaken;
                MessageBox.Show(i.AmountInStock.ToString());
//===========================================================================
                if (i.AmountInStock < 0)
                {
                    System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                    foreach (string email in adminsEmails)
                    {
                        mail.To.Add(email);
                    }
                    ;
                    mail.From = new System.Net.Mail.MailAddress("*****@*****.**");

                    mail.Subject = "We have run out of " + i.ItemID + " -> this note was auto-generated by the Makerspace app as a TEST";
                    mail.Body    = " last transaction info-> UNI:" + App.UNI + "AmountTaken:" + amtTaken + "Time:" + DateTime.Now;
                    System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient();
                    SmtpServer.Port        = 587;
                    SmtpServer.Credentials = new System.Net.NetworkCredential("jonathanbarrios81", "******");
                    SmtpServer.EnableSsl   = true;
                    SmtpServer.Host        = "smtp.gmail.com";
                    SmtpServer.Send(mail);

                    //client.Send(mail);
//================================================================================
                }//=============
            }


            //--------------------------------------------------------------------------------
            //========================================================================================*/
            try
            {
                //MessageBox.Show("hi");
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: Cocotus/SC
        public static void subtractFromInventory(string item,int amtTaken )
        {
            MakerspaceDataDataContext db = new MakerspaceDataDataContext();
            var inv = from e in db.Inventories
                      where e.ItemID == item
                      select e;

            foreach (var i in inv)
            {
                i.AmountInStock = i.AmountInStock - amtTaken;
                MessageBox.Show(i.AmountInStock.ToString());
            //===========================================================================
                if (i.AmountInStock < 0)
                {
                    System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                    foreach (string email in adminsEmails)
                    {
                        mail.To.Add(email);
                    };
                    mail.From = new System.Net.Mail.MailAddress("*****@*****.**");

                    mail.Subject = "We have run out of " + i.ItemID+" -> this note was auto-generated by the Makerspace app as a TEST";
                    mail.Body = " last transaction info-> UNI:" + App.UNI + "AmountTaken:" + amtTaken + "Time:" + DateTime.Now;
                    System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient();
                    SmtpServer.Port = 587;
                    SmtpServer.Credentials = new System.Net.NetworkCredential("jonathanbarrios81", "******");
                    SmtpServer.EnableSsl = true;
                    SmtpServer.Host = "smtp.gmail.com";
                    SmtpServer.Send(mail);

                    //client.Send(mail);
            //================================================================================
                }//=============
            }

             //--------------------------------------------------------------------------------
            //========================================================================================*/
            try
            {
                //MessageBox.Show("hi");
                db.SubmitChanges();

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());

            }
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: Cocotus/SC
 public static void recordTran(string item, int amt)
 {
     MakerspaceDataDataContext db = new MakerspaceDataDataContext();
     Tran trans = new Tran { UNI = App.UNI, amount = amt, ItemName = item, date = DateTime.Now, Id = System.Guid.NewGuid() };
     db.Trans.InsertOnSubmit(trans);
     try { db.SubmitChanges(); }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }