public TableInfoDto GetTableInfo(int tableId)
        {
            var table = Repository.Get(tableId);

            if (table == null)
            {
                throw new UserFriendlyException("Table not exist.");
            }
            var tableInfo = new TableInfoDto();

            tableInfo.Id          = table.Id;
            tableInfo.MaxAmount   = table.MaxAmount;
            tableInfo.MinAmount   = table.MinAmount;
            tableInfo.Name        = table.Name;
            tableInfo.Description = table.Description;
            tableInfo.Commission1 = table.MaxAmount * table.PayCommissionRate1;
            tableInfo.Commission2 = table.MaxAmount * table.PayCommissionRate2;
            tableInfo.Commission3 = table.MaxAmount * table.PayCommissionRate3;
            tableInfo.Commission4 = table.MaxAmount * table.PayCommissionRate4;
            tableInfo.Commission5 = table.MaxAmount * table.PayCommissionRate5;
            tableInfo.Commission6 = table.MaxAmount * table.PayCommissionRate6;
            tableInfo.Commission7 = table.MaxAmount * table.PayCommissionRate7;
            tableInfo.Commission8 = table.MaxAmount * table.PayCommissionRate8;
            tableInfo.Commission9 = table.MaxAmount * table.PayCommissionRate9;
            return(tableInfo);
        }
Exemplo n.º 2
0
 public static string GetColumnDesc(TableInfoDto tableInfo, string colName)
 {
     if (colName.ToLower() == "rownum")
     {
         return("编号");
     }
     return(tableInfo.ColumnInfos.Single(c => c.Name.Equals(colName)).Desc);
 }
Exemplo n.º 3
0
        public static string ConvertDataTableToHtml(TableDataInfo tableDataInfo, string orderBy, string sort)
        {
            DataTable    dataTable    = tableDataInfo.TableData;
            TableInfoDto tableInfoDto = tableDataInfo.TableInfo;

            string html = "<table class=\"table table-bordered table-hover table-condensed\"><tbody>";

            //add header row
            html += "<tr>";
            for (int i = 0; i < dataTable.Columns.Count; i++)
            {
                string colName = dataTable.Columns[i].ColumnName;
                if (tableInfoDto.ColumnInfos.All(c => c.Name != colName))
                {
                    continue;
                }

                if (orderBy.ToLower().Equals(colName.ToLower()))
                {
                    if (sort.ToLower().Equals("asc"))
                    {
                        html += string.Format("<td><a href=\"?tabName={1}&orderby={2}&sort={3}\">{0}</a></td>", TableInfoHelper.GetColumnDesc(tableInfoDto, colName), tableInfoDto.Name, colName, "DESC");
                    }
                    else
                    {
                        html += string.Format("<td><a href=\"?tabName={1}&orderby={2}&sort={3}\">{0}</a></td>", TableInfoHelper.GetColumnDesc(tableInfoDto, colName), tableInfoDto.Name, colName, "ASC");
                    }
                }
                else
                {
                    html += string.Format("<td><a href=\"?tabName={1}&orderby={2}&sort={3}\">{0}</a></td>", TableInfoHelper.GetColumnDesc(tableInfoDto, colName), tableInfoDto.Name, colName, "DESC");
                }
            }
            html += "</tr>";
            //add rows
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                html += "<tr>";
                for (int j = 0; j < dataTable.Columns.Count; j++)
                {
                    string colName = dataTable.Columns[j].ColumnName;
                    if (tableInfoDto.ColumnInfos.All(c => c.Name != colName))
                    {
                        continue;
                    }
                    html += "<td>" + dataTable.Rows[i][j].ToString() + "</td>";
                }

                html += "</tr>";
            }
            html += "</tbody></table>";
            return(html);
        }
Exemplo n.º 4
0
        public void AnalizeTable_log(TableInfoDto tableInfo)
        {
            if (_intNodeId > 1) // Solo se obtiene data del nodo
            {
                var query_created = from a in _dbContext.log
                                    where a.d_Date > _datLastSyncDate
                                    select a;

                var objDataListDtoCreated = query_created.ToList().ToDTOs();                                 // Obtener la data creada y pasarla a entidades simples.

                Common.Utils.Serialize(objDataListDtoCreated, GenerateOutputFileName(tableInfo.v_Table, 1)); // Serializar la Data creada
            }
        }
