private async void UserLoaiTruyen_Load(object sender, EventArgs e) { var tong = ExecSQL.ExecQuerySacalar("SELECT COUNT(DISTINCT matruyen) AS tong FROM dbo.tbl_ct_phieunhapxuat WHERE slnhap>0"); Text = @"Loại truyện: " + tong + @" cuốn"; var chartControl1 = new ChartControl(); chartControl1.Dock = DockStyle.Fill; panelControl.Controls.Add(chartControl1); var dataTable = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tongso_loaitruyen"); await Task.Factory.StartNew(new Action(() => { chartControl1.DataSource = dataTable; chartControl1.BeginInvoke(new Action(() => { Series seriesloaitruyen = new Series("Loại truyện", ViewType.Bar); seriesloaitruyen.LabelsVisibility = DefaultBoolean.True; // Add points to them, with their arguments different. foreach (DataRow dr in dataTable.Rows) { seriesloaitruyen.Points.Add(new SeriesPoint(dr["loaitruyen"], dr["soluong"])); } chartControl1.Series.AddRange(new Series[] { seriesloaitruyen }); chartControl1.Legend.Visibility = DefaultBoolean.True; Legend legend = chartControl1.Legend; legend.Margins.All = 8; legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right; legend.AlignmentVertical = LegendAlignmentVertical.Top; legend.Direction = LegendDirection.LeftToRight; })); })); }
public async void GetLayout(string matua) { string strDuongDan = Application.StartupPath + "\\img\\origin\\"; DataTable dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tonkho", new { option = 3, thang = Convert.ToDateTime(txt_tungay.EditValue).Month, nam = Convert.ToDateTime(txt_tungay.EditValue).Year, duongdanhinh = strDuongDan, matua }); BindingList <PictureObject> list = new BindingList <PictureObject>(); PictureObject item; object b = new object(); await System.Threading.Tasks.Task.Factory.StartNew(() => { foreach (DataRow drow in dt.Rows) { lock (b) { BeginInvoke(new Action(() => { if (File.Exists(drow["hinhanh"].ToString())) { item = new PictureObject(drow["tentruyen"].ToString(), Image.FromFile(drow["hinhanh"].ToString()), drow["tuatruyen"].ToString()); } else { item = new PictureObject(drow["tentruyen"].ToString(), Image.FromFile(strDuongDan + "no-image.png"), drow["tuatruyen"].ToString()); } list.Add(item); })); } } }); dgv_Layout.DataSource = list; }
public async void GetLayout() { string strDuongDan = Application.StartupPath + @"/img/origin/"; DataTable dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tuatruyen_hinhanh", new { duongdanhinh = strDuongDan }); BindingList <PictureObject> list = new BindingList <PictureObject>(); PictureObject item; object b = new object(); //await Task.Factory.StartNew(() => // { foreach (DataRow drow in dt.Rows) { lock (b) { BeginInvoke(new Action(() => { if (File.Exists(drow["hinhanh"].ToString())) { item = new PictureObject(Image.FromFile(drow["hinhanh"].ToString()), drow["tentruyen"].ToString(), drow["tuatruyen"].ToString()); // item = new PictureObject(drow["hinhanh"].ToString(), drow["tentruyen"].ToString(), drow["tuatruyen"].ToString()); } else { item = new PictureObject(Image.FromFile(strDuongDan + "no-image.png"), drow["tentruyen"].ToString(), drow["tuatruyen"].ToString()); } list.Add(item); })); } } //}); gridControl1.DataSource = list; }
public async void GetCtPhieuXuat(string matruyen) { var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_ct_phieunhapxuat", new { option = 3, matruyen, thang = Convert.ToDateTime(txt_tungay.EditValue).Month, nam = Convert.ToDateTime(txt_tungay.EditValue).Year }); grcCTPhieuNhap.BeginInvoke(new Action(() => { grcCTPhieuXuat.DataSource = dt; })); }
private async void mnu_loaitruyen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var tong = ExecSQL.ExecQuerySacalar("SELECT COUNT(DISTINCT matruyen) AS tong FROM dbo.tbl_ct_phieunhapxuat WHERE slnhap>0"); if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Clear(); loaitruyen.Caption = @"Loại truyện: " + tong + @" cuốn";; } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Clear(); giatri.Caption = @"Loại truyện: " + tong + @" cuốn";; } var chartControl1 = new ChartControl(); chartControl1.Dock = DockStyle.Fill; var dataTable = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tongso_loaitruyen"); chartControl1.DataSource = dataTable; Series seriesloaitruyen = new Series("Loại truyện", ViewType.Bar); seriesloaitruyen.LabelsVisibility = DefaultBoolean.True; // Add points to them, with their arguments different. foreach (DataRow dr in dataTable.Rows) { seriesloaitruyen.Points.Add(new SeriesPoint(dr["loaitruyen"], dr["soluong"])); } chartControl1.Series.AddRange(new Series[] { seriesloaitruyen }); chartControl1.Legend.Visibility = DefaultBoolean.True; Legend legend = chartControl1.Legend; // chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.Center legend.Margins.All = 8; legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right; legend.AlignmentVertical = LegendAlignmentVertical.Top; legend.Direction = LegendDirection.LeftToRight; if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Add(chartControl1); } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Add(chartControl1); } }
private async void mnu_tuatruyen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Clear(); loaitruyen.Caption = @"Tựa truyện"; } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Clear(); giatri.Caption = @"Tựa truyện"; } var dataTable = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tonghop", new { option = 1 }); var chartGiaTri = new ChartControl(); chartGiaTri.Dock = DockStyle.Fill; chartGiaTri.DataSource = dataTable; Series seriesGiatri = new Series("Tựa truyện", ViewType.Line); seriesGiatri.LabelsVisibility = DefaultBoolean.True; // Add points to them, with their arguments different. foreach (DataRow dr in dataTable.Rows) { seriesGiatri.Points.Add(new SeriesPoint(dr["tuatruyen"], dr["thanhtien"])); } seriesGiatri.Label.TextPattern = "{V:#,##0}"; chartGiaTri.Series.AddRange(new Series[] { seriesGiatri }); chartGiaTri.Legend.Visibility = DefaultBoolean.True; Legend legend = chartGiaTri.Legend; legend.Margins.All = 8; legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right; legend.AlignmentVertical = LegendAlignmentVertical.Top; legend.Direction = LegendDirection.LeftToRight; if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Add(chartGiaTri); } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Add(chartGiaTri); } }
public async void GetCtPhieuXuat() { var x = gridView1.FocusedRowHandle; var y = gridView1.TopRowIndex; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_ct_phieunhapxuat", new { option = 1, maphieu = txt_maphieu.Text }); dgv_ct_phieuxuat.BeginInvoke(new Action(() => { dgv_ct_phieuxuat.DataSource = dt; })); gridView1.FocusedRowHandle = x; gridView1.TopRowIndex = y; }
public async void GetCtPhieuNhap(string maphieu) { var x = gridView4.FocusedRowHandle; var y = gridView4.TopRowIndex; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_ct_phieunhapxuat", new { option = 1, maphieu }); dgv_ct_phieunhap.BeginInvoke(new Action(() => { dgv_ct_phieunhap.DataSource = dt; })); gridView4.FocusedRowHandle = x; gridView4.TopRowIndex = y; }
private async void mnu_quocgia_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Clear(); loaitruyen.Caption = @"Quốc Gia"; } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Clear(); giatri.Caption = @"Quốc Gia"; } var chartControl1 = new ChartControl(); chartControl1.Dock = DockStyle.Fill; var dataTable = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tonghop", new { option = 3 }); chartControl1.DataSource = dataTable; Series seriesquocgia = new Series("Quốc Gia", ViewType.Bar); seriesquocgia.LabelsVisibility = DefaultBoolean.True; // Add points to them, with their arguments different. foreach (DataRow dr in dataTable.Rows) { seriesquocgia.Points.Add(new SeriesPoint(dr["quocgia"], dr["soluong"])); } chartControl1.Series.AddRange(new Series[] { seriesquocgia }); chartControl1.Legend.Visibility = DefaultBoolean.True; Legend legend = chartControl1.Legend; // chartControl1.Legend.AlignmentVertical = LegendAlignmentVertical.Center legend.Margins.All = 8; legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right; legend.AlignmentVertical = LegendAlignmentVertical.Top; legend.Direction = LegendDirection.LeftToRight; if (_flag == 1) { loaitruyen.Control.Controls[0].Controls.Add(chartControl1); } else if (_flag == 2) { giatri.Control.Controls[0].Controls.Add(chartControl1); } }
public async void GetPhieuNhap() { var x = gridView1.FocusedRowHandle; var y = gridView1.TopRowIndex; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_phieunhapxuat", new { loaiphieu = "PN", tungay = Convert.ToDateTime(txt_tungay.EditValue), denngay = Convert.ToDateTime(txt_denngay.EditValue) }); dgv_phieunhap.BeginInvoke(new Action(() => { dgv_phieunhap.DataSource = dt; lbl_maphieu.DataBindings.Clear(); lbl_maphieu.DataBindings.Add("text", dt, "maphieu"); gridView1.FocusedRowHandle = x; gridView1.TopRowIndex = y; })); }
public async void GetTonKho() { var x = grvViewCTPhieuNhap.FocusedRowHandle; var y = grvViewCTPhieuNhap.TopRowIndex; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tonkho", new { option = 1, thang = Convert.ToDateTime(txt_tungay.EditValue).Month, nam = Convert.ToDateTime(txt_tungay.EditValue).Year }); grcTonKho.DataSource = dt; lbl_matruyen.DataBindings.Clear(); lbl_matua.DataBindings.Clear(); lbl_matruyen.DataBindings.Add("text", dt, "matruyen"); lbl_matua.DataBindings.Add("text", dt, "matua"); grvViewCTPhieuNhap.FocusedRowHandle = x; grvViewCTPhieuNhap.TopRowIndex = y; }
public async void GetLayout(string matua) { string strDuongDan = Application.StartupPath + "\\img\\origin\\"; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_get_tentruyen", new { option = 4, duongdanfilehinh = strDuongDan, matua }); BindingList <PictureObject> list = new BindingList <PictureObject>(); PictureObject item; object b = new object(); await System.Threading.Tasks.Task.Factory.StartNew(() => { foreach (DataRow drow in dt.Rows) { lock (b) { BeginInvoke(new Action(() => { if (drow["sohuu"].ToString().ToLower() == "true") { if (File.Exists(drow["hinhanh"].ToString())) { item = new PictureObject(drow["tentruyen"].ToString(), Image.FromFile(drow["hinhanh"].ToString()), drow["tuatruyen"].ToString(), drow["matruyen"].ToString(), drow["matua"].ToString()); } else { item = new PictureObject(drow["tentruyen"].ToString(), Image.FromFile(strDuongDan + "no-image.png"), drow["tuatruyen"].ToString(), drow["matruyen"].ToString(), drow["matua"].ToString()); } list.Add(item); } else { if (File.Exists(drow["hinhanh"].ToString())) { item = new PictureObject(drow["tentruyen"].ToString(), MakeGrayscale((Bitmap)Image.FromFile(drow["hinhanh"].ToString())), drow["tuatruyen"].ToString(), drow["matruyen"].ToString(), drow["matua"].ToString()); } else { item = new PictureObject(drow["tentruyen"].ToString(), MakeGrayscale((Bitmap)Image.FromFile(strDuongDan + "no-image.png")), drow["tuatruyen"].ToString(), drow["matruyen"].ToString(), drow["matua"].ToString()); } list.Add(item); } })); } } }); dgv_Layout.DataSource = list; }
public async void GetNhatKyPhieuNhap() { var x = gridView6.FocusedRowHandle; var y = gridView6.TopRowIndex; var dt = await ExecSQL.ExecProcedureDataAsyncAsDataTable("pro_ct_phieunhapxuat", new { option = 4, tungay = Convert.ToDateTime(txt_tungay.EditValue), denngay = Convert.ToDateTime(txt_denngay.EditValue) }); dgv_nhatky.BeginInvoke(new Action(() => { dgv_nhatky.DataSource = dt; if (xtraTabControl1.SelectedTabPage == tab_nhatky) { lbl_maphieu.DataBindings.Clear(); lbl_maphieu.DataBindings.Add("text", dt, "maphieu"); } })); gridView6.FocusedRowHandle = x; gridView6.TopRowIndex = y; }