示例#1
0
        //保存功能分组信息
        public void SaveGroup()
        {
            NameValueCollection Params = HttpContext.Request.Form;//参数
            Group group = new Group();

            group.Author       = User.Identity.Name;
            group.Name         = Params["name"];
            group.Bewrite      = Params["bewrite"];
            group.ProjectCode  = new Guid(Params["projectCode"]);
            group.DatabaseCode = new Guid(Params["databaseCode"]);
            string result = string.Empty;

            if (Params["code"] != null)
            {
                group.Code = new Guid(Params["code"]);
                result     = DGroup.Update(group) != null ? "{HasError:false,msg:'功能分组编辑成功!'}" : "{HasError:true,msg:'功能分组编辑失败,请稍候再试!'}";
            }
            else
            {
                group.Code = Guid.NewGuid();
                result     = DGroup.Add(group) != null ? "{HasError:false,msg:'功能分组创建成功!'}" : "{HasError:true,msg:'功能分组创建失败,请稍候再试!'}";
            }
            Response.Write(result);
            Response.End();
        }
示例#2
0
        //删除功能分组信息
        public void DeleteGroup()
        {
            NameValueCollection Params = HttpContext.Request.Form;//参数
            string result = DGroup.Delete(new Guid(Params["code"])) != null ? "{HasError:false,msg:'功能分组删除成功!'}" : "{HasError:true,msg:'功能分组删除失败,请稍候再试!'}";

            Response.Write(result);
            Response.End();
        }
示例#3
0
        //获取功能分组信息
        public void GetPageGroup()
        {
            NameValueCollection Params = HttpContext.Request.Form;//参数
            string page    = Params["page"];
            string rows    = Params["rows"];
            int    intPage = int.Parse((page == null || page == "0") ? "1" : page);
            //每页显示条数
            int pageSize = int.Parse((rows == null || rows == "0") ? "10" : rows);
            //每页的开始记录  第一页为1  第二页为number +1
            int    start        = (intPage - 1) * pageSize;
            string projectCode  = Params["projectCode"];
            string databaseCode = Params["databaseCode"];

            Response.Write(DGroup.GetPageGroup(start, pageSize, "", projectCode, databaseCode));
            Response.End();
        }
示例#4
0
        //根据项目编码,获取数据库以及表信息(用于主页展示目录)
        public void PreviewTable()
        {
            NameValueCollection Params       = HttpContext.Request.Form;//参数
            IList <Database>    databaselist = DDatabase.GetDatabase(new Guid(Params["projectCode"].ToString()));
            StringBuilder       Json         = new StringBuilder();

            Json.Append("{ projectName: '" + Params["projectName"] + "',");
            Json.Append("copyright:'DBVortaro',");
            Json.Append("time: '" + DateTime.Now.ToString("yyyy年MM月dd日") + "',list: [");
            int databaseNumber = 0;//数据库计数器

            for (int i = 0; i < databaselist.Count; i++)
            {
                DataTable tableslist = DTables.GetTables2(databaselist[i].Code);
                if (tableslist.Rows.Count > 0)//判断数据库下面是否存在表信息
                {
                    if (databaseNumber > 0)
                    {
                        Json.Append(",");
                    }
                    Json.Append("{ databaseName: '" + databaselist[i].Name
                                + "',serverName: '" + databaselist[i].ServerName
                                + "',list: [");
                    for (int j = 0; j < tableslist.Rows.Count; j++)
                    {
                        if (j > 0)
                        {
                            Json.Append(",");
                        }
                        Json.Append("{ Name: '" + tableslist.Rows[j]["Name"].ToString() + "',");
                        Json.Append("Url: 'Items/items.html?code=" + tableslist.Rows[j]["Code"].ToString() + "',");
                        Json.Append("Alias: '" + tableslist.Rows[j]["Alias"].ToString() + "',");
                        Json.Append("Author: '" + tableslist.Rows[j]["Author"].ToString() + "',");
                        Json.Append("GroupName: '" + DGroup.GetGroupName(new Guid(tableslist.Rows[j]["GroupCode"].ToString())) + "'");
                        Json.Append("}");
                    }
                    Json.Append("]}");
                    databaseNumber++;
                }
            }
            Json.Append("]}");
            Response.Write(Json.ToString());
            Response.End();
        }
