Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("BasicParameterID,PGN,PGL,Acronym,SPNName,SPNNameRu,DataRange,DataSource")] BasicParameter basicParameter)
        {
            if (id != basicParameter.BasicParameterID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(basicParameter);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BasicParameterExists(basicParameter.BasicParameterID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(basicParameter));
        }
Пример #2
0
        public void NameNotExist()
        {
            ParameterCollection p = this.CollectionWith3Parameters();
            BasicParameter      c = p.Find("noexist");

            Assert.IsNull(c, "Column should be 'null'");
        }
Пример #3
0
        public void ParameterWithnameAndValue()
        {
            BasicParameter b = new BasicParameter("par1", "value1");

            Assert.AreEqual("par1", b.ParameterName);
            Assert.AreEqual("value1", b.ParameterValue);
        }
Пример #4
0
        public void FindWithNameIsEmpty()
        {
            ParameterCollection p  = this.CollectionWith3Parameters();
            BasicParameter      bp = p.Find(String.Empty);

            Assert.IsNotNull(bp, "Item should not be 'null'");
        }
        public void Save(BasicParameter objBasicParameter)
        {
            string             sql           = null;
            List <DbParameter> parameterList = new List <DbParameter>();

            if (objBasicParameter.PkId == 0)
            {
                sql = " insert into tbl_basic_parameter(PkId, ParamKey, ParamName, ParamValue) " +
                      " values(TBP_PKID.NEXTVAL, :ParamKey, :ParamName, :ParamValue) ";

                parameterList.Add(new OracleParameter(":ParamKey", objBasicParameter.ParamKey));
                parameterList.Add(new OracleParameter(":ParamName", objBasicParameter.ParamName));
                parameterList.Add(new OracleParameter(":ParamValue", objBasicParameter.ParamValue));
            }

            else
            {
                sql = " update tbl_basic_parameter set ParamValue=:ParamValue where ParamKey=:ParamKey ";

                parameterList.Add(new OracleParameter(":ParamValue", objBasicParameter.ParamValue));
                parameterList.Add(new OracleParameter(":ParamKey", objBasicParameter.ParamKey));
            }

            DbHelper.ExecuteNonQuery(sql, CommandType.Text, parameterList.ToArray());
        }
Пример #6
0
        public void SecoundParameterShouldSqlParameter()
        {
            ParameterCollection p  = this.CollectionWithSQLParameters();
            BasicParameter      bp = p[1];

            Assert.That(bp, Is.InstanceOf(typeof(SqlParameter)));
        }
Пример #7
0
        public void ConvertToString_ValueShouldBeStringEmpty()
        {
            BasicParameter b = new BasicParameter();

            b.ParameterName = "name1";
            Assert.IsNotNull(b);
            Assert.AreEqual("name1", b.ParameterName);
        }
Пример #8
0
        public void FindByName()
        {
            ParameterCollection p  = this.CollectionWith3Parameters();
            BasicParameter      bp = p.Find("p2");

            Assert.IsNotNull(bp);
            Assert.AreEqual(bp.ParameterValue, "Parameter2", "Find should return valid element");
        }
Пример #9
0
        private void SetParams(BasicParameter p)
        {
            string s = String.Format(System.Globalization.CultureInfo.CurrentCulture,
                                     "{0}[{1}]", p.ParameterName, p.ParameterValue);
            ParameterNode node = new ParameterNode(s, columnIcon);

            this.nodeParams.Nodes.Add(node);
        }
Пример #10
0
        public void CreateParameter_ValueShouldBeNull()
        {
            BasicParameter b = new BasicParameter();

            b.ParameterName = "name1";
            Assert.IsNotNull(b);
            Assert.AreEqual("name1", b.ParameterName);
            Assert.AreEqual(null, b.ParameterValue);
        }
        public bool CheckExists(BasicParameter objBasicParameter)
        {
            string             sql           = null;
            List <DbParameter> parameterList = new List <DbParameter>();

            sql = " select count(1) from tbl_basic_parameter where ParamKey=:ParamKey ";

            parameterList.Add(new OracleParameter(":ParamKey", objBasicParameter.ParamKey));

            return(int.Parse(DbHelper.ExecuteScalar(sql, CommandType.Text, parameterList.ToArray()).ToString()) > 0);
        }
Пример #12
0
        public async Task <IActionResult> Create([Bind("BasicParameterID,PGN,PGL,Acronym,SPNName,SPNNameRu,DataRange,DataSource")] BasicParameter basicParameter)
        {
            if (ModelState.IsValid)
            {
                _context.Add(basicParameter);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(basicParameter));
        }
Пример #13
0
        protected override object DoEvaluate(ScriptThread thread)
        {
            BasicParameter result = null;

            thread.CurrentNode = this;              //standard prolog
            var parametersCollection = thread.GetParametersCollection();

            result = parametersCollection.Find(parameterNode.AsString);
            if (result == null)
            {
                return(ExpressionHelper.ComposeAstNodeError("Parameters", parameterNode));
            }
            return(result.ParameterValue);
        }
Пример #14
0
        // Can use this version for Parameters as well

        private void V2_RunContributorsWithParameters(string fileName)
        {
            var model = ReportEngine.LoadReportModel(fileName);
            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list        = ContributorsReportData.CreateContributorsList();
            IDataManager       dataManager = DataManager.CreateInstance(list, model.ReportSettings);

            this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e)
            {
                this.previewControl1.RunReport(model, dataManager);
            };
            this.previewControl1.RunReport(model, dataManager);
        }
Пример #15
0
        private void V1_RunContributorsWithParameters(string fileName)
        {
            ReportModel model = ReportEngine.LoadReportModel(fileName);

            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list = ContributorsReportData.CreateContributorsList();


            this.previewControl1.PreviewLayoutChanged += delegate(object sender, EventArgs e)
            {
                this.previewControl1.RunReport(model, list, parameters);
            };
            this.previewControl1.RunReport(model, list, parameters);
        }
