示例#1
0
        private void bgk_loaddata_DoWork(object sender, DoWorkEventArgs e)
        {
            Action action = () => txt_progress.Text = string.Empty;

            txt_progress.Invoke(action);

            action = () => txt_progress.Text = DateTime.Now.ToString("H:mm:ss") + " เริ่มค้นหาข้อมูล \r\n" + txt_progress.Text;
            txt_progress.Invoke(action);

            try
            {
                using (mac5Entities db = new mac5Entities())
                {
                    invList = db.V_MIH_ISERVICE_LINK.Where(a => a.MIHdate >= dpk_from.Value && a.MIHdate <= dpk_to.Value).ToList();
                    if (invList.Count > 0)
                    {
                        action = () => txt_progress.Text = DateTime.Now.ToString("H:mm:ss") + " พบข้อมูล " + invList.Count + " รายการ \r\n" + txt_progress.Text;
                        txt_progress.Invoke(action);
                        e.Result = invList.Count;
                    }
                    else
                    {
                        action = () => txt_progress.Text = DateTime.Now.ToString("H:mm:ss") + " ไม่พบข้อมูล  \r\n" + txt_progress.Text;
                        txt_progress.Invoke(action);

                        e.Result = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
 public static IEnumerable <V_MIL_ISERVICE_LINK> getListInvoiceFromMac5(String invcode)
 {
     using (mac5Entities db = new mac5Entities())
     {
         try
         {
             var ls = db.V_MIL_ISERVICE_LINK.Where(a => a.MILvnos == invcode).ToList();
             return(ls);
         }
         catch (Exception ex)
         {
             Console.WriteLine(DateTime.Now.ToString("H:mm:ss") + " " + ex.Message.ToString());
             return(new List <V_MIL_ISERVICE_LINK>());
         }
     }
 }