示例#5
0
        private void DOBAVITSB_Click(object sender, RoutedEventArgs e)
        {
            string fio   = DFIO.Text;
            string group = DGroup.Text;
            string datar = DDatar.Text;

            var ssql = $"INSERT INTO Student (name,groupp,data) VALUES ('{fio}', '{group}','{datar}')"; //ЗАпрос вставить данные в таблицу

            string        connectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=dnevnik;Integrated Security=True";
            SqlConnection conn             = new SqlConnection(connectionString); // Подключение к БД

            conn.Open();                                                          // Открытие Соединения

            SqlCommand command = new SqlCommand(ssql, conn);                      // Объект вывода запросов

            int number = command.ExecuteNonQuery();

            MessageBox.Show("Изменения сохранены!\nВставлено объектов: " + number);

            DFIO.Clear(); DGroup.Clear(); DDatar.Clear();
        }
示例#6
0
        /// <summary>
        /// 生成HTML首页
        /// </summary>
        /// <param name="projectCode">项目编码</param>
        /// <param name="fileName">文件名称</param>
        /// <param name="directory">输出路径</param>
        /// <param name="indexPath">首页模板路径</param>
        /// <param name="itemsPath">子页模板路径</param>
        private static void BuildIndex(string projectCode, string fileName, string directory, string indexPath, string itemsPath)
        {
            string           tableStr     = string.Empty; //表格
            IList <Database> databaselist = DDatabase.GetDatabase(new Guid(projectCode));
            int  rowspan = 0;                             //分组跨行计数
            bool merger  = false;                         //是否合并

            for (int k = 0; k < databaselist.Count; k++)
            {
                DataTable tableslist = DTables.GetTables2(databaselist[k].Code);
                if (tableslist.Rows.Count > 0)//是否存在表字段
                {
                    tableStr += @"
                    <table style=""width: 100%;"">
		            <tr><td colspan=""5"" style=""font-weight:bold;line-height:20px;"">服务器:"         + databaselist[k].ServerName + "<br/>数据库:" + databaselist[k].Name + @"</td></tr>
		            <tr class=""text-center""><th style=""width:60px"">序号</th><th>分组</th><th>表名</th><th>别名</th><th>作者</th></tr>"        ;
                    for (int q = 0; q < tableslist.Rows.Count; q++)
                    {
                        string url = string.Format("Items/{0}_{1}.html", databaselist[k].Name, tableslist.Rows[q]["Name"].ToString());
                        tableStr += string.Format(@"<tr><td style=""padding-left:10px;"">{0}</td>", q + 1);
                        string GroupName = string.Empty,
                               TempName  = DGroup.GetGroupName(new Guid(tableslist.Rows[q]["GroupCode"].ToString()));
                        //名称竖排
                        for (int Q = 0; Q < TempName.Length; Q++)
                        {
                            GroupName += TempName[Q].ToString() + "<br/>";
                        }
                        //分组跨行处理
                        if (rowspan == 0)
                        {
                            for (int j = q; j < tableslist.Rows.Count; j++)
                            {
                                if (tableslist.Rows[j]["GroupCode"].ToString() == tableslist.Rows[q]["GroupCode"].ToString())
                                {
                                    rowspan++;
                                }
                            }
                            merger = true;
                        }
                        if (rowspan > 0 && merger == true)
                        {
                            tableStr += string.Format(@"<td class=""text-center"" style=""width:60px;"" rowspan=""{0}"">{1}</td>", rowspan, GroupName);
                            merger    = false; //停用合并
                            rowspan--;         //合并行计数
                        }
                        else if (rowspan > 0)
                        {
                            rowspan--;//合并行计数
                        }
                        else
                        {
                            tableStr += string.Format(@"<td class=""text-center"" style=""width:60px;"">{0}</td>", GroupName);
                        }
                        tableStr += string.Format(@"<td><a href=""{0}"">{1}</a></td><td><a href=""{0}"">{2}</a></td>
	                        <td class=""text-center"">{3}</td></tr>"    ,
                                                  url, tableslist.Rows[q]["Name"].ToString(),
                                                  tableslist.Rows[q]["Alias"].ToString(),
                                                  tableslist.Rows[q]["Author"].ToString());
                        BuildItems(new Guid(tableslist.Rows[q]["Code"].ToString()),
                                   tableslist.Rows[q]["Name"].ToString(),
                                   tableslist.Rows[q]["Alias"].ToString(),
                                   directory + "/" + url, itemsPath);
                    }
                    tableStr += "</table><br/>";
                }
            }
            string[] indexTemp = new string[] { "@title", "@table", "@footer" };
            string[] indexHtml = new string[] { fileName, tableStr, "DBVortaro" };
            DTemplates.WriteHtml(indexTemp, indexHtml, indexPath, directory + "/index.html");
        }
示例#7
0
        public IList <BGroup> get_groups()
        {
            DGroup dg = new DGroup();

            return(dg.SELECT_ALL());
        }