Пример #16
0
        private void RunContributorsWithParameters(string fileName)
        {
            var model = ReportEngine.LoadReportModel(fileName);
            ReportParameters parameters = ReportEngine.LoadParameters(fileName);

            BasicParameter p1 = parameters.Parameters[0];

            p1.ParameterValue = "Value of Parameter";


            List <Contributor> list = ContributorsReportData.CreateContributorsList();

            IReportCreator creator = ReportEngine.CreatePageBuilder(model, list, parameters);

            creator.SectionRendering += PushPrinting;
            creator.BuildExportList();
            using (PdfRenderer pdfRenderer = PdfRenderer.CreateInstance(creator, SelectFilename(), true))
            {
                pdfRenderer.Start();
                pdfRenderer.RenderOutput();
                pdfRenderer.End();
            }
        }
        public static void Initialize(MonitoringSystemContext context)
        {
            if (!context.Database.EnsureCreated())
            {
                context.Database.Migrate();
            }

            // Look for any BasicParameters.
            if (context.BasicParameters.Any())
            {
                return;   // DB has been seeded
            }

            var basicParameters = new BasicParameter[]
            {
                new BasicParameter {
                    SPNNameRu = "Время включения системы подачи газа", DataSource = "Отсутствует в J1339! (но есть Engine Total Hours of Gaseous Fuel Operation"
                },
                new BasicParameter {
                    Acronym = "GFC", SPNName = "Trip Gaseous", SPNNameRu = "Расход газа", DataSource = "CAN-шина, при наличии расходомера газа. Иначе-вычисляется через давление и проходное сечение форсунки впрыска газа"
                },
                new BasicParameter {
                    Acronym = "GP", SPNName = "Gas Pressure", SPNNameRu = "Давление газа", DataSource = "Внешний датчик давления"
                },
                new BasicParameter {
                    Acronym = "GFC", SPNName = "Trip Fuel", SPNNameRu = "Расход дизельного топлива", DataSource = "CAN шина, или датчик расхода"
                },
                new BasicParameter {
                    Acronym = "VD", SPNName = "Total Vehicle Distance", SPNNameRu = "Пробег автомобиля (пройденный путь)", DataSource = "CAN -шина"
                },
                new BasicParameter {
                    Acronym = "WBVS", SPNName = "Wheel-Based Vehicle Speed", SPNNameRu = "Скорость движения", DataSource = "CAN -шина"
                },
                new BasicParameter {
                    Acronym = "EEC1", SPNName = "Engine Speed", SPNNameRu = "Обороты двигателя", DataSource = "CAN -шина"
                },
                new BasicParameter {
                    Acronym = "ECT", SPNName = "Engine Coolant Temperature", SPNNameRu = "Температура двигателя", DataSource = "CAN -шина"
                },
                new BasicParameter {
                    Acronym = "TE", SPNName = "Exhaust Temperature", SPNNameRu = "Температура выхлопных газов", DataSource = "Дополнительный датчик на выхлопной  трубе"
                },
            };

            foreach (BasicParameter bp in basicParameters)
            {
                context.BasicParameters.Add(bp);
            }
            context.SaveChanges();



            /*if (context.Vehicles.Any())
             * {
             *  return;   // DB has been seeded
             * }*/


            var vehicles = new Vehicle[]
            {
                new Vehicle {
                    Mark = "BMW", ModelType = "E540", СarryingСapacity = 2000, YearIssue = 1998, UsefulVolume = 430, VehicleType = "ГР", OverallDimensions = "20x30x40"
                },
                new Vehicle {
                    Mark = "Mersedes", ModelType = "S230", СarryingСapacity = 4000, YearIssue = 1996, UsefulVolume = 930, VehicleType = "ГР", OverallDimensions = "50x70x60"
                },
            };

            foreach (Vehicle vh in vehicles)
            {
                context.Vehicles.Add(vh);
            }
            context.SaveChanges();

            // Table
            var vehiclegroups = new VehicleGroup[]
            {
                new VehicleGroup {
                    VehicleGroupName = "TestVehicleGroup1"
                },
                new VehicleGroup {
                    VehicleGroupName = "TestVehicleGroup2"
                },
                new VehicleGroup {
                    VehicleGroupName = "TestVehicleGroup3"
                },
            };

            foreach (VehicleGroup vhg in vehiclegroups)
            {
                context.VehicleGroups.Add(vhg);
            }
            context.SaveChanges();

            // Table
            var vehicletovehiclegroups = new VehicleToVehicleGroup[]
            {
                new VehicleToVehicleGroup {
                    VehicleGroupID = 2, VehicleID = 1
                },
                new VehicleToVehicleGroup {
                    VehicleGroupID = 2, VehicleID = 2
                },
                new VehicleToVehicleGroup {
                    VehicleGroupID = 3, VehicleID = 1
                },
            };

            foreach (VehicleToVehicleGroup vvg in vehicletovehiclegroups)
            {
                context.VehicleToVehicleGroups.Add(vvg);
            }
            context.SaveChanges();


            // Table
            var parameters = new Parameter[]
            {
                new Parameter {
                    VehicleID = 1, BasicParameterID = 2, BasicParameterValue = 112, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 3, BasicParameterValue = 113, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 4, BasicParameterValue = 114, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 5, BasicParameterValue = 115, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 6, BasicParameterValue = 116, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 7, BasicParameterValue = 117, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 8, BasicParameterValue = 118, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 9, BasicParameterValue = 119, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 54)
                },

                new Parameter {
                    VehicleID = 1, BasicParameterID = 2, BasicParameterValue = 122, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 3, BasicParameterValue = 123, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 4, BasicParameterValue = 124, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 5, BasicParameterValue = 125, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 6, BasicParameterValue = 126, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 7, BasicParameterValue = 127, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 8, BasicParameterValue = 128, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
                new Parameter {
                    VehicleID = 1, BasicParameterID = 9, BasicParameterValue = 129, BasicParameterTimeValue = new DateTime(2004, 10, 19, 10, 23, 56)
                },
            };

            foreach (Parameter p in parameters)
            {
                context.Parameters.Add(p);
            }
            context.SaveChanges();


            // Table
            var routes = new Route[]
            {
                new Route {
                    VehicleID = 1, CoordinateLatitude = 60.001, CoordinateLongitude = 30.001
                },
                new Route {
                    VehicleID = 1, CoordinateLatitude = 60.002, CoordinateLongitude = 30.002
                },
                new Route {
                    VehicleID = 1, CoordinateLatitude = 60.003, CoordinateLongitude = 30.003
                },
                new Route {
                    VehicleID = 1, CoordinateLatitude = 60.004, CoordinateLongitude = 30.004
                },
                new Route {
                    VehicleID = 1, CoordinateLatitude = 60.005, CoordinateLongitude = 30.005
                },
                new Route {
                    VehicleID = 2, CoordinateLatitude = 60.101, CoordinateLongitude = 30.101
                },
            };

            foreach (Route r in routes)
            {
                context.Routes.Add(r);
            }
            context.SaveChanges();


            // Table
            var users = new User[]
            {
                new User {
                    UserLogin = "******", UserPassword = "******", UserName = "******", UserSurname = "Шайтан", UserPhone = "7911", UserRole = 1
                },
                new User {
                    UserLogin = "******", UserPassword = "******", UserName = "******", UserSurname = "Иванов", UserPhone = "7921", UserRole = 2
                },
            };

            foreach (User u in users)
            {
                context.Users.Add(u);
            }
            context.SaveChanges();


            // Table
            var roles = new Role[]
            {
                new Role {
                    RoleName = "ADMIN"
                },
                new Role {
                    RoleName = "USER"
                },
            };

            foreach (Role r in roles)
            {
                context.Roles.Add(r);
            }
            context.SaveChanges();


            // Table
            var usertoroles = new UserToRole[]
            {
                new UserToRole {
                    UserID = 1, RoleID = 1
                },
                new UserToRole {
                    UserID = 2, RoleID = 2
                },
            };

            foreach (UserToRole ur in usertoroles)
            {
                context.UserToRoles.Add(ur);
            }
            context.SaveChanges();
        }
Пример #18
0
        public void Save_Parameter(BasicParameter objBasicParameter)
        {
            var repository = ServiceFactory.GetService <IBasicParameterRepository>();

            repository.Save(objBasicParameter);
        }
Пример #19
0
 public void FindWithNameIsNull()
 {
     ParameterCollection p  = this.CollectionWith3Parameters();
     BasicParameter      bp = p.Find(null);
 }
