示例#1
0
 public void DoWork()
 {
     for (;;)
     {
         Thread.Sleep(30000);
         if (Work.KiemTraTienDo(idpost, taikhoan) == false)
         {
             MessageBox.Show("Đã bình luận xong với bài viết có id= " + idpost);
             //load lại csdl
             try
             {
                 getreload();
             }
             catch { }
             break;
         }
         //làm công tác bình luận
         string idaccountbl = WorkAccount.LayIDBinhLuan(idpost, taikhoan);
         // đăng xuất
         ThuVienLamViecFacebook.DangXuat();
         DataTable dtac = AccountFB.LoadDuLieuByID(idaccountbl);
         //đăng nhập và lấy fb-dtsg
         string fb_dtsg        = ThuVienLamViecFacebook.DNLay_fb_dtsg(dtac.Rows[0]["Email"].ToString(), dtac.Rows[0]["Password"].ToString());
         string noidungcomment = WorkComment.LayNoiDungComment(idpost, taikhoan);
         // bắt đầu bình luận
         ThuVienLamViecFacebook.BinhLuan(idpost, noidungcomment, idaccountbl, fb_dtsg);
         //thay đổi trạng thái của hoạt động
         //lưu thông tin vào worked
         tblWorked wd = new tblWorked();
         wd.IDPost      = idpost;
         wd.IDAccoutFB  = idaccountbl;
         wd.NoiDung     = noidungcomment;
         wd.TaiKhoan    = taikhoan;
         wd.TimeComment = DateTime.Now;
         Worked.Them(wd);
         //kết thúc lưu thông tin vào worked
         Work.updatetiendo(idpost, taikhoan);
         try
         {
             getreload();
         }
         catch { }
         Thread.Sleep(int.Parse(time.ToString()) * 60000);
     }
 }
示例#2
0
                static void Main(string[] args)
                {
                    Human hourse = new Human();

                    hourse.FurstName = "Иван";
                    hourse.LastName  = "Иванов";
                    hourse.GetUserInfo(hourse.FurstName, hourse.LastName);

                    Student ocenka = new Student();

                    ocenka.Ocenka = 6;
                    ocenka.GetOcenka();

                    Worked w = new Worked();

                    w.Nadnik       = 10;
                    w.WorkedHourse = 8;
                    w.GetWorked();
                }
示例#3
0
 /// <summary>
 /// Start Working
 /// start his job
 /// </summary>
 public void StartWorking()
 {
     if (!_starting)
     {
         lock (_locked)
         {
             if (_job == null)
             {
                 throw new WokerException();
             }
             _starting = true;
             for (int i = 0; i < _job.Count; i++)
             {
                 var result = _job[i].Invoke();
                 Worked?.Invoke(this, result, null);
             }
             _starting = false;
         }
     }
 }
示例#4
0
        private void LoadChart()
        {
            chartControl1.Series.Clear();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dlchart = Worked.LoadDuLieuByNam(dt.Rows[i]["Tài khoản"].ToString(), DateTime.Now.Year.ToString());
                Series    series1 = new Series(dt.Rows[i]["Tài khoản"].ToString(), ViewType.Line);
                // Add points to it.
                for (int j = 0; j < dlchart.Rows.Count; j++)
                {
                    series1.Points.Add(new SeriesPoint(dlchart.Rows[j]["Thang"], dlchart.Rows[j]["SoLuong"]));
                }

                // Add the series to the chart.
                chartControl1.Series.Add(series1);

                // Access the view-type-specific options of the series.
                ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
                ((LineSeriesView)series1.View).LineStyle.DashStyle    = DashStyle.DashDotDot;
            }

            // Access the type-specific options of the diagram.
            ((XYDiagram)chartControl1.Diagram).EnableAxisXZooming = true;
            XYDiagram diagram = (XYDiagram)chartControl1.Diagram;

            diagram.AxisX.Color = Color.Green;
            diagram.AxisY.Color = Color.Red;

            AxisX axisX = diagram.AxisX;

            //// Add a custom label to the X-axis.
            //axisX.CustomLabels.Add(new CustomAxisLabel(name: "Tháng 7", value: "7")
            //{
            //    TextColor = Color.FromArgb(255, 74, 74, 74),
            //});

            // Add a title to the chart (if necessary).
            chartControl1.Titles.Add(new ChartTitle());
            chartControl1.Titles[0].Text = "Thống kê nhân viên";
        }