Exemplo n.º 5
0
        public void AnalizeTable_movementdetail(TableInfoDto tableInfo)
        {
            //// Se obtiene del servidor o del nodo
            //var query_created = from a in _dbContext.movementdetail
            //                    where a.d_InsertDate > LastSyncDate
            //                    select a;

            //var query_updated = from a in _dbContext.movementdetail
            //                    where a.d_UpdateDate > LastSyncDate
            //                    select a;

            //var objDataListDtoCreated = query_created.ToList().ToDTOs(); // Obtener la data creada y pasarla a entidades simples.
            //var objDataListDtoUpdated = query_updated.ToList().ToDTOs(); // Obtener la data actualizada y pasarla a entidades simples.

            //Common.Utils.Serialize(objDataListDtoCreated, GenerateOutputFileName(tableInfo.v_Table, 1)); // Serializar la Data creada
            //Common.Utils.Serialize(objDataListDtoUpdated, GenerateOutputFileName(tableInfo.v_Table, 2)); // Serializar la Data actualizada
        }
Exemplo n.º 6
0
        public void AnalizeTable_supplier(TableInfoDto tableInfo)
        {
            // Se obtiene del servidor o del nodo
            var query_created = from a in _dbContext.supplier
                                where a.d_InsertDate > _datLastSyncDate
                                select a;

            var query_updated = from a in _dbContext.supplier
                                where a.d_UpdateDate > _datLastSyncDate
                                select a;

            var objDataListDtoCreated = query_created.ToList().ToDTOs();                                 // Obtener la data creada y pasarla a entidades simples.
            var objDataListDtoUpdated = query_updated.ToList().ToDTOs();                                 // Obtener la data actualizada y pasarla a entidades simples.

            Common.Utils.Serialize(objDataListDtoCreated, GenerateOutputFileName(tableInfo.v_Table, 1)); // Serializar la Data creada
            Common.Utils.Serialize(objDataListDtoUpdated, GenerateOutputFileName(tableInfo.v_Table, 2)); // Serializar la Data actualizada
        }