Пример #20
0
        public override string GenWinFormDesign(BasicParameter parameter,
                                                BaseParameter baseParameter)
        {
            NestQueryParameter nestQuerySetting = baseParameter as NestQueryParameter;
            string             strFrmClassName  = nestQuerySetting.FormClassName;
            int           lblWidth = BseUIManager.GetCtlWidth("Label");
            StringBuilder sb       = new StringBuilder();

            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Linq;");
            sb.AppendLine("using System.Drawing;");
            sb.AppendLine("using System.Diagnostics;");
            sb.AppendLine("using System.Threading.Tasks;");
            sb.AppendLine("using System.Data;");
            sb.AppendLine("using System.Xml.Linq;");
            sb.AppendLine("using Microsoft.VisualBasic;");
            sb.AppendLine("using System.Collections;");
            sb.AppendLine("using System.Windows.Forms;");
            sb.AppendLine(" ");
            sb.AppendLine("namespace  " + parameter.NameSpace + "");
            sb.AppendLine("{");
            sb.AppendLine("    partial class  " + strFrmClassName + " : System.Windows.Forms.Form");
            sb.AppendLine("    { ");
            sb.AppendLine("        [System.Diagnostics.DebuggerNonUserCode()]");
            sb.AppendLine("        protected override void Dispose(bool disposing)");
            sb.AppendLine("        {");
            sb.AppendLine("            try");
            sb.AppendLine("            {");
            sb.AppendLine("                if (disposing && components != null)");
            sb.AppendLine("                {");
            sb.AppendLine("                    components.Dispose();");
            sb.AppendLine("                }");
            sb.AppendLine("            }");
            sb.AppendLine("            finally");
            sb.AppendLine("            {");
            sb.AppendLine("                base.Dispose(disposing);");
            sb.AppendLine("            }");
            sb.AppendLine("        }");

            sb.AppendLine("        private System.ComponentModel.Container components = null;");

            sb.AppendLine("        [System.Diagnostics.DebuggerStepThrough()]");
            sb.AppendLine("        private void InitializeComponent()");
            sb.AppendLine("        {");
            sb.AppendLine("            this.splitContainer1 = new System.Windows.Forms.SplitContainer();");
            sb.AppendLine("            this.splitContainer2 = new System.Windows.Forms.SplitContainer();");
            //sb.AppendLine("            this.txtDepartmentName = new System.Windows.Forms.TextBox();");
            //sb.AppendLine("            this.lblQueryDepartmentName = new System.Windows.Forms.Label();");
            #region 查询面板控件

            foreach (DataRow drRow in nestQuerySetting.DataTableQuery.Rows)
            {
                if (drRow["IsAddLable"].ToString() == "True")
                {
                    sb.AppendLine("this." + drRow["LabelName"] + " = new System.Windows.Forms.Label();");
                    sb.AppendLine("            this." + drRow["ControlName"] + " = new " + drRow["ControlNameSpace"] + "();");
                }
                else
                {
                    sb.AppendLine("            this." + drRow["ControlName"] + " = new " + drRow["ControlNameSpace"] + "();");
                }
            }

            #endregion
            sb.AppendLine("            this.btnLoad = new System.Windows.Forms.Button();");
            sb.AppendLine("            this.panelView = new System.Windows.Forms.Panel();");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();");
            sb.AppendLine("            this.splitContainer1.Panel1.SuspendLayout();");
            sb.AppendLine("            this.splitContainer1.Panel2.SuspendLayout();");
            sb.AppendLine("            this.splitContainer1.SuspendLayout();");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();");
            sb.AppendLine("            this.splitContainer2.Panel1.SuspendLayout();");
            sb.AppendLine("            this.splitContainer2.Panel2.SuspendLayout();");
            sb.AppendLine("            this.splitContainer2.SuspendLayout();");
            sb.AppendLine("            this.SuspendLayout();");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;");
            sb.AppendLine("            this.splitContainer1.Location = new System.Drawing.Point(0, 0);");
            sb.AppendLine("            this.splitContainer1.Name = \"splitContainer1\";");
            sb.AppendLine("            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1.Panel1");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1.Panel2");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.Panel2.Controls.Add(this.panelView);");
            sb.AppendLine("            this.splitContainer1.Size = new System.Drawing.Size(784, 561);");
            sb.AppendLine("            this.splitContainer1.SplitterDistance = 51;");
            sb.AppendLine("            this.splitContainer1.TabIndex = 24;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer2");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;");
            sb.AppendLine("            this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;");
            sb.AppendLine("            this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;");
            sb.AppendLine("            this.splitContainer2.Location = new System.Drawing.Point(0, 0);");
            sb.AppendLine("            this.splitContainer2.Name = \"splitContainer2\";");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer2.Panel1");
            sb.AppendLine("            // ");
            //sb.AppendLine("            this.splitContainer2.Panel1.Controls.Add(this.txtDepartmentName);");
            //sb.AppendLine("            this.splitContainer2.Panel1.Controls.Add(this.lblQueryDepartmentName);");
            #region 查询区控件

            foreach (DataRow drRow in nestQuerySetting.DataTableQuery.Rows)
            {
                if (drRow["IsAddLable"].ToString() == "True")
                {
                    sb.AppendLine("            this.splitContainer2.Panel1.Controls.Add(this." + drRow["LabelName"] + ");");
                }
                sb.AppendLine("            this.splitContainer2.Panel1.Controls.Add(this." + drRow["ControlName"] + ");");
            }

            #endregion
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer2.Panel2");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer2.Panel2.Controls.Add(this.btnLoad);");
            sb.AppendLine("            this.splitContainer2.Size = new System.Drawing.Size(784, 51);");
            sb.AppendLine("            this.splitContainer2.SplitterDistance = 706;");
            sb.AppendLine("            this.splitContainer2.TabIndex = 0;");
            #region 查询区控件明细位置

            BeginWidth = 15;
            foreach (DataRow drRow in nestQuerySetting.DataTableQuery.Rows)
            {
                int intCurrCtlWidth = BseUIManager.GetCtlWidth(drRow["ControlType"].ToString());
                if (drRow["IsAddLable"].ToString() == "True")
                {
                    //控制位置
                    if (BeginWidth + lblWidth + intCurrCtlWidth > SumWidth)
                    {
                        QueryHeight += 1;
                        LocationX    = 15;
                        LocationY    = LocationY + HighSeed;
                        BeginWidth   = 15;
                        BeginWidth  += lblWidth + CtlSpace;
                    }
                    else
                    {
                        LocationX   = BeginWidth;
                        BeginWidth += lblWidth + CtlSpace;
                    }
                    sb.Append(GenControlHelper.CreateLabelControl(drRow["LabelName"].ToString(), drRow["LabelText"].ToString(), LocationX, LocationY));
                }

                //控制位置
                if (BeginWidth + intCurrCtlWidth > SumWidth)
                {
                    QueryHeight += 1;
                    LocationX    = 15;
                    LocationY    = LocationY + HighSeed;
                    BeginWidth   = 15;
                    BeginWidth  += intCurrCtlWidth + CtlSpace;
                }
                else
                {
                    LocationX   = BeginWidth;
                    BeginWidth += intCurrCtlWidth + CtlSpace;
                }
                sb.Append(GenControlHelper.CreateControl(drRow["Ctl_Simple"].ToString(), drRow["ControlName"].ToString(),
                                                         LocationX, LocationY, drRow["ControlSort"].ToString()));
            }
            int hight = QueryHeight * (HighSeed + 5) + 30;
            if (hight < 87)
            {
                hight = 87;
            }
            sb.Replace("@QueryHeight@", hight.ToString());

            #endregion
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // txtDepartmentName");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.txtDepartmentName.Location = new System.Drawing.Point(74, 16);");
            //sb.AppendLine("            this.txtDepartmentName.Name = "txtDepartmentName";");
            //sb.AppendLine("            this.txtDepartmentName.Size = new System.Drawing.Size(143, 23);");
            //sb.AppendLine("            this.txtDepartmentName.TabIndex = 1;");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // lblQueryDepartmentName");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.lblQueryDepartmentName.AutoSize = true;");
            //sb.AppendLine("            this.lblQueryDepartmentName.Location = new System.Drawing.Point(12, 19);");
            //sb.AppendLine("            this.lblQueryDepartmentName.Name = "lblQueryDepartmentName";");
            //sb.AppendLine("            this.lblQueryDepartmentName.Size = new System.Drawing.Size(56, 17);");
            //sb.AppendLine("            this.lblQueryDepartmentName.TabIndex = 0;");
            //sb.AppendLine("            this.lblQueryDepartmentName.Text = "部门名称";");
            sb.AppendLine("            // ");
            sb.AppendLine("            // btnLoad");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));");
            sb.AppendLine("            this.btnLoad.FlatAppearance.BorderColor = System.Drawing.Color.LightSkyBlue;");
            sb.AppendLine("            this.btnLoad.FlatStyle = System.Windows.Forms.FlatStyle.Flat;");
            sb.AppendLine("            this.btnLoad.Location = new System.Drawing.Point(8, 7);");
            sb.AppendLine("            this.btnLoad.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);");
            sb.AppendLine("            this.btnLoad.Name = \"btnLoad\";");
            sb.AppendLine("            this.btnLoad.Size = new System.Drawing.Size(55, 33);");
            sb.AppendLine("            this.btnLoad.TabIndex = 23;");
            sb.AppendLine("            this.btnLoad.Text = \"查询\";");
            sb.AppendLine("            this.btnLoad.UseVisualStyleBackColor = true;");
            sb.AppendLine("            this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // panelView");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.panelView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;");
            sb.AppendLine("            this.panelView.Dock = System.Windows.Forms.DockStyle.Fill;");
            sb.AppendLine("            this.panelView.Location = new System.Drawing.Point(0, 0);");
            sb.AppendLine("            this.panelView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);");
            sb.AppendLine("            this.panelView.Name = \"panelView\";");
            sb.AppendLine("            this.panelView.RightToLeft = System.Windows.Forms.RightToLeft.No;");
            sb.AppendLine("            this.panelView.Size = new System.Drawing.Size(784, 506);");
            sb.AppendLine("            this.panelView.TabIndex = 24;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // FrmNestQuery");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);");
            sb.AppendLine("            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;");
            sb.AppendLine("            this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(241)))), ((int)(((byte)(254)))));");
            sb.AppendLine("            this.ClientSize = new System.Drawing.Size(784, 561);");
            sb.AppendLine("            this.Controls.Add(this.splitContainer1);");
            sb.AppendLine("            this.Font = new System.Drawing.Font(\"微软雅黑\", 9F);");
            sb.AppendLine("            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;");
            sb.AppendLine("            this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);");
            sb.AppendLine("            this.Name = \"" + strFrmClassName + "\";");
            sb.AppendLine("            this.ShowIcon = false;");
            sb.AppendLine("            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;");
            sb.AppendLine("            this.Text = \"Master-Detail\";");
            sb.AppendLine("            this.splitContainer1.Panel1.ResumeLayout(false);");
            sb.AppendLine("            this.splitContainer1.Panel2.ResumeLayout(false);");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();");
            sb.AppendLine("            this.splitContainer1.ResumeLayout(false);");
            sb.AppendLine("            this.splitContainer2.Panel1.ResumeLayout(false);");
            sb.AppendLine("            this.splitContainer2.Panel1.PerformLayout();");
            sb.AppendLine("            this.splitContainer2.Panel2.ResumeLayout(false);");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();");
            sb.AppendLine("            this.splitContainer2.ResumeLayout(false);");
            sb.AppendLine("            this.ResumeLayout(false);");
            sb.AppendLine("        }");
            sb.AppendLine("        private SplitContainer splitContainer1;");
            sb.AppendLine("        internal Panel panelView;");
            sb.AppendLine("        private SplitContainer splitContainer2;");
            sb.AppendLine("        internal Button btnLoad;");
            #region 查询区控件
            foreach (DataRow drRow in nestQuerySetting.DataTableQuery.Rows)
            {
                if (drRow["IsAddLable"].ToString() == "True")
                {
                    sb.Append("        public  System.Windows.Forms.Label " + drRow["LabelName"] + ";\r\n");
                }
                sb.Append("        public " + drRow["ControlNameSpace"] + "  " + drRow["ControlName"] + ";\r\n");
            }
            #endregion
            //sb.AppendLine("        private TextBox txtDepartmentName;");
            //sb.AppendLine("        private Label lblQueryDepartmentName;");
            sb.AppendLine("    } ");
            sb.AppendLine("}");

            return(sb.ToString());
        }
