private void GetLookUpData() { string table = _data.DrTableMaster["TableName"].ToString(); if ((table == "MT24" || table == "MT32") && gvVat.Columns["MaVT"] != null && gvVat.Columns["MaVT"].ColumnEdit != null) { RepositoryItemGridLookUpEdit riGlu = gvVat.Columns["MaVT"].ColumnEdit as RepositoryItemGridLookUpEdit; CDTData data = (riGlu.Tag as GrdSingle).Data; //CDTData data = riGlu.Tag as CDTData; if (data.FullData) { return; } data.GetData(); data.FullData = true; BindingSource bs = riGlu.DataSource as BindingSource; bs.DataSource = data.DsData.Tables[0]; } if ((table.Contains("MT1") || table == "MT51") && gvVat.Columns["MaKH"] != null && gvVat.Columns["MaKH"].ColumnEdit != null) { RepositoryItemGridLookUpEdit riGlu = gvVat.Columns["MaKH"].ColumnEdit as RepositoryItemGridLookUpEdit; CDTData data = (riGlu.Tag as GrdSingle).Data; //CDTData data = riGlu.Tag as CDTData; if (data.FullData) { return; } data.GetData(); data.FullData = true; BindingSource bs = riGlu.DataSource as BindingSource; bs.DataSource = data.DsData.Tables[0]; } }
public CDTData GetDataForDetailReport(string linkfield, string linkitem) { string s = "select * from sysReport where sysReportParentID = " + _drTable["SysReportID"].ToString(); DataTable dt = _dbStruct.GetDataTable(s); if (dt == null || dt.Rows.Count == 0) { return(null); } CDTData data = DataFactory.Create(DataType.Report, dt.Rows[0]); data.GetData(); //Chuyển data cha qua data con DataRow dr = data.DsData.Tables[0].NewRow(); foreach (DataColumn dc in DsData.Tables[0].Columns) { if (data.DsData.Tables[0].Columns[dc.ColumnName] == null) { continue; } dr[dc.ColumnName] = DsData.Tables[0].Rows[0][dc.ColumnName]; } if (!(data.DsData.Tables[0].Columns[linkfield] == null)) { dr[linkfield] = linkitem.Trim(); } data.DsData.Tables[0].Rows.Add(dr); //this.GenFilterString(); return(data); }
private void FilterDMCN(GridLookUpEdit gluDMCN) { if (!_data.DrTable.Table.Columns.Contains("ExtraSQL")) { return; } string filter = _data.DrTable["ExtraSQL"].ToString(); RepositoryItemGridLookUpEdit ri = gluDMCN.Properties; if ((ri.Tag as GrdSingle) != null) { CDTData data = (ri.Tag as GrdSingle).Data; if (data.FullData) { return; } if (data.Condition != string.Empty) { data.Condition = data.Condition + " and " + filter; } else { data.Condition = filter; } data.GetData(); data.FullData = true; BindingSource bs = ri.DataSource as BindingSource; bs.DataSource = data.DsData.Tables[0]; ri.View.BestFitColumns(); } }
private void GetCongno_Click(object sender, EventArgs e) { try { if (MaKH == null) { return; } CDTData _data = DataFactory.DataFactory.Create(DataType.Report, "1453"); _data.GetData(); bsCongno.DataSource = _data.DsData.Tables[0]; bsCongno.AddNew(); bsCongno.EndEdit(); (bsCongno.Current as DataRowView)["NgayCT1"] = Tungay; (bsCongno.Current as DataRowView)["NgayCT2"] = Denngay; (bsCongno.Current as DataRowView)["TK"] = "131"; (bsCongno.Current as DataRowView)["MaKH"] = MaKH; DataReport __data = new DataReport((_data as DataReport).DrTable); __data.GetData(); __data.DsData = _data.DsData; __data.reConfig = new ReConfig(); __data.reConfig.Variables = (_data as DataReport).reConfig.Copy(); __data.DrCurrentMaster = (bsCongno.Current as DataRowView).Row; (__data as DataReport).SaveVariables(); (__data as DataReport).GenFilterString(); FormFactory.ReportPreview rptPre = new FormFactory.ReportPreview(__data); rptPre.Dock = DockStyle.Fill; pCongno.Controls.Clear();// rptPre.Visible = true; pCongno.Controls.Add(rptPre); } catch (Exception ex) { } }
public CDTData GetDataForVoucher(string maCT, string linkItem) { string sysPackageID = Config.GetValue("sysPackageID").ToString(); string s = "select * from sysTable where MaCT = '" + maCT + "' and sysPackageID = " + sysPackageID; DataTable dt = _structdb.GetDataTable(s); if (dt == null || dt.Rows.Count == 0) { return(null); } CDTData data = DataFactory.DataFactory.Create(DataType.MasterDetail, dt.Rows[0]); data.ConditionMaster = data.DrTableMaster["Pk"].ToString() + " = '" + linkItem + "'"; data.GetData(); return(data); }
private void RefreshColumnData() { foreach (GridColumn gc in gvMain.Columns) { if (gc.ColumnEdit != null && gc.ColumnEdit.GetType() == typeof(RepositoryItemGridLookUpEdit)) { RepositoryItemGridLookUpEdit ri = gc.ColumnEdit as RepositoryItemGridLookUpEdit; if ((ri.Tag as GrdSingle) != null) { CDTData data = (ri.Tag as GrdSingle).Data; if (data.FullData) { continue; } data.GetData(); data.FullData = true; BindingSource bs = ri.DataSource as BindingSource; bs.DataSource = data.DsData.Tables[0]; } } } }
private void Khoitao() { dmkh = DataFactory.publicCDTData.findCDTData("DMKH", "", ""); if (dmkh == null) { dmkh = DataFactory.DataFactory.Create(CDTControl.DataType.Single, "DMKH", Config.GetValue("sysPackageID").ToString()); DataFactory.publicCDTData.AddCDTData(dmkh); dmkh.GetData(); } this.grdmkh.Properties.DataSource = dmkh.DsData.Tables[0]; // grdmkh.EditValue = _cban.MaKH; string sql = "select mamon, tenmon, giaban, hinh, maloaimon from dmmon where mamon in (select mamon from dmmon4area where MaPOSArea='" + MaPOSArea + "')"; tbMon = db.GetDataTable(sql); sql = "select maloaimon from dmmon where mamon in (select mamon from dmmon4area where MaPOSArea='" + MaPOSArea + "')"; sql = "select maloaimon, tenloaimon from dmloaimon where maloaimon in (" + sql + ")"; tbLoaiMon = db.GetDataTable(sql); repositoryItemGridLookUpEdit1.DataSource = tbMon; pcLoaiMon.Visible = true; panelControl1.Controls.Add(pcLoaiMon); pcLoaiMon.Width = 10; pcLoaiMon.Height = panelControl1.Height; int x = 0; pcLoaiMon.Left = sLeft.Width; foreach (DataRow drLM in tbLoaiMon.Rows) { SimpleButton sp = new SimpleButton(); sp.Text = drLM["tenloaimon"].ToString(); sp.Tag = drLM["maloaimon"].ToString(); sp.Width = 100; sp.Height = pcLoaiMon.Height; sp.Font = new Font("Times New Roman", 10, FontStyle.Bold); sp.ForeColor = Color.Firebrick; sp.Left = x; sp.Top = 0; x += sp.Width; pcLoaiMon.Controls.Add(sp); pcLoaiMon.Width += sp.Width; sp.Click += new EventHandler(sp_Click); //Khởi tạo món DataRow[] ldrMon = tbMon.Select("maloaimon='" + sp.Tag.ToString() + "'"); PanelControl pc = new PanelControl(); pc.Text = sp.Tag.ToString(); pc.Visible = true; this.Controls.Add(pc); pc.BringToFront(); pc.Dock = DockStyle.Fill; lpc.Add(pc); PanelControl pc1 = new PanelControl(); DevExpress.XtraEditors.VScrollBar VSsr = new DevExpress.XtraEditors.VScrollBar(); VSsr.Minimum = 0; VSsr.Maximum = 1; VSsr.LargeChange = 1; VSsr.Scroll += VSsr_Scroll; pc.Controls.Add(VSsr); VSsr.Dock = DockStyle.Right; pc.Resize += Pc_Resize; pc1.Width = pc.Width - VSsr.Width; pc1.Top = 0; pc1.Left = 0; VSsr.Tag = pc1; pc1.Height = 100; pc.Controls.Add(pc1); int xt = 0; int yt = 0; foreach (DataRow drMon in ldrMon) { cMon sb = new cMon(drMon); pc1.Controls.Add(sb); pc1.Resize += Pc1_Resize; sb.Chonmon += new EventHandler(sb_Click); } } }