コード例 #1
0
ファイル: frm_main.cs プロジェクト: toannd18/VCCS
        private async void frm_main_Load(object sender, EventArgs e)
        {
            this.lb_time.Text = DateTime.Now.ToString("hh:mm:ss");
            System.Timers.Timer _clocktime = new System.Timers.Timer();
            _clocktime.Interval = 1000;
            _clocktime.Elapsed += Timer_Elapse;
            _clocktime.Start();

            _mediaManager = new MediaManager(this);

            _musicOnHold = new MusicOnHold();
            tbl_panel_hotline.Controls.Clear();
            for (var i = 0; i < 16; i++)
            {
                HotLine hotLine = new HotLine();
                hotLine.LblHotLine = i.ToString();
                hotLine.LblSDT     = $"0{i}";
                var d = i / 4;
                var r = i % 4;
                if (d < 1)
                {
                    tbl_panel_hotline.Controls.Add(hotLine, i, 0);
                    hotLine.Dock = DockStyle.Fill;
                }
                if (d < 2 & d >= 1)
                {
                    r = r > 0 ? r : 0;
                    tbl_panel_hotline.Controls.Add(hotLine, r, 1);
                    hotLine.Dock = DockStyle.Fill;
                }
                if (d < 3 & d >= 2)
                {
                    r = r > 0 ? r : 0;
                    tbl_panel_hotline.Controls.Add(hotLine, r, 2);
                    hotLine.Dock = DockStyle.Fill;
                }
                if (d < 4 & d >= 3)
                {
                    r = r > 0 ? r : 0;
                    tbl_panel_hotline.Controls.Add(hotLine, r, 3);
                    hotLine.Dock = DockStyle.Fill;
                }
            }
            await Initialize();
        }
コード例 #2
0
 public ActionResult EditHotline(HotLine line, bool type = false)
 {
     try
     {
         using (var context = new WebsiteDBEntities())
         {
             line.LineType = type ? "Skype" : "Yahoo";
             context.HotLines.Attach(line);
             context.Entry(line).State = EntityState.Modified;
             context.SaveChanges();
             ViewBag.SaveMessage = "Thông tin đã được lưu thành công.";
         }
     }
     catch (Exception ex)
     {
         ViewBag.SaveMessage = ex.Message;
     }
     return(View(line));
 }
コード例 #3
0
 public ActionResult AddHotline(HotLine line, bool type = false)
 {
     try
     {
         using (var context = new WebsiteDBEntities())
         {
             line.LineType = type ? "Skype" : "Yahoo";
             context.HotLines.Add(line);
             context.SaveChanges();
             ViewBag.SaveMessage = "Thông tin đã được lưu thành công.";
             return(View(new HotLine()));
         }
     }
     catch (Exception ex)
     {
         ViewBag.SaveMessage = ex.Message;
         return(View(line));
     }
 }