Пример #21
0
        public override string GenWinFormCS(BasicParameter parameter,
                                            BaseParameter baseParameter)
        {
            NestQueryParameter nestQuerySetting = baseParameter as NestQueryParameter;
            string             strFrmClassName  = nestQuerySetting.FormClassName;
            string             strModelName     = parameter.TableName;
            StringBuilder      sb = new StringBuilder();

            sb.AppendLine("/// <summary>说明:" + strFrmClassName + "文件");
            sb.AppendLine("/// 作者:" + parameter.Author + "");
            sb.AppendLine("/// 创建时间:" + DateTime.Now + "");
            sb.AppendLine("/// </summary>");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Linq;");
            sb.AppendLine("using System.Drawing;");
            sb.AppendLine("using System.Diagnostics;");
            sb.AppendLine("using System.Threading.Tasks;");
            sb.AppendLine("using System.Data;");
            sb.AppendLine("using System.Xml.Linq;");
            sb.AppendLine("using Microsoft.VisualBasic;");
            sb.AppendLine("using System.Collections;");
            sb.AppendLine("using System.Windows.Forms;");
            sb.AppendLine("using Nikita.WinForm.ExtendControl;");
            sb.AppendLine("using System.Reflection;");
            sb.AppendLine("using Nikita.Core;");
            sb.AppendLine("using Nikita.Core.WinForm;");
            sb.AppendLine("using Nikita.Core.NPOIs;");
            sb.AppendLine("using Nikita.Core.Images;");
            sb.AppendLine("using Nikita.Core.Autofac;");
            sb.AppendLine("using Nikita.Core.XML;");
            sb.AppendLine("using Nikita.DataAccess4DBHelper;");
            sb.AppendLine("using Nikita.Base.Define;");
            sb.AppendLine("using WeifenLuo.WinFormsUI.Docking;");

            sb.AppendLine("namespace " + parameter.NameSpace + "");
            sb.AppendLine("{");
            sb.AppendLine("    public partial class " + strFrmClassName + "");
            sb.AppendLine("    {");
            #region   变量、常量
            sb.AppendLine("        #region 变量、常量");
            sb.AppendLine("        /// <summary>显示控件");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary> ");
            sb.AppendLine("        MasterControl _masterDetail;");
            sb.AppendLine("        #endregion");
            #endregion
            #region 构造函数
            sb.AppendLine("        #region 构造函数");
            sb.AppendLine("        public " + strFrmClassName + "()");
            sb.AppendLine("        {");
            sb.AppendLine("            InitializeComponent();");
            sb.AppendLine("        }");
            sb.AppendLine("        #endregion");
            #endregion
            #region 基本事件
            sb.AppendLine("        #region 基本事件");
            sb.AppendLine("        public void btnLoad_Click(object sender, EventArgs e)");
            sb.AppendLine("        {");
            sb.AppendLine("            try");
            sb.AppendLine("            {");
            sb.AppendLine("                btnLoad.Enabled = false;");
            sb.AppendLine("                 LoadData();");
            sb.AppendLine("            }");
            sb.AppendLine("            catch (Exception ex)");
            sb.AppendLine("            {");
            sb.AppendLine("                throw ex;");
            sb.AppendLine("            }");
            sb.AppendLine("            finally");
            sb.AppendLine("            { ");
            sb.AppendLine("                btnLoad.Enabled = true;");
            sb.AppendLine("            }");
            sb.AppendLine("        }");
            sb.AppendLine("        #endregion");
            #endregion
            #region 基本方法
            sb.AppendLine("        #region 基本方法");

            sb.AppendLine("        /// <summary>加载数据");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public void LoadData()");
            sb.AppendLine("        {");
            sb.AppendLine("            Clear();");
            sb.AppendLine("            CreateMasterDetailView();");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>清空");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public void Clear()");
            sb.AppendLine("        {");
            sb.AppendLine("            panelView.Controls.Clear();");
            sb.AppendLine("            _masterDetail = null;");
            sb.AppendLine("            Refresh();");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>创建主从关系");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public void CreateMasterDetailView()");
            sb.AppendLine("        {");
            sb.AppendLine("            var oDataSet = GetData();");
            sb.AppendLine("            _masterDetail = new MasterControl(oDataSet, ControlType.Middle);");
            sb.AppendLine("            panelView.Controls.Add(_masterDetail);");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary> 获取数据源");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        /// <returns>DataSet</returns>");
            sb.AppendLine("        public DataSet GetData()");
            sb.AppendLine("        {");
            sb.AppendLine("            IDbHelper dbHelper = GlobalHelpDemoForm.GetDataAccessHelperDemo();");
            sb.AppendLine("            string strWhere = GetSearchSql();");
            sb.AppendLine("            string strSql =" + nestQuerySetting.Sql + " ");
            sb.AppendLine(";");
            sb.AppendLine("            dbHelper.CreateCommand(strSql);");
            sb.AppendLine("            DataSet dataSet = dbHelper.ExecuteQueryDataSet();");
            if (nestQuerySetting.Key3 != string.Empty)
            {
                sb.AppendLine("         string[] strKeyArray = {\"" + nestQuerySetting.Key1 + "\",\"" + nestQuerySetting.Key2 + "\", \"" + nestQuerySetting.Key3 + "\"};");
            }
            else
            {
                sb.AppendLine("         string[] strKeyArray = {\"" + nestQuerySetting.Key1 + "\",\"" + nestQuerySetting.Key2 + "\" };");
            }
            sb.AppendLine("            for (int i = 0; i < dataSet.Tables.Count; i++)");
            sb.AppendLine("            {");
            sb.AppendLine(" dataSet.Tables[i].TableName = \"T\" + (i + 1);");
            sb.AppendLine("                HashSet<string> hsSet = new HashSet<string>();");
            sb.AppendLine("                foreach (DataRow drRow in dataSet.Tables[i].Rows)");
            sb.AppendLine("                {");
            sb.AppendLine("                    string strKey = strKeyArray[i];");
            sb.AppendLine("                    string strValue = drRow[strKey].ToString();");
            sb.AppendLine("                    if (!hsSet.Contains(strValue))");
            sb.AppendLine("                    {");
            sb.AppendLine("                        hsSet.Add(strValue);");
            sb.AppendLine("                    }");
            sb.AppendLine("                }");
            sb.AppendLine("                if (i < dataSet.Tables.Count - 1)");
            sb.AppendLine("                {");
            sb.AppendLine("                    for (int j = 0; j < dataSet.Tables[i + 1].Rows.Count; j++)");
            sb.AppendLine("                    {");
            sb.AppendLine("                        string strKey2 = strKeyArray[i + 1];");
            sb.AppendLine("                        string strValue2 = dataSet.Tables[i + 1].Rows[j][strKey2].ToString();");
            sb.AppendLine("                        if (!hsSet.Contains(strValue2))");
            sb.AppendLine("                        {");
            sb.AppendLine("                            dataSet.Tables[i + 1].Rows.RemoveAt(j);");
            sb.AppendLine("                            j--;");
            sb.AppendLine("                        }");
            sb.AppendLine("                    }");
            sb.AppendLine("            }");
            sb.AppendLine("     }");
            sb.AppendLine("            //这是对应关系的时候主键必须唯一");
            if (nestQuerySetting.Key3 != string.Empty)
            {
                sb.AppendLine("            dataSet.Relations.Add(\"1\", dataSet.Tables[\"T1\"].Columns[\"" + nestQuerySetting.Key1 + "\"], dataSet.Tables[\"T2\"].Columns[\"" + nestQuerySetting.Key2 + "\"]);");
                sb.AppendLine("             dataSet.Relations.Add(\"2\", dataSet.Tables[\"T2\"].Columns[\"" + nestQuerySetting.Key2 + "\"], dataSet.Tables[\"T3\"].Columns[\"" + nestQuerySetting.Key3 + "\"]);");
            }
            else
            {
                sb.AppendLine("            dataSet.Relations.Add(\"1\", dataSet.Tables[\"T1\"].Columns[\"" + nestQuerySetting.Key1 + "\"], dataSet.Tables[\"T2\"].Columns[\"" + nestQuerySetting.Key2 + "\"]);");
            }
            sb.AppendLine("            return dataSet;");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>根据查询条件构造查询语句");
            sb.AppendLine("        ///");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        /// <returns>查询条件</returns>");
            sb.AppendLine("        private string GetSearchSql()");
            sb.AppendLine("        {");
            sb.AppendLine(SearchConditionHelper.GetSearchCondition(nestQuerySetting.DataTableQuery));
            //sb.AppendLine("            SearchCondition condition = new SearchCondition();");
            //sb.AppendLine("            condition.AddCondition("UserName", this.txtDepartmentName.Text, SqlOperator.Like);");
            //sb.AppendLine("            return condition.BuildConditionSql().Replace("Where", "");");
            sb.AppendLine("        }");
            sb.AppendLine("        #endregion");
            #endregion
            sb.AppendLine("    }");
            sb.AppendLine("}");

            return(sb.ToString());
        }
