Exemplo n.º 1
0
        bool UpdateReport(report_data report)
        {
            var saveOk = false;

            try
            {
                Db.report_data.AddOrUpdate(report);
                if (ck_auto_menu.Checked)
                {//生成菜单 :ToDo
                    var father_menu_id = "";
                    var menu_id        = "";
                    var role_id        = "";
                    if (cb_root_menu.Text.Contains('@'))
                    {
                        father_menu_id = cb_root_menu.Text.Split('@')[1];
                        menu_id        = father_menu_id + "_" + cb_area.Text + "_" + cb_controller.Text + "_" + tb_action.Text;
                        Db.menu.AddOrUpdate(new menu()
                        {
                            menu_id     = menu_id,
                            name        = report.ReportName,
                            farther_id  = father_menu_id,
                            note        = "报表生成时自动添加",
                            url         = "/" + cb_area.Text + "/" + cb_controller.Text + "/" + tb_action.Text,
                            depth       = "2",
                            sequence    = 1,
                            sub_system  = "-",
                            status      = "1",
                            controller  = "",
                            action      = "",
                            area        = "",
                            image_class = "",
                            active_li   = ""
                        });
                    }
                    if (cb_target_role.Text.Contains('@'))
                    {
                        role_id = cb_target_role.Text.Split('@')[1];
                        Db.role_menu.AddOrUpdate(new role_menu()
                        {
                            role_menu_id     = role_id + "-" + menu_id,
                            role_id          = role_id,
                            menu_id          = menu_id,
                            include_children = 1,
                            expire_time      = DateTime.MaxValue,
                            note             = "报表生成时自动分配",
                        });
                    }
                }
                saveOk = Db.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                TipInfo("报表提交发生异常,异常信息:" + ex.Message);
            }
            TipInfo(saveOk ? "报表提交成功!" : "报表提交失败!");
            return(saveOk);
        }
Exemplo n.º 2
0
        bool UpdateReport(report_data report)
        {
            var saveOk = false;

            try
            {
                Db.report_data.AddOrUpdate(report);
                saveOk = Db.SaveChanges() > 0;
            }
            catch (Exception ex)
            {
                TipInfo("报表提交发生异常,异常信息:" + ex.Message);
            }
            TipInfo(saveOk ? "报表提交成功!" : "报表提交失败!");
            return(saveOk);
        }
Exemplo n.º 3
0
        bool UpdateReport(ReportModel form)
        {
            var report = new report_data()
            {
                ReportID       = form.ReportID,
                ReportName     = form.ReportName,
                HeadFields     = form.HeadFields,
                ColunmToShow   = form.ColunmToShow,
                OperateColum   = form.OperateColum,
                ParaNames      = form.ParaNames,
                RecordsPerPage = form.RecordsPerPage,
                ReportLog      = form.RecordsPerPage + ";" + DateTime.Now.ToTimeStr() + "从winform中添加",
                SqlStr         = form.SqlStr
            };

            return(UpdateReport(report));
        }