Exemplo n.º 7
0
        public static string CreateHtmlForm(TableInfoDto tableInfo, string formAction)
        {
            string html = string.Format("<h2>{0}</h2>", tableInfo.Name);
            var    cols = tableInfo.ColumnInfos.Where(c => !c.IsPrimaryKey)
                          .OrderBy(c => c.Sort);

            html += string.Format("<form action=\"{0}\" method=\"post\">", formAction);
            foreach (var col in cols)
            {
                html += "<ul>";
                html += string.Format("<li>{0}</li>", col.Desc);
                switch (col.FormItemType)
                {
                case FormItemType.Text:
                    html += string.Format("<input type=\"text\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;

                case FormItemType.BigText:
                    html += string.Format("<textarea rows=\"10\" cols=\"80\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;

                case FormItemType.Double:
                    html += string.Format("<input type=\"text\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;

                case FormItemType.Number:
                    html += string.Format("<input type=\"text\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;

                case FormItemType.DateTime:
                    html += string.Format("<input type=\"text\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;

                case FormItemType.Money:
                    html += string.Format("<input type=\"text\" id=\"{0}\" name=\"{0}\">", col.Name);
                    break;
                }
                html += "<li>";
                html += "</ul>";
            }

            html += "<input type=\"submit\" value=\"确定\">";
            html += "</form>";
            return(html);
        }
Exemplo n.º 8
0
        public void AnalizeTable_systemuserrolenode(TableInfoDto tableInfo)
        {
            if (_intNodeId == 1) // Solo se obtiene data del servidor
            {
                var query_created = from a in _dbContext.systemuserrolenode
                                    where a.d_InsertDate > _datLastSyncDate
                                    select a;

                var query_updated = from a in _dbContext.systemuserrolenode
                                    where a.d_UpdateDate > _datLastSyncDate
                                    select a;

                var objDataListDtoCreated = query_created.ToList().ToDTOs();                                 // Obtener la data creada y pasarla a entidades simples.
                var objDataListDtoUpdated = query_updated.ToList().ToDTOs();                                 // Obtener la data actualizada y pasarla a entidades simples.

                Common.Utils.Serialize(objDataListDtoCreated, GenerateOutputFileName(tableInfo.v_Table, 1)); // Serializar la Data creada
                Common.Utils.Serialize(objDataListDtoUpdated, GenerateOutputFileName(tableInfo.v_Table, 2)); // Serializar la Data actualizada
            }
        }
Exemplo n.º 9
0
 private static bool SchemaNotExcluded(CodeGenerationConfiguration configuration, TableInfoDto d)
 {
     return((!configuration?.ExcludeSchemas?.Contains(d.SchemaName, StringComparer.OrdinalIgnoreCase) ??
             true) ||
            (configuration.ExcludeSchemas.Length == 0));
 }
Exemplo n.º 10
0
 private static bool TableIsIncluded(CodeGenerationConfiguration configuration, TableInfoDto d)
 {
     return((configuration?.IncludeTables?.Contains(d.Name, StringComparer.OrdinalIgnoreCase) ?? true) ||
            (configuration.IncludeTables.Length == 0));
 }
Exemplo n.º 11
0
        public void AnalizeTable(TableInfoDto tableInfo)
        {
            if (tableInfo.v_Table == "applicationhierarchy")
            {
                AnalizeTable_applicationhierarchy(tableInfo);
            }
            else if (tableInfo.v_Table == "systemparameter")
            {
                AnalizeTable_systemparameter(tableInfo);
            }
            else if (tableInfo.v_Table == "datahierarchy")
            {
                AnalizeTable_datahierarchy(tableInfo);
            }
            else if (tableInfo.v_Table == "organization")
            {
                AnalizeTable_organization(tableInfo);
            }
            else if (tableInfo.v_Table == "location")
            {
                AnalizeTable_location(tableInfo);
            }
            else if (tableInfo.v_Table == "warehouse")
            {
                AnalizeTable_warehouse(tableInfo);
            }
            else if (tableInfo.v_Table == "area")
            {
                AnalizeTable_area(tableInfo);
            }
            else if (tableInfo.v_Table == "groupoccupation")
            {
                AnalizeTable_groupoccupation(tableInfo);
            }
            else if (tableInfo.v_Table == "ges")
            {
                AnalizeTable_ges(tableInfo);
            }
            else if (tableInfo.v_Table == "occupation")
            {
                AnalizeTable_occupation(tableInfo);
            }
            else if (tableInfo.v_Table == "node")
            {
                AnalizeTable_node(tableInfo);
            }
            else if (tableInfo.v_Table == "nodeorganizationprofile")
            {
                AnalizeTable_nodeorganizationprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "nodeorganizationlocationprofile")
            {
                AnalizeTable_nodeorganizationlocationprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "nodeorganizationlocationwarehouseprofile")
            {
                AnalizeTable_nodeorganizationlocationwarehouseprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "rolenode")
            {
                AnalizeTable_rolenode(tableInfo);
            }
            else if (tableInfo.v_Table == "rolenodeprofile")
            {
                AnalizeTable_rolenodeprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "person")
            {
                AnalizeTable_person(tableInfo);
            }
            else if (tableInfo.v_Table == "professional")
            {
                AnalizeTable_professional(tableInfo);
            }
            else if (tableInfo.v_Table == "pacient")
            {
                AnalizeTable_pacient(tableInfo);
            }
            else if (tableInfo.v_Table == "systemuser")
            {
                AnalizeTable_systemuser(tableInfo);
            }
            else if (tableInfo.v_Table == "restrictedwarehouseprofile")
            {
                AnalizeTable_restrictedwarehouseprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "systemusergobalprofile")
            {
                AnalizeTable_systemusergobalprofile(tableInfo);
            }
            else if (tableInfo.v_Table == "systemuserrolenode")
            {
                AnalizeTable_systemuserrolenode(tableInfo);
            }
            else if (tableInfo.v_Table == "pacientmultimediadata")
            {
                AnalizeTable_pacientmultimediadata(tableInfo);
            }
            else if (tableInfo.v_Table == "cie10")
            {
                AnalizeTable_cie10(tableInfo);
            }
            else if (tableInfo.v_Table == "product")
            {
                AnalizeTable_product(tableInfo);
            }
            else if (tableInfo.v_Table == "supplier")
            {
                AnalizeTable_supplier(tableInfo);
            }
            else if (tableInfo.v_Table == "productwarehouse")
            {
                AnalizeTable_productwarehouse(tableInfo);
            }
            else if (tableInfo.v_Table == "movement")
            {
                AnalizeTable_movement(tableInfo);
            }
            else if (tableInfo.v_Table == "movementdetail")
            {
                AnalizeTable_movementdetail(tableInfo);
            }

            else if (tableInfo.v_Table == "log")
            {
                AnalizeTable_log(tableInfo);
            }
        }
Exemplo n.º 12
0
 protected bool Equals(TableInfoDto other)
 {
     return(string.Equals(SchemaName, other.SchemaName) && string.Equals(TableName, other.TableName));
 }