Пример #22
0
        public void CreateEmptyParameter()
        {
            BasicParameter b = new BasicParameter();

            Assert.IsNotNull(b);
        }
Пример #23
0
        public override string GenWinFormCS(BasicParameter parameter, BaseParameter baseParameter)
        {
            TreeEditDialogParameter treeEditDialogParameter = baseParameter as TreeEditDialogParameter;

            if (treeEditDialogParameter == null)
            {
                throw new NoNullAllowedException("treeEditDialogParameter IS  NULL");
            }
            string        strFrmClassName        = "Frm" + parameter.ClassName + "TreeDialog";
            string        strDalName             = parameter.TableName + "DAL";
            string        strModelName           = parameter.TableName;
            string        strGlobalModelName     = " m_" + strModelName + " ";
            string        strGlobalListModelName = " m_lst" + strModelName + " ";
            string        strRetrunList          = "List" + strModelName + " ";
            string        strKeyId     = Tools.GetPKey_MSSQL(parameter.TableName, parameter.Conn);
            List <Bse_UI> lstBseUiEdit = BseUIManager.GetListUIEdit(parameter.TableName);
            StringBuilder sb           = new StringBuilder();

            sb.AppendLine("/// <summary>说明:" + strFrmClassName + "文件");
            sb.AppendLine("/// 作者:" + parameter.Author + "");
            sb.AppendLine("/// 创建时间:" + DateTime.Now + "");
            sb.AppendLine("/// </summary>");
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Collections;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System.ComponentModel;");
            sb.AppendLine("using System.Data;");
            sb.AppendLine("using System.Drawing;");
            sb.AppendLine("using System.Linq;");
            sb.AppendLine("using System.Text;");
            sb.AppendLine("using System.Windows.Forms;");
            sb.AppendLine("using Nikita.Base.Define;");
            sb.AppendLine("using Nikita.Core;");
            sb.AppendLine("using Nikita.Core.WinForm;");
            sb.AppendLine("using Nikita.Core.NPOIs;");
            sb.AppendLine("using Nikita.Core.Images;");
            sb.AppendLine("using Nikita.Core.Autofac;");
            sb.AppendLine("using Nikita.Core.XML;");
            sb.AppendLine("using " + parameter.NameSpace + ".DAL;");
            sb.AppendLine("using " + parameter.NameSpace + ".Model;");
            sb.AppendLine("using Nikita.Base.IDAL;");
            sb.AppendLine("using WeifenLuo.WinFormsUI.Docking;");

            sb.AppendLine("namespace " + parameter.NameSpace + "");
            sb.AppendLine("{");
            sb.AppendLine("    /// <summary>说明:" + strFrmClassName + "");
            sb.AppendLine("    /// 作者:Luhm");
            sb.AppendLine("    /// 最后修改人:");
            sb.AppendLine("    /// 最后修改时间:");
            sb.AppendLine("    /// 创建时间:" + DateTime.Now + "");
            sb.AppendLine("    /// </summary>");
            sb.AppendLine("    public partial class " + strFrmClassName + " : Form");
            sb.AppendLine("    {");

            #region 常量、变量
            sb.AppendLine("        #region 常量、变量");
            sb.AppendLine("  /// <summary>DataGridView下拉框绑定数据源");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private DataSet m_dsGridSource;");
            if (baseParameter.CodeGenType == CodeGenType.WinFromTreeEditWithDialog)
            {
                sb.AppendLine("        /// <summary>操作类");
                sb.AppendLine("        /// ");
                sb.AppendLine("        /// </summary>");
                //sb.AppendLine("        private " + strDalName + " m_" + strDalName + "; ");
                sb.AppendLine("        private IBseDAL<" + strModelName + "> m_" + strDalName + "; ");
            }
            sb.AppendLine("        /// <summary>索引号");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private string m_strIndex;");
            sb.AppendLine("        /// <summary>当前对象");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private " + strModelName + "  " + strGlobalModelName + ";");
            sb.AppendLine("        /// <summary>当前对象集合");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private List<" + strModelName + "> " + strGlobalListModelName + ";");
            sb.AppendLine("        /// <summary>返回对象集合");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public List<" + strModelName + "> " + strRetrunList + " { get; private set; }");
            sb.AppendLine("   /// <summary>父级ID");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private int m_intParentId;");
            sb.AppendLine("        #endregion");
            sb.AppendLine("          ");
            #endregion

            #region 构造函数
            sb.AppendLine("        #region 构造函数");

            sb.AppendLine("        /// <summary>构造函数");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        /// <param name=model\" " + strModelName + "\">对象</param>");
            sb.AppendLine("        /// <param name=\"lst" + strModelName + "\">对象集合</param>");
            sb.AppendLine("        public  " + strFrmClassName + " (" + strModelName + "  model, int intParentId, List<" + strModelName + ">   lst" + strModelName + ")");
            sb.AppendLine("        {");
            sb.AppendLine("            InitializeComponent();");
            sb.AppendLine("            DoInitData();");
            sb.AppendLine("            " + strGlobalListModelName + " =     lst" + strModelName + "?? new List<" + strModelName + ">() ;");
            sb.AppendLine("m_intParentId = intParentId;");
            //sb.AppendLine("            m_" + strDalName + " = new " + strDalName + "();");
            sb.AppendLine(" m_" + strDalName + " = GlobalHelp.GetResolve<IBseDAL<" + strModelName + ">>();");
            sb.AppendLine("            this.dataNavigator.Visible = false;");
            sb.AppendLine("            if (  model != null)");
            sb.AppendLine("            {");
            sb.AppendLine("                this.dataNavigator.Visible = true;");
            sb.AppendLine("                " + strGlobalModelName + " =   model;");
            sb.AppendLine("                this.dataNavigator.ListInfo =  lst" + strModelName + ".Select(t => t." + strKeyId + ".ToString()).ToList();");
            sb.AppendLine("                m_strIndex =  lst" + strModelName + ".FindIndex(t => t." + strKeyId + " ==    " + strGlobalModelName + "." + strKeyId + ").ToString();");
            sb.AppendLine("                this.dataNavigator.CurrentIndex = int.Parse(m_strIndex);");
            sb.AppendLine("            }");
            sb.AppendLine("        }");
            sb.AppendLine("        #endregion");
            #endregion

            #region 基础事件
            sb.AppendLine("          ");
            sb.AppendLine("        #region 基础事件");
            sb.AppendLine("        private void btnSave_Click(object sender, EventArgs e)");
            sb.AppendLine("        {");
            sb.AppendLine("            string strReturnMsg = CheckInput();");
            sb.AppendLine("            if (strReturnMsg != string.Empty)");
            sb.AppendLine("            {");
            sb.AppendLine("                MessageBox.Show(strReturnMsg);");
            sb.AppendLine("                return;");
            sb.AppendLine("            }");
            sb.AppendLine("            //新增");
            sb.AppendLine("            if (" + strGlobalModelName + " == null)");
            sb.AppendLine("            {");

            if (baseParameter is TreeEditDialogParameter)
            {
                TreeEditDialogParameter para = baseParameter as TreeEditDialogParameter;
                if (para.DontRepeatColumns.Trim() != string.Empty)
                {
                    string[] strColumnArray = para.DontRepeatColumns.Split(',');
                    if (strColumnArray.Length > 0)
                    {
                        foreach (Bse_UI ui in lstBseUiEdit)
                        {
                            if (strColumnArray.Contains(ui.ColumnName))
                            {
                                string strExistInfo = GenControlHelper.CreateExistInfo("m_" + strDalName, ui.ColumnName,
                                                                                       ui.LabelText, ui.ControlName, ui.ColumnType, ui.ControlNameSpace, OperationType.新增, strKeyId, strGlobalModelName);
                                sb.AppendLine(strExistInfo);
                            }
                        }
                    }
                }
            }
            //sb.AppendLine("                if (m_sysRolesDAL.CalcCount("RoleName='" + txtRoleName.Text.Trim() + "'") > 0)");
            //sb.AppendLine("                {");
            //sb.AppendLine("                    MessageBox.Show(@"角色名称已经存在");");
            //sb.AppendLine("                    return;");
            //sb.AppendLine("                }");
            sb.AppendLine("               " + strModelName + " model  = EntityOperateManager.AddEntity<  " + strModelName + ">(this.tabPage);");
            sb.AppendLine(" model." + treeEditDialogParameter.ParentId + " = m_intParentId;");
            sb.AppendLine("                int intReturn = m_" + strDalName + ".Add(model);");
            sb.AppendLine("                if (intReturn > 0)");
            sb.AppendLine("                {");
            sb.AppendLine("                    MessageBox.Show(@\"添加成功\");");
            sb.AppendLine("                    model." + strKeyId + " = intReturn;");
            sb.AppendLine("                    " + strGlobalListModelName + ".Add(model);");
            sb.AppendLine("                    " + strRetrunList + " =   " + strGlobalListModelName + ";");
            sb.AppendLine("                    this.DialogResult = DialogResult.OK;");
            sb.AppendLine("                }");
            sb.AppendLine("                else");
            sb.AppendLine("                {");
            sb.AppendLine("                    MessageBox.Show(@\"添加失败\");");
            sb.AppendLine("                }");
            sb.AppendLine("            }");
            sb.AppendLine("            //修改");
            sb.AppendLine("            else");
            sb.AppendLine("            {");
            //sb.AppendLine("                if (m_sysRolesDAL.CalcCount("RoleName='" + txtRoleName.Text.Trim() + "' and  KeyID !=" + m_sysRoles.KeyId + " ") > 0)");
            //sb.AppendLine("                {");
            //sb.AppendLine("                    MessageBox.Show(@"角色名称已经存在");");
            //sb.AppendLine("                    return;");
            //sb.AppendLine("                }");
            if (baseParameter is TreeEditDialogParameter)
            {
                TreeEditDialogParameter para = baseParameter as TreeEditDialogParameter;
                if (para.DontRepeatColumns.Trim() != string.Empty)
                {
                    string[] strColumnArray = para.DontRepeatColumns.Split(',');
                    if (strColumnArray.Length > 0)
                    {
                        foreach (Bse_UI ui in lstBseUiEdit)
                        {
                            if (strColumnArray.Contains(ui.ColumnName))
                            {
                                string strExistInfo = GenControlHelper.CreateExistInfo("m_" + strDalName, ui.ColumnName,
                                                                                       ui.LabelText, ui.ControlName, ui.ColumnType, ui.ControlNameSpace, OperationType.修改, strKeyId, strGlobalModelName);
                                sb.AppendLine(strExistInfo);
                            }
                        }
                    }
                }
            }
            sb.AppendLine("                 " + strGlobalModelName + " = EntityOperateManager.EditEntity(this.tabPage, " + strGlobalModelName + ");");
            sb.AppendLine("                bool blnReturn = m_" + strDalName + ".Update( " + strGlobalModelName + ");");
            sb.AppendLine("                if (blnReturn)");
            sb.AppendLine("                {");
            sb.AppendLine("                    MessageBox.Show(@\"修改成功\");");
            sb.AppendLine("                    " + strRetrunList + " = " + strGlobalListModelName + ";");
            sb.AppendLine("                    this.DialogResult = DialogResult.OK;");
            sb.AppendLine("                }");
            sb.AppendLine("                else");
            sb.AppendLine("                {");
            sb.AppendLine("                    MessageBox.Show(@\"修改失败\");");
            sb.AppendLine("                }");
            sb.AppendLine("            }");
            sb.AppendLine("        } ");

            sb.AppendLine("        private void btnClear_Click(object sender, EventArgs e)");
            sb.AppendLine("        {");
            sb.AppendLine("            ControlManager.ClearAll(this.tabPage);");
            sb.AppendLine("        }");

            sb.AppendLine("        private void dataNavigator_PositionChanged(object sender, EventArgs e)");
            sb.AppendLine("        {");
            sb.AppendLine("            if (dataNavigator.ListInfo == null)");
            sb.AppendLine("            {");
            sb.AppendLine("                return;");
            sb.AppendLine("            }");
            sb.AppendLine("            " + strGlobalModelName + " = " + strGlobalListModelName + "[this.dataNavigator.CurrentIndex];");
            sb.AppendLine("            DisplayData(  " + strGlobalModelName + ");");
            sb.AppendLine("        }");

            sb.AppendLine("        #endregion");
            #endregion

            #region 基础方法
            sb.AppendLine("          ");


            sb.AppendLine("        #region 基本方法");

            sb.AppendLine("        /// <summary>初始化绑定");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private void DoInitData()");
            sb.AppendLine("        {");
            //sb.AppendLine("            const string strBindSql = "SELECT 2 AS  Name , '管理员' AS  value UNION ALL  SELECT 3 AS  Name , '功城队' AS  value;SELECT 'cbkRemark '";");
            //sb.AppendLine("            BindClass bindClass = new BindClass()");
            //sb.AppendLine("            {");
            //sb.AppendLine("                SqlType = SqlType.SqlServer,");
            //sb.AppendLine("                BindSql = strBindSql");
            //sb.AppendLine("            };");
            //sb.AppendLine("            DataSet ds = BindSourceHelper.GetBindSourceDataSet(bindClass,GlobalHelp.Conn);");
            //sb.AppendLine("            CheckedComboBoxHelper.BindCheckedComboBox(cbkRemark, ds.Tables["cbkRemark"], "value", "Name");");
            string strBindSql = GenControlHelper.GetBindSourceEditSqlByTableName(parameter.TableName);
            if (!string.IsNullOrEmpty(strBindSql))
            {
                sb.AppendLine(" const string strBindEditSql=\"" + strBindSql + "\";");
                sb.AppendLine("  BindClass bindClass = new BindClass()");
                sb.AppendLine("  {");
                sb.AppendLine("     SqlType = SqlType.SqlServer,");
                sb.AppendLine("      BindSql =strBindEditSql");
                sb.AppendLine("   }; ");
                sb.AppendLine("DataSet ds =BindSourceHelper.GetBindSourceDataSet(bindClass,GlobalHelp.Conn); ");
                sb.AppendLine(GenControlHelper.GenBindDataSouce(parameter.TableName, PanelType.编辑面板));
            }
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>实体对象值显示至控件");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine(" /// <param name=\"model\">model</param>");
            sb.AppendLine("        private void DisplayData(" + strModelName + "  model)");
            sb.AppendLine("        {");
            sb.AppendLine("            EntityOperateManager.BindAll(this.tabPage, model);");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>检查输入合法性");
            sb.AppendLine("        /// ");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private string CheckInput()");
            sb.AppendLine("        {");
            //sb.AppendLine("            if (txtRoleName.Text.Trim() == string.Empty)");
            //sb.AppendLine("            {");
            //sb.AppendLine("                return "角色名称不能为空";");
            //sb.AppendLine("            }");
            if (baseParameter is TreeEditDialogParameter)
            {
                TreeEditDialogParameter para = baseParameter as TreeEditDialogParameter;
                if (para.CheckInputColumns.Trim() != string.Empty)
                {
                    string[] strColumnArray = para.CheckInputColumns.Split(',');
                    if (strColumnArray.Length > 0)
                    {
                        foreach (Bse_UI ui in lstBseUiEdit)
                        {
                            if (strColumnArray.Contains(ui.ColumnName))
                            {
                                string strAlertInfo = GenControlHelper.CreateAlertInfo(ui.ColumnName, ui.LabelText, ui.ControlNameSpace,
                                                                                       ui.ControlName);
                                sb.AppendLine(strAlertInfo);
                            }
                        }
                    }
                }
            }
            sb.AppendLine("            return string.Empty;");
            sb.AppendLine("        }");
            sb.AppendLine("        #endregion");
            #endregion
            sb.AppendLine("    }");
            sb.AppendLine("}");
            return(sb.ToString());
        }
