public void Load(DataRow drReport, DataRow drFilter, DataTable dtChartSource, dgvControl dgvChartSource) { this.drReport = drReport; this.drFilter = drFilter; this.dtChartSource = dtChartSource; this.dgvChartSource = dgvChartSource; if (this.BuildChart()) { this.SetLicense("RGN,RGN Warez Group,DD-APN-30-C01339,W44SSM949SWJ449HSHMF"); this.Run(); } }
private void CheckVoucher(dgvControl dgvPermission, string strColumnName, int beg, int end) { if (beg > end) { int temp = beg; beg = end; end = temp; } else { beg = beg + 1; } //DataTable dt = dgvPermission.DataSource as DataTable; for (int i = beg; i <= end; i++) { dgvPermission.Rows[i].Cells[strColumnName].Value = !(bool)dgvPermission.Rows[i].Cells[strColumnName].Value; } }
void tsbSearch_Click(object sender, EventArgs e) { frmSearch frmSearch = new frmSearch(); Form frm = this.Parent.FindForm().GetType().Name == "frmMain" ? this.Parent.FindForm().ActiveMdiChild : this.Parent.FindForm(); // Tim form tren tabcontrol if (frm == null) { frm = Common.FindFormChildInTab(); } if (frm == null) { return; } object ExportControl = ((frmBase)frm).ExportControl; if (ExportControl == null) { return; } //dgvControl if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher")) { dgvControl dgv = (dgvControl)ExportControl; frmSearch.bdsSearch = (BindingSource)dgv.DataSource; } else if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport")) { tlControl tl = (tlControl)ExportControl; frmSearch.bdsSearch = (BindingSource)tl.DataSource; } frmSearch.Show(); }
public void Load(DataRow drReport, DataRow drFilter, DataTable dtChartSource, dgvControl dgvChartSource) { }
void SetBindingSource() { //dgvControl if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher")) { dgvControl dgv = (dgvControl)ExportControl; if (dgv.DataSource == null) { return; } if (dgv.DataSource.GetType().Name != "BindingSource") { return; } BindingSource bds = (BindingSource)dgv.DataSource; if (bds == null) { return; } this.bdsFilter = bds; this.dtDataSource = (DataTable)bds.DataSource; dtColumnList = new DataTable(); dtColumnList.Columns.Add("ColumnID", typeof(string)); dtColumnList.Columns.Add("ColumnName", typeof(string)); dtColumnList.Columns.Add("DataType", typeof(string)); foreach (DataGridViewColumn dgvc in dgv.Columns) { if (!dtDataSource.Columns.Contains(dgvc.Name)) { continue; } DataRow dr = dtColumnList.NewRow(); dr["ColumnID"] = dgvc.DataPropertyName; dr["ColumnName"] = dgvc.HeaderText; dr["DataType"] = dgvc.ValueType.Name; dtColumnList.Rows.Add(dr); } if (dgv.CurrentCell != null) { strDefaultColumn = dgv.Columns[dgv.CurrentCell.ColumnIndex].DataPropertyName; } } //tlControl if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport")) { tlControl tl = (tlControl)ExportControl; if (tl.DataSource == null) { return; } if (tl.DataSource.GetType().Name != "BindingSource") { return; } BindingSource bds = (BindingSource)tl.DataSource; if (bds == null) { return; } this.bdsFilter = bds; this.dtDataSource = (DataTable)bds.DataSource; dtColumnList = new DataTable(); dtColumnList.Columns.Add("ColumnID", typeof(string)); dtColumnList.Columns.Add("ColumnName", typeof(string)); dtColumnList.Columns.Add("DataType", typeof(string)); foreach (DevExpress.XtraTreeList.Columns.TreeListColumn tlc in tl.Columns) { DataRow dr = dtColumnList.NewRow(); dr["ColumnID"] = tlc.FieldName; dr["ColumnName"] = tlc.Caption; dr["DataType"] = tlc.ColumnType.Name; dtColumnList.Rows.Add(dr); } if (tl.FocusedColumn != null) { strDefaultColumn = tl.FocusedColumn.FieldName; } } }
private void CheckHD(dgvControl dgvPermission, string strColumnName, int beg, int end) { if (beg > end) { int temp = beg; beg = end; end = temp; } else { beg = beg + 1; } //DataTable dt = dgvPermission.DataSource as DataTable; for (int i = beg; i <= end; i++) { dgvPermission.Rows[i].Cells[strColumnName].Value = !(bool)dgvPermission.Rows[i].Cells[strColumnName].Value; if (Common.CheckPermission("PERMISSION", enuPermission_Type.Allow_Access) || Epoint.Systems.Elements.Element.sysIs_Admin) { //drCurrent = dtPermission.Rows[i]; drCurrent = ((DataRowView)bdsPermission.Current).Row; drCurrent.AcceptChanges(); bool bAllow_View = (bool)drCurrent["ALLOW_VIEW"], bAllow_Access = (bool)drCurrent["ALLOW_ACCESS"], bAllow_New = (bool)drCurrent["ALLOW_NEW"], bAllow_Edit = (bool)drCurrent["ALLOW_EDIT"], bAllow_Delete = (bool)drCurrent["ALLOW_DELETE"], bAllow_Duyet = (bool)drCurrent["ALLOW_DUYET"]; bool bDeny_View = (bool)drCurrent["DENY_VIEW"], bDeny_Access = (bool)drCurrent["DENY_ACCESS"], bDeny_New = (bool)drCurrent["DENY_NEW"], bDeny_Edit = (bool)drCurrent["DENY_EDIT"], bDeny_Delete = (bool)drCurrent["DENY_DELETE"]; string strSQLExec; int iIdent00; Hashtable htPara = new Hashtable(); htPara.Add("MEMBER_ID", strMember_ID); htPara.Add("OBJECT_ID", (string)drCurrent["Object_ID"]); htPara.Add("ALLOW_VIEW", bAllow_View); htPara.Add("ALLOW_ACCESS", bAllow_Access); htPara.Add("ALLOW_NEW", bAllow_New); htPara.Add("ALLOW_EDIT", bAllow_Edit); htPara.Add("ALLOW_DELETE", bAllow_Delete); htPara.Add("ALLOW_DUYET", bAllow_Delete); if (drCurrent["Ident00"] == DBNull.Value || Convert.ToInt32(drCurrent["Ident00"]) == 0) //Chưa tồn tại { strSQLExec = @"INSERT INTO SYSPERMISSION (Member_ID, Object_ID, Allow_View, Allow_Access, Allow_New, Allow_Edit, Allow_Delete, Allow_Duyet) VALUES (@Member_ID, @Object_ID, @Allow_View, @Allow_Access, @Allow_New, @Allow_Edit, @Allow_Delete, @Allow_Duyet) SELECT @@IDENTITY" ; iIdent00 = Convert.ToInt32(SQLExec.ExecuteReturnValue(strSQLExec, htPara, CommandType.Text)); if (iIdent00 != 0) { drCurrent["Allow_View"] = bAllow_View; //Allow drCurrent["Allow_Access"] = bAllow_Access; drCurrent["Allow_New"] = bAllow_New; drCurrent["Allow_Edit"] = bAllow_Edit; drCurrent["Allow_Delete"] = bAllow_Delete; drCurrent["Allow_Duyet"] = bAllow_Duyet; drCurrent["Deny_View"] = bDeny_View; //Deny drCurrent["Deny_Access"] = bDeny_Access; drCurrent["Deny_New"] = bDeny_New; drCurrent["Deny_Edit"] = bDeny_Edit; drCurrent["Deny_Delete"] = bDeny_Delete; drCurrent["Ident00"] = iIdent00; } } else //Đã tồn tại { htPara.Add("IDENT00", Convert.ToInt32(drCurrent["Ident00"])); strSQLExec = @"UPDATE SYSPERMISSION SET Allow_View = @Allow_View, Allow_Access = @Allow_Access, Allow_New = @Allow_New, Allow_Edit = @Allow_Edit, Allow_Delete = @Allow, Allow_Duyet = @Allow_Duyet WHERE Ident00 = @Ident00"; if (SQLExec.Execute(strSQLExec, htPara, CommandType.Text)) { drCurrent["Allow_View"] = bAllow_View; //Allow drCurrent["Allow_Access"] = bAllow_Access; drCurrent["Allow_New"] = bAllow_New; drCurrent["Allow_Edit"] = bAllow_Edit; drCurrent["Allow_Delete"] = bAllow_Delete; drCurrent["Allow_Duyet"] = bAllow_Duyet; drCurrent["Deny_View"] = bDeny_View; //Deny drCurrent["Deny_Access"] = bDeny_Access; drCurrent["Deny_New"] = bDeny_New; drCurrent["Deny_Edit"] = bDeny_Edit; drCurrent["Deny_Delete"] = bDeny_Delete; } } //Nếu check [Allow] và [Deny] bị gỡ ra toàn bộ -> Thì xóa hẳn khỏi SYSPERMISSION if (drCurrent["Ident00"] != DBNull.Value && Convert.ToInt32(drCurrent["Ident00"]) != 0) { bool bUncheckAll = true; if (dgvPermission.Columns.Contains("Allow_View") && dgvPermission.Columns["Allow_View"].Visible && ((bool)drCurrent["Allow_View"] || (bool)drCurrent["Deny_View"])) { bUncheckAll = false; } if (dgvPermission.Columns.Contains("Allow_Access") && dgvPermission.Columns["Allow_Access"].Visible && ((bool)drCurrent["Allow_Access"] || (bool)drCurrent["Deny_Access"])) { bUncheckAll = false; } if (dgvPermission.Columns.Contains("Allow_New") && dgvPermission.Columns["Allow_New"].Visible && ((bool)drCurrent["Allow_New"] || (bool)drCurrent["Deny_New"])) { bUncheckAll = false; } if (dgvPermission.Columns.Contains("Allow_Edit") && dgvPermission.Columns["Allow_Edit"].Visible && ((bool)drCurrent["Allow_Edit"] || (bool)drCurrent["Deny_Edit"])) { bUncheckAll = false; } if (dgvPermission.Columns.Contains("Allow_Delete") && dgvPermission.Columns["Allow_Delete"].Visible && ((bool)drCurrent["Allow_Delete"] || (bool)drCurrent["Deny_Delete"])) { bUncheckAll = false; } if (bUncheckAll) { if (SQLExec.Execute("DELETE FROM SYSPERMISSION WHERE Ident00 = " + drCurrent["Ident00"].ToString().Trim())) { drCurrent["Ident00"] = 0; } } } } } }
public void Filter() { Form frm = this.Parent.FindForm().GetType().Name == "frmMain" ? this.Parent.FindForm().ActiveMdiChild : this.Parent.FindForm(); // Tim form tren tabcontrol if (frm == null) { frm = Common.FindFormChildInTab(); } if (frm == null) { return; } object ExportControl = ((frmBase)frm).ExportControl; if (ExportControl == null) { return; } //dgvControl if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher")) { dgvControl dgv = (dgvControl)ExportControl; if (strColumnFilter == string.Empty) { strColumnFilter = dgv.CurrentCell.OwningColumn.DataPropertyName; } if (dgv.bdsFind == null) //|| this.CurrentCell == null) { return; } if (dgv.bFilter == false) { dgv.strFilterOrg = dgv.bdsFind.Filter; } string strFilter = "(" + strColumnFilter + " LIKE '%" + this.Text + "%')"; if (((DataTable)dgv.bdsFind.DataSource).Columns[strColumnFilter].DataType.Name != "String") { return; } if (dgv.strFilterOrg != string.Empty && dgv.strFilterOrg != null) { dgv.bdsFind.Filter = "(" + dgv.strFilterOrg + ") AND " + strFilter; } else { dgv.bdsFind.Filter = strFilter; } if (dgv.Rows.Count > 0) { dgv.CurrentCell = dgv.Rows[0].Cells[strColumnFilter]; } dgv.bFilter = true; } else if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport")) { tlControl tl = (tlControl)ExportControl; //if (tl.FocusedColumn == null) // return; if (strColumnFilter == string.Empty) { strColumnFilter = tl.FocusedColumn.FieldName; } if (tl.bdsFind == null) { return; } if (tl.bFilter == false) { tl.strFilterOrg = tl.bdsFind.Filter; } string strFilter = strColumnFilter + " LIKE '%" + this.Text + "%'"; //bdsFind.Filter = strFilter; if (tl.strFilterOrg != string.Empty && tl.strFilterOrg != null) { tl.bdsFind.Filter = "(" + tl.strFilterOrg + ") AND " + strFilter; } else { tl.bdsFind.Filter = strFilter; } if (tl.Nodes.Count > 0) { tl.SetNodeIndex(tl.Nodes[0], tl.Columns[strColumnFilter].VisibleIndex); } tl.bFilter = true; } }
void tsbTotal_Click(object sender, EventArgs e) { DataTable dtTotal = null; string strColumnName = string.Empty; string strHeaderText = string.Empty; string strFilter = string.Empty; Form frm = this.Parent.FindForm().GetType().Name == "frmMain" ? this.Parent.FindForm().ActiveMdiChild : this.Parent.FindForm(); // Tim form tren tabcontrol if (frm == null) { frm = Common.FindFormChildInTab(); } if (frm == null) { frm = Common.FindFormReportResultInTab(); } if (frm == null) { return; } object ExportControl = ((frmBase)frm).ExportControl; if (ExportControl == null) { return; } #region dgvControl, tlControl //dgvControl if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher")) { dgvControl dgv = (dgvControl)ExportControl; if (dgv.DataSource == null) { return; } if (dgv.DataSource.GetType().Name != "BindingSource") { return; } BindingSource bds = (BindingSource)dgv.DataSource; if (bds == null) { return; } if (dgv.CurrentCell == null) { return; } dtTotal = (DataTable)bds.DataSource; strColumnName = dgv.CurrentCell.OwningColumn.DataPropertyName; strHeaderText = dgv.CurrentCell.OwningColumn.HeaderText; strFilter = bds.Filter; } if (Common.Inlist(ExportControl.GetType().Name, "dgvGridReport,dgvGridControl,dgvReportGrid")) { dgvGridControl dgv = (dgvGridControl)ExportControl; if (dgv.DataSource == null) { return; } if (dgv.DataSource.GetType().Name != "BindingSource") { return; } BindingSource bds = (BindingSource)dgv.DataSource; if (bds == null) { return; } if (dgv.dgvGridView == null) { return; } dtTotal = (DataTable)bds.DataSource; strColumnName = dgv.dgvGridView.FocusedColumn.Name; strHeaderText = dgv.dgvGridView.FocusedColumn.Caption; strFilter = bds.Filter; } //tlControl if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport")) { tlControl tl = (tlControl)ExportControl; if (tl.DataSource == null) { return; } if (tl.DataSource.GetType().Name != "BindingSource") { return; } BindingSource bds = (BindingSource)tl.DataSource; if (bds == null) { return; } if (tl.FocusedColumn == null) { return; } dtTotal = (DataTable)bds.DataSource; strColumnName = tl.FocusedColumn.FieldName; strHeaderText = tl.FocusedColumn.Caption; strFilter = bds.Filter; } if (!Common.Inlist(dtTotal.Columns[strColumnName].DataType.Name, "Byte, Int16, Int32, Int64, Decimal, Double")) { return; } #endregion if (dtTotal == null) { return; } double dbSumToltal = Common.SumDCValue(dtTotal, strColumnName, strFilter); string strMsg = Languages.GetLanguage("SUM") + " " + strHeaderText + ": " + dbSumToltal.ToString("N"); if (dtTotal.Columns.Contains("Bold")) { string strFilterNormal = strFilter + (strFilter == string.Empty || strFilter == null ? "" : " AND ") + " Bold = 0 "; string strFilterBold = strFilter + (strFilter == string.Empty || strFilter == null ? "" : " AND ") + " Bold = 1 "; double dbSumNormal = Common.SumDCValue(dtTotal, strColumnName, strFilterNormal); double dbSumBold = Common.SumDCValue(dtTotal, strColumnName, strFilterBold); strMsg += "\n" + Languages.GetLanguage("SUM_NORMAL") + ": " + dbSumNormal.ToString("N"); strMsg += "\n" + Languages.GetLanguage("SUM_BOLD") + ": " + dbSumBold.ToString("N"); } EpointMessage.MsgOk(strMsg); }