Esempio n. 1
0
        public ChartofAccountDAL()
        {
            List <ZColumn> _MasterColumnsList = new List <ZColumn>();

            _MasterColumnsList.Add(new ZColumn {
                Name = "Id", FieldName = "Id", Required = false, ReadOnly = true, ColumnType = "int"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Code", FieldName = "Code", Required = true, ReadOnly = false, ColumnType = "string"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Name", FieldName = "Name", Required = true, ReadOnly = false, ColumnType = "string"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Description", FieldName = "Description", Required = false, ReadOnly = false, ColumnType = "string"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "AccountTypeId", FieldName = "AccountTypeId", Required = true, ReadOnly = false, ColumnType = "int", DataSource = "AccountTypesAll", ValueMember = "Id", DisplayMember = "Name"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Active", FieldName = "Active", Required = true, ReadOnly = false, ColumnType = "bool", DefaultValue = "true"
            });

            SourceTables.Add(new ZTable {
                TableName = "tblChartOfAccounts", ParameterFieldName = "Id", ColumnList = _MasterColumnsList
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Builds a list of relatable table names
        /// </summary>
        private void BuildRelatedTableNames()
        {
            SessionHandler sh        = new SessionHandler(Session);
            int            patientId = sh.GetPatientId();

            // only allow child tables which are direct children of Patients
            Patient patient      = new Patient();
            string  parTableName = patient.TableName;
            string  parKeyName   = Patient.PatientId;
            int     parKey       = patientId;

            // get a list of relateable tables
            var relatedRecordsTables = GetRelatedTables();
            // get a list of records and their counts (children of patients table)
            var tablesAndCounts = from table in relatedRecordsTables
                                  let tableName = table.Key
                                                  let tableLabel = table.Value
                                                                   let doLookupCount = BOL.BusinessObject.GetParentTablename(tableName) == parTableName && BOL.BusinessObject.GetParentKeyName(tableName) == parKeyName
                                                                                       let recordCount = doLookupCount ? BOL.BusinessObject.Count(tableName, new Dictionary <string, object> {
                { parKeyName, parKey }
            }) : 0
                                                                                                         let normalizedCount = recordCount + (DestTableName == tableName ? -1 : 0)
                                                                                                                               // only allow tables with records
                                                                                                                               where !doLookupCount || normalizedCount > 0
                                                                                                                               select new
            {
                TableName  = tableName,
                TableLabel = tableLabel + " (" + (doLookupCount ? normalizedCount.ToString() : "N/A") + ")"
            };

            SourceTables.DataSource = tablesAndCounts;
            SourceTables.DataBind();
        }
Esempio n. 3
0
        public BranchesDAL()
        {
            List <ZColumn> _MasterColumnsList = new List <ZColumn>();

            _MasterColumnsList.Add(new ZColumn {
                Name = "Id", FieldName = "Id", Required = false, ReadOnly = true, ColumnType = "int"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Code", FieldName = "Code", Required = true, ReadOnly = false, ColumnType = "string"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Name", FieldName = "Name", Required = true, ReadOnly = false, ColumnType = "string"
            });
            _MasterColumnsList.Add(new ZColumn {
                Name = "Active", FieldName = "Active", Required = true, ReadOnly = false, ColumnType = "bool", DefaultValue = "true"
            });

            SourceTables.Add(new ZTable {
                TableName = "tblBranches", ParameterFieldName = "Id", ColumnList = _MasterColumnsList
            });
        }