Пример #24
0
        public override string GenWinFormDesign(BasicParameter parameter, BaseParameter baseParameter)
        {
            string        strFrmClassName = "Frm" + parameter.ClassName + "TreeDialog";
            List <Bse_UI> lstBseUiEdit    = BseUIManager.GetListUIEdit(parameter.TableName);
            int           lblWidth        = BseUIManager.GetCtlWidth("Label");
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("namespace " + parameter.NameSpace + "");
            sb.AppendLine("{");
            sb.AppendLine("    partial class " + strFrmClassName + "");
            sb.AppendLine("    {");
            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// Required designer variable.");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private System.ComponentModel.IContainer components = null;");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// Clean up any resources being used.");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine(
                "        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>");
            sb.AppendLine("        protected override void Dispose(bool disposing)");
            sb.AppendLine("        {");
            sb.AppendLine("            if (disposing && (components != null))");
            sb.AppendLine("            {");
            sb.AppendLine("                components.Dispose();");
            sb.AppendLine("            }");
            sb.AppendLine("            base.Dispose(disposing);");
            sb.AppendLine("        }");

            sb.AppendLine("        #region Windows Form Designer generated code");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// Required method for Designer support - do not modify");
            sb.AppendLine("        /// the contents of this method with the code editor.");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        private void InitializeComponent()");
            sb.AppendLine("        {");
            sb.AppendLine("            this.splitContainer1 = new System.Windows.Forms.SplitContainer();");
            sb.AppendLine("            this.tabControl = new System.Windows.Forms.TabControl();");
            sb.AppendLine("            this.tabPage = new System.Windows.Forms.TabPage();");
            //sb.AppendLine("            this.cbkRemark = new Nikita.WinForm.ExtendControl.CheckedComboBox();");
            //sb.AppendLine("            this.numSortNumber = new System.Windows.Forms.NumericUpDown();");
            //sb.AppendLine("            this.txtRoleName = new System.Windows.Forms.TextBox();");
            //sb.AppendLine("            this.chkisDefault = new System.Windows.Forms.CheckBox();");
            //sb.AppendLine("            this.lblRemark = new System.Windows.Forms.Label();");
            //sb.AppendLine("            this.lblSortNumber = new System.Windows.Forms.Label();");
            //sb.AppendLine("            this.lblRoleName = new System.Windows.Forms.Label();");
            #region 编辑面板控件

            foreach (Bse_UI ui in lstBseUiEdit)
            {
                if (ui.IsAddLable == "True")
                {
                    sb.AppendLine("this." + ui.LabelName + " = new System.Windows.Forms.Label();");
                    sb.AppendLine("            this." + ui.ControlName + " = new " + ui.ControlNameSpace + "();");
                }
                else
                {
                    sb.AppendLine("            this." + ui.ControlName + " = new " + ui.ControlNameSpace + "();");
                }
            }

            #endregion
            sb.AppendLine("            this.dataNavigator = new Nikita.WinForm.ExtendControl.DataNavigator();");
            sb.AppendLine("            this.btnClear = new System.Windows.Forms.Button();");
            sb.AppendLine("            this.btnSave = new System.Windows.Forms.Button();");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();");
            sb.AppendLine("            this.splitContainer1.Panel1.SuspendLayout();");
            sb.AppendLine("            this.splitContainer1.Panel2.SuspendLayout();");
            sb.AppendLine("            this.splitContainer1.SuspendLayout();");
            sb.AppendLine("            this.tabControl.SuspendLayout();");
            sb.AppendLine("            this.tabPage.SuspendLayout();");
            foreach (Bse_UI ui in lstBseUiEdit)
            {
                if (ui.ControlNameSpace == "System.Windows.Forms.NumericUpDown")
                {
                    sb.AppendLine("       ((System.ComponentModel.ISupportInitialize)(this." + ui.ControlName + ")).BeginInit();");
                }
            }
            sb.AppendLine("            this.SuspendLayout();");

            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;");
            sb.AppendLine("            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;");
            sb.AppendLine("            this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;");
            sb.AppendLine("            this.splitContainer1.Location = new System.Drawing.Point(0, 0);");
            sb.AppendLine("            this.splitContainer1.Name = \"splitContainer1\";");
            sb.AppendLine("            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1.Panel1");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.Panel1.Controls.Add(this.tabControl);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // splitContainer1.Panel2");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.splitContainer1.Panel2.Controls.Add(this.dataNavigator);");
            sb.AppendLine("            this.splitContainer1.Panel2.Controls.Add(this.btnClear);");
            sb.AppendLine("            this.splitContainer1.Panel2.Controls.Add(this.btnSave);");
            sb.AppendLine("            this.splitContainer1.Size = new System.Drawing.Size(434, 370);");
            sb.AppendLine("            this.splitContainer1.SplitterDistance = 317;");
            sb.AppendLine("            this.splitContainer1.TabIndex = 0;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // tabControl");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.tabControl.Controls.Add(this.tabPage);");
            sb.AppendLine("            this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;");
            sb.AppendLine("            this.tabControl.Location = new System.Drawing.Point(0, 0);");
            sb.AppendLine("            this.tabControl.Name = \"tabControl\";");
            sb.AppendLine("            this.tabControl.SelectedIndex = 0;");
            sb.AppendLine("            this.tabControl.Size = new System.Drawing.Size(432, 315);");
            sb.AppendLine("            this.tabControl.TabIndex = 1;");
            sb.AppendLine("            // ");
            sb.AppendLine("            // tabPage");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.tabPage.BackColor = System.Drawing.SystemColors.Control;");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.cbkRemark);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.numSortNumber);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.txtRoleName);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.chkisDefault);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.lblRemark);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.lblSortNumber);");
            //sb.AppendLine("            this.tabPage.Controls.Add(this.lblRoleName);");
            #region 编辑区控件

            foreach (Bse_UI ui in lstBseUiEdit)
            {
                if (ui.IsAddLable == "True")
                {
                    sb.AppendLine("            this.tabPage.Controls.Add(this." + ui.LabelName + ");");
                }
                sb.AppendLine("            this.tabPage.Controls.Add(this." + ui.ControlName + ");");
            }

            #endregion
            sb.AppendLine("            this.tabPage.Location = new System.Drawing.Point(4, 26);");
            sb.AppendLine("            this.tabPage.Name = \"tabPage\";");
            sb.AppendLine("            this.tabPage.Padding = new System.Windows.Forms.Padding(3);");
            sb.AppendLine("            this.tabPage.Size = new System.Drawing.Size(424, 285);");
            sb.AppendLine("            this.tabPage.TabIndex = 0;");
            sb.AppendLine("            this.tabPage.Text = \"基本信息\";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // cbkRemark");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.cbkRemark.CheckOnClick = true;");
            //sb.AppendLine("            this.cbkRemark.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;");
            //sb.AppendLine("            this.cbkRemark.DropDownHeight = 1;");
            //sb.AppendLine("            this.cbkRemark.FormattingEnabled = true;");
            //sb.AppendLine("            this.cbkRemark.IntegralHeight = false;");
            //sb.AppendLine("            this.cbkRemark.Location = new System.Drawing.Point(84, 54);");
            //sb.AppendLine("            this.cbkRemark.Name = "cbkRemark";");
            //sb.AppendLine("            this.cbkRemark.Size = new System.Drawing.Size(100, 24);");
            //sb.AppendLine("            this.cbkRemark.TabIndex = 7;");
            //sb.AppendLine("            this.cbkRemark.Tag = "Remark";");
            //sb.AppendLine("            this.cbkRemark.ValueSeparator = ", ";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // numSortNumber");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.numSortNumber.Location = new System.Drawing.Point(257, 16);");
            //sb.AppendLine("            this.numSortNumber.Name = "numSortNumber";");
            //sb.AppendLine("            this.numSortNumber.Size = new System.Drawing.Size(102, 23);");
            //sb.AppendLine("            this.numSortNumber.TabIndex = 6;");
            //sb.AppendLine("            this.numSortNumber.Tag = "Sortnum";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // txtRoleName");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.txtRoleName.Location = new System.Drawing.Point(84, 16);");
            //sb.AppendLine("            this.txtRoleName.Name = "txtRoleName";");
            //sb.AppendLine("            this.txtRoleName.Size = new System.Drawing.Size(100, 23);");
            //sb.AppendLine("            this.txtRoleName.TabIndex = 5;");
            //sb.AppendLine("            this.txtRoleName.Tag = "RoleName";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // chkisDefault");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.chkisDefault.AutoSize = true;");
            //sb.AppendLine("            this.chkisDefault.Location = new System.Drawing.Point(215, 57);");
            //sb.AppendLine("            this.chkisDefault.Name = "chkisDefault";");
            //sb.AppendLine("            this.chkisDefault.Size = new System.Drawing.Size(75, 21);");
            //sb.AppendLine("            this.chkisDefault.TabIndex = 4;");
            //sb.AppendLine("            this.chkisDefault.Tag = "isDefault";");
            //sb.AppendLine("            this.chkisDefault.Text = "是否默认";");
            //sb.AppendLine("            this.chkisDefault.UseVisualStyleBackColor = true;");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // lblRemark");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.lblRemark.AutoSize = true;");
            //sb.AppendLine("            this.lblRemark.Location = new System.Drawing.Point(27, 61);");
            //sb.AppendLine("            this.lblRemark.Name = "lblRemark";");
            //sb.AppendLine("            this.lblRemark.Size = new System.Drawing.Size(32, 17);");
            //sb.AppendLine("            this.lblRemark.TabIndex = 3;");
            //sb.AppendLine("            this.lblRemark.Text = "备注";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // lblSortNumber");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.lblSortNumber.AutoSize = true;");
            //sb.AppendLine("            this.lblSortNumber.Location = new System.Drawing.Point(212, 18);");
            //sb.AppendLine("            this.lblSortNumber.Name = "lblSortNumber";");
            //sb.AppendLine("            this.lblSortNumber.Size = new System.Drawing.Size(32, 17);");
            //sb.AppendLine("            this.lblSortNumber.TabIndex = 1;");
            //sb.AppendLine("            this.lblSortNumber.Text = "排序";");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            // lblRoleName");
            //sb.AppendLine("            // ");
            //sb.AppendLine("            this.lblRoleName.AutoSize = true;");
            //sb.AppendLine("            this.lblRoleName.Location = new System.Drawing.Point(18, 19);");
            //sb.AppendLine("            this.lblRoleName.Name = "lblRoleName";");
            //sb.AppendLine("            this.lblRoleName.Size = new System.Drawing.Size(60, 17);");
            //sb.AppendLine("            this.lblRoleName.TabIndex = 0;");
            //sb.AppendLine("            this.lblRoleName.Text = " 角色名称";");
            #region 编辑区控件明细位置

            BeginWidth = 15;
            foreach (Bse_UI ui in lstBseUiEdit)
            {
                int intCurrCtlWidth = BseUIManager.GetCtlWidth(ui.ControlType);
                if (ui.IsAddLable == "True")
                {
                    //控制位置
                    if (BeginWidth + lblWidth + intCurrCtlWidth > SumWidth)
                    {
                        QueryHeight += 1;
                        LocationX    = 15;
                        LocationY    = LocationY + HighSeed;
                        BeginWidth   = 15;
                        BeginWidth  += lblWidth + CtlSpace;
                    }
                    else
                    {
                        LocationX   = BeginWidth;
                        BeginWidth += lblWidth + CtlSpace;
                    }
                    sb.Append(GenControlHelper.CreateLabelControl(ui.LabelName, ui.LabelText, LocationX, LocationY));
                }

                //控制位置
                if (BeginWidth + intCurrCtlWidth > SumWidth)
                {
                    QueryHeight += 1;
                    LocationX    = 15;
                    LocationY    = LocationY + HighSeed;
                    BeginWidth   = 15;
                    BeginWidth  += intCurrCtlWidth + CtlSpace;
                }
                else
                {
                    LocationX   = BeginWidth;
                    BeginWidth += intCurrCtlWidth + CtlSpace;
                }
                sb.Append(GenControlHelper.CreateControl(ui.Ctl_Simple, ui.ControlName, LocationX, LocationY,
                                                         ui.ControlSort));
            }
            int hight = QueryHeight * (HighSeed + 5) + 30;
            if (hight < 87)
            {
                hight = 87;
            }
            sb.Replace("@QueryHeight@", hight.ToString());

            #endregion
            sb.AppendLine("            // ");
            sb.AppendLine("            // dataNavigator");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.dataNavigator.CurrentIndex = 0;");
            sb.AppendLine("            this.dataNavigator.Font = new System.Drawing.Font(\"微软雅黑\", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));");
            sb.AppendLine("            this.dataNavigator.ListInfo = null;");
            sb.AppendLine("            this.dataNavigator.Location = new System.Drawing.Point(5, 4);");
            sb.AppendLine("            this.dataNavigator.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);");
            sb.AppendLine("            this.dataNavigator.Name = \"dataNavigator\";");
            sb.AppendLine("            this.dataNavigator.Size = new System.Drawing.Size(249, 32);");
            sb.AppendLine("            this.dataNavigator.TabIndex = 2;");
            sb.AppendLine("            this.dataNavigator.PositionChanged += new Nikita.WinForm.ExtendControl.DataNavigator.PostionChangedEventHandler(this.dataNavigator_PositionChanged);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // btnClear");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.System;");
            sb.AppendLine("            this.btnClear.Location = new System.Drawing.Point(341, 8);");
            sb.AppendLine("            this.btnClear.Name = \"btnClear\";");
            sb.AppendLine("            this.btnClear.Size = new System.Drawing.Size(75, 28);");
            sb.AppendLine("            this.btnClear.TabIndex = 1;");
            sb.AppendLine("            this.btnClear.Text = \"清空\";");
            sb.AppendLine("            this.btnClear.UseVisualStyleBackColor = true;");
            sb.AppendLine("            this.btnClear.Click += new System.EventHandler(this.btnClear_Click);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // btnSave");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.System;");
            sb.AppendLine("            this.btnSave.Location = new System.Drawing.Point(261, 8);");
            sb.AppendLine("            this.btnSave.Name = \"btnSave\";");
            sb.AppendLine("            this.btnSave.Size = new System.Drawing.Size(75, 28);");
            sb.AppendLine("            this.btnSave.TabIndex = 0;");
            sb.AppendLine("            this.btnSave.Text = \"保存(&S)\";");
            sb.AppendLine("            this.btnSave.UseVisualStyleBackColor = true;");
            sb.AppendLine("            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);");
            sb.AppendLine("            // ");
            sb.AppendLine("            // " + strFrmClassName + "");
            sb.AppendLine("            // ");
            sb.AppendLine("            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);");
            sb.AppendLine("            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;");
            sb.AppendLine("            this.ClientSize = new System.Drawing.Size(434, 370);");
            sb.AppendLine("            this.Controls.Add(this.splitContainer1);");
            sb.AppendLine("            this.Font = new System.Drawing.Font(\"微软雅黑\", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));");
            sb.AppendLine("            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;");
            sb.AppendLine("            this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);");
            sb.AppendLine("            this.MaximizeBox = false;");
            sb.AppendLine("            this.MinimizeBox = false;");
            sb.AppendLine("            this.Name = \"" + strFrmClassName + "\";");
            sb.AppendLine("            this.ShowIcon = false;");
            sb.AppendLine("            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;");
            sb.AppendLine("            this.splitContainer1.Panel1.ResumeLayout(false);");
            sb.AppendLine("            this.splitContainer1.Panel2.ResumeLayout(false);");
            sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();");
            sb.AppendLine("            this.splitContainer1.ResumeLayout(false);");
            sb.AppendLine("            this.tabControl.ResumeLayout(false);");
            sb.AppendLine("            this.tabPage.ResumeLayout(false);");
            sb.AppendLine("            this.tabPage.PerformLayout();");
            foreach (Bse_UI ui in lstBseUiEdit)
            {
                if (ui.ControlNameSpace == "System.Windows.Forms.NumericUpDown")
                {
                    sb.AppendLine("            ((System.ComponentModel.ISupportInitialize)(this." + ui.ControlName + ")).EndInit();");
                }
            }
            sb.AppendLine("            this.ResumeLayout(false);");
            sb.AppendLine("        }");

            sb.AppendLine("        #endregion");

            sb.AppendLine("        private System.Windows.Forms.SplitContainer splitContainer1;");
            sb.AppendLine("        private System.Windows.Forms.TabControl tabControl;");
            sb.AppendLine("        private System.Windows.Forms.TabPage tabPage;");
            sb.AppendLine("        private System.Windows.Forms.Button btnClear;");
            sb.AppendLine("        private System.Windows.Forms.Button btnSave;");
            sb.AppendLine("        private WinForm.ExtendControl.DataNavigator dataNavigator;");
            //sb.AppendLine("        private System.Windows.Forms.Label lblSortNumber;");
            //sb.AppendLine("        private System.Windows.Forms.Label lblRoleName;");
            //sb.AppendLine("        private System.Windows.Forms.Label lblRemark;");
            //sb.AppendLine("        private System.Windows.Forms.CheckBox chkisDefault;");
            //sb.AppendLine("        private System.Windows.Forms.NumericUpDown numSortNumber;");
            //sb.AppendLine("        private System.Windows.Forms.TextBox txtRoleName;");
            //sb.AppendLine("        private WinForm.ExtendControl.CheckedComboBox cbkRemark;");
            #region 编辑区控件
            foreach (Bse_UI uiQuery in lstBseUiEdit)
            {
                if (uiQuery.IsAddLable == "True")
                {
                    sb.Append("        public  System.Windows.Forms.Label " + uiQuery.LabelName + ";\r\n");
                }
                sb.Append("        public " + uiQuery.ControlNameSpace + "  " + uiQuery.ControlName + ";\r\n");
            }
            #endregion
            sb.AppendLine("    }");
            sb.AppendLine("}");
            return(sb.ToString());
        }
Пример #25
0
        public bool CheckExists_Parameter(BasicParameter objBasicParameter)
        {
            var repository = ServiceFactory.GetService <IBasicParameterRepository>();

            return(repository.CheckExists(objBasicParameter));
        }