示例#5
0
        public void createListView()
        {
            DateTime weekStartDT = DateTime.Now.AddDays(-(DayOfWeek - 1));
            DateTime weekEndDT   = DateTime.Now.AddDays((7 - DayOfWeek));


            this.Worked = new List <DaysWorked>();
            int cont = 0;

            for (DateTime i = weekStartDT; i <= weekEndDT; i = i.AddDays(1))
            {
                string   upDownD = "ic_thumb_down_outline_grey600_18dp.png";
                TimeSpan timeSpan;
                cont += 1;
                double worked = HoursPerDay(i.DayOfYear.ToString(), i.Year.ToString());
                timeSpan = TimeSpan.FromHours(worked);
                int p = (int)i.DayOfWeek;

                if ((DaysNum > 0) && (HoursNum > 0))
                {
                    TimeSpan ReqTimeSpan = TimeSpan.FromHours(HoursNum / DaysNum);

                    if (timeSpan >= ReqTimeSpan)
                    {
                        upDownD = "ic_thumb_up_outline_grey600_18dp.png";
                    }
                }

                Worked.Add(new DaysWorked
                {
                    WeekDay      = p.ToString(),
                    DayName      = DaysName[(cont - 1)],
                    WorkedHours  = timeSpan.ToString(),
                    Year         = i.Year.ToString(),
                    YearDay      = i.DayOfYear.ToString(),
                    MonthDay     = i.Day.ToString(),
                    WorkedUpDown = upDownD
                });
            }
        }
示例#6
0
        private void btnLocKQ_Click(object sender, EventArgs e)
        {
            chartControl1.Series.Clear();
            DataTable dt = Admin.LoadDuLieuNhanVien();

            if (DrbtnNhanVien.selectedIndex == 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataTable dlchart;
                    if (DrbtnThang.selectedIndex == 0)
                    {
                        dlchart = Worked.LoadDuLieuByNam(dt.Rows[i]["Tài khoản"].ToString(), nam[DrbtnLoaiTim.selectedIndex]);
                        Series series1 = new Series(dt.Rows[i]["Tài khoản"].ToString(), ViewType.Line);
                        // Add points to it.
                        for (int j = 0; j < dlchart.Rows.Count; j++)
                        {
                            series1.Points.Add(new SeriesPoint(dlchart.Rows[j]["Thang"], dlchart.Rows[j]["SoLuong"]));
                        }

                        // Add the series to the chart.
                        chartControl1.Series.Add(series1);

                        // Access the view-type-specific options of the series.
                        ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
                        ((LineSeriesView)series1.View).LineStyle.DashStyle    = DashStyle.DashDotDot;
                    }
                    else
                    {
                        dlchart = Worked.LoadDuLieuByThang(dt.Rows[i]["Tài khoản"].ToString(), nam[DrbtnLoaiTim.selectedIndex], DrbtnThang.selectedIndex.ToString());
                        Series series1 = new Series(dt.Rows[i]["Tài khoản"].ToString(), ViewType.Line);
                        // Add points to it.
                        for (int j = 0; j < dlchart.Rows.Count; j++)
                        {
                            series1.Points.Add(new SeriesPoint(dlchart.Rows[j]["Ngay"], dlchart.Rows[j]["SoLuong"]));
                        }

                        // Add the series to the chart.
                        chartControl1.Series.Add(series1);

                        // Access the view-type-specific options of the series.
                        ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
                        ((LineSeriesView)series1.View).LineStyle.DashStyle    = DashStyle.DashDotDot;
                    }
                }
            }
            else
            {
                DataTable dlchart;
                if (DrbtnThang.selectedIndex == 0)
                {
                    dlchart = Worked.LoadDuLieuByNam(dt.Rows[DrbtnNhanVien.selectedIndex - 1]["Tài khoản"].ToString(), nam[DrbtnLoaiTim.selectedIndex]);
                    Series series1 = new Series(dt.Rows[DrbtnNhanVien.selectedIndex - 1]["Tài khoản"].ToString(), ViewType.Line);
                    // Add points to it.
                    for (int j = 0; j < dlchart.Rows.Count; j++)
                    {
                        series1.Points.Add(new SeriesPoint(dlchart.Rows[j]["Thang"], dlchart.Rows[j]["SoLuong"]));
                    }

                    // Add the series to the chart.
                    chartControl1.Series.Add(series1);

                    // Access the view-type-specific options of the series.
                    ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
                    ((LineSeriesView)series1.View).LineStyle.DashStyle    = DashStyle.DashDotDot;
                }
                else
                {
                    dlchart = Worked.LoadDuLieuByThang(dt.Rows[DrbtnNhanVien.selectedIndex - 1]["Tài khoản"].ToString(), nam[DrbtnLoaiTim.selectedIndex], DrbtnThang.selectedIndex.ToString());
                    Series series1 = new Series(dt.Rows[DrbtnNhanVien.selectedIndex - 1]["Tài khoản"].ToString(), ViewType.Line);
                    // Add points to it.
                    for (int j = 0; j < dlchart.Rows.Count; j++)
                    {
                        series1.Points.Add(new SeriesPoint(dlchart.Rows[j]["Ngay"], dlchart.Rows[j]["SoLuong"]));
                    }

                    // Add the series to the chart.
                    chartControl1.Series.Add(series1);

                    // Access the view-type-specific options of the series.
                    ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Triangle;
                    ((LineSeriesView)series1.View).LineStyle.DashStyle    = DashStyle.DashDotDot;
                }
            }
        }