Example #1
0
        public static BaoBieu getReport(DataRow row)
        {
            BaoBieu report = new BaoBieu();

            report.id = HelpNumber.ParseInt64(row["ID"]);
            report.keyid = row["KEYID"].ToString().Trim();
            report.reportName = row["NAME"].ToString().Trim();
            report.isRead = (row["ISREAD_BIT"].ToString().Equals("Y") ? true : false);

            return report;
        }
Example #2
0
 public List<BaoBieu> getAllReport()
 {
     List<BaoBieu> listReport = new List<BaoBieu>();
     DatabaseFB db = DABase.getDatabase();
     DbCommand dbSelect = db.GetSQLStringCommand("SELECT * FROM REPORT_CAT ORDER BY lower(NAME) ASC WHERE VISIBLE_BIT='Y'");
     IDataReader reader = db.ExecuteReader(dbSelect);
     while (reader.Read())
     {
         BaoBieu report = new BaoBieu();
         report.id = HelpNumber.ParseInt64(reader["ID"].ToString());
         report.keyid = reader["KEYID"].ToString();
         report.reportName = reader["NAME"].ToString();
         listReport.Add(report);
     }
     reader.Close();
     return listReport;
 }
Example #3
0
        public BaoBieu load2(string reportKeyID, string username)
        {
            try{
                DatabaseFB db = DABase.getDatabase();
                DbCommand dbSelect = db.GetStoredProcCommand("FW_GET_REPORT");
                db.AddInParameter(dbSelect, "@username", DbType.String, username);
                db.AddInParameter(dbSelect, "@reportkeyid", DbType.String, reportKeyID);
                IDataReader reader = db.ExecuteReader(dbSelect);
                //Không tồn tại report đó trong reportcat
                BaoBieu report = new BaoBieu();
                report.id = 0;
                report.keyid = reportKeyID;
                if (reader.Read())
                {
                    report.id = HelpNumber.ParseInt64(reader["ID"].ToString());
                    report.reportName = reader["NAME"].ToString();
                    if (reader["ISREAD_BIT"].ToString().Equals("Y"))
                        report.isRead = true;
                    else
                        report.isRead = false;
                }
                reader.Close();

                if (report.id > 0 || report.id == -1)
                    return report;
            }
            catch { }
            //Không tồn tại phân quyền trên report này
            //Xem như là Public Report
            return null;
        }
        private BaoBieu getReport(DataRow row)
        {
            BaoBieu report = new BaoBieu();

            report.id = HelpNumber.ParseInt64(row["ID"].ToString().Trim());
            report.keyid = row["KEYID"].ToString().Trim();
            report.reportName = row["NAME"].ToString().Trim();
            report.isRead = (row["isread_bit"].ToString().Equals("Y") ? true : false);

            return report;
        }
        private void barButtonItemSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            List<Feature> features = new List<Feature>();
            List<BaoBieu> reports = new List<BaoBieu>();
            if (this.xtraTabControlLeft.SelectedTabPage.Name.Equals("xtraTabPageGroup"))
            {
                foreach (int j in gridViewGroup.GetSelectedRows())
                {
                    DataRow row1 = this.gridViewGroup.GetDataRow(j);
                    long groudId = HelpNumber.ParseInt64(row1["groupid"].ToString());

                    //for (int i = 0; i < gridViewFeature.RowCount; i++)
                    //{
                    //    Feature feature = new Feature();
                    //    feature = this.getFeature(this.gridViewFeature.GetDataRow(i));
                    //    features.Add(feature);
                    //}
                    //HUNG//treelist
                    DataTable dt = treeListFeature.DataSource as DataTable;
                    foreach (DataRow row in dt.Rows)
                    {
                        //Chi luu child row, khong luu parent row
                        if (row["PARENTID"] != DBNull.Value)
                        {
                            Feature feature = new Feature();
                            feature = this.getFeature(row);
                            features.Add(feature);
                        }
                    }
                    ///---------------

                    for (int i = 0; i < gridViewReport.RowCount; i++)
                    {
                        BaoBieu report = new BaoBieu();
                        report = this.getReport(this.gridViewReport.GetDataRow(i));
                        reports.Add(report);
                    }
                    Feature.updateGroup(groudId, features);
                    BaoBieu.updateGroup(groudId, reports);
                }
            }
            else
            {
                foreach (int j in gridViewUser.GetSelectedRows())
                {
                    DataRow row1 = this.gridViewUser.GetDataRow(j);
                    long userID = HelpNumber.ParseInt64(row1["userid"].ToString());

                    //for (int i = 0; i < gridViewFeature.RowCount; i++)
                    //{
                    //    Feature feature = new Feature();
                    //    feature = this.getFeature(this.gridViewFeature.GetDataRow(i));
                    //    features.Add(feature);
                    //}

                    //HUNG//treelist
                    DataTable dt = treeListFeature.DataSource as DataTable;
                    foreach (DataRow row in dt.Rows)
                    {
                        //Chi luu child row, khong luu parent row
                        if (row["PARENTID"] != DBNull.Value)
                        {
                            Feature feature = new Feature();
                            feature = this.getFeature(row);
                            features.Add(feature);
                        }
                    }
                    ///---------------
                    for (int i = 0; i < gridViewReport.RowCount; i++)
                    {
                        BaoBieu report = new BaoBieu();
                        report = this.getReport(this.gridViewReport.GetDataRow(i));
                        reports.Add(report);
                    }
                    Feature.updateUser(userID, features);
                    BaoBieu.updateUser(userID, reports);
                }
            }

            if (xtraTabControlLeft.SelectedTabPage.Name.Equals("xtraTabPageGroup"))
                loadGridViewGroupSelectionChanged();
            else
                loadGridViewUserSelectionChanged();
        }