Exemplo n.º 1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (this.CheckInput())
     {
         TableEditSchema tableEditSchema = new TableEditSchema();
         tableEditSchema.TableName   = this._BusinessNodeInfo.TableName;
         tableEditSchema.RuleName    = "Biz" + this._BusinessNodeInfo.EntityName;
         tableEditSchema.EntityName  = this._BusinessNodeInfo.EntityName;
         tableEditSchema.BackUrl     = this.txtBackUrl.Text;
         tableEditSchema.Description = this._BusinessNodeInfo.Description;
         IEnumerator enumerator = ((IEnumerable)this.gvdData.Rows).GetEnumerator();
         while (enumerator.MoveNext())
         {
             DataGridViewRow  objDataGridViewRow = (DataGridViewRow)enumerator.Current;
             string           FieldName          = objDataGridViewRow.ReadCell("FieldName", "");
             ColumnEditSchema columnEditSchema   = this._CurrentColumnList.First((ColumnEditSchema s) => s.FieldName == FieldName);
             columnEditSchema.IsShow        = bool.Parse(objDataGridViewRow.ReadCell("IsShow", ""));
             columnEditSchema.ControlType   = objDataGridViewRow.ReadCell("ControlType", "");
             columnEditSchema.ErrorMessage  = objDataGridViewRow.ReadCell("ErrorMessage", "");
             columnEditSchema.FieldTitle    = objDataGridViewRow.ReadCell("FieldTitle", "");
             columnEditSchema.IsEmpty       = bool.Parse(objDataGridViewRow.ReadCell("IsEmpty", ""));
             columnEditSchema.ValidationReg = objDataGridViewRow.ReadCell("ValidationReg", "");
         }
         tableEditSchema.Columns = this._CurrentColumnList;
         foreach (ColumnEditSchema current in tableEditSchema.Columns)
         {
             current.EntityName = this._BusinessNodeInfo.EntityName;
         }
         tableEditSchema.Columns = this._CurrentColumnList;
         string text   = this._BusinessNodeInfo.EntityName + "Edit.aspx";
         string text2  = this._BusinessNodeInfo.EntityName + "Edit.aspx.cs";
         string uiPath = Common.GetUiPath(this.txtUIProjectPath.Text.Trim(new char[]
         {
             '\\'
         }), this._SelectFileInfo);
         string inherits = this.GetInherits(uiPath);
         if (string.IsNullOrWhiteSpace(inherits))
         {
             MessageBox.Show("Web项目名称输入有误");
         }
         else
         {
             string uiCode   = tableEditSchema.ToUiStringSql();
             string codeCode = tableEditSchema.ToCodeStringSql();
             Common.WriteCode(uiPath + "\\" + text, text, this.GetUiCode(uiCode, inherits), this.chkPreviewCode.Checked);
             Common.WriteCode(uiPath + "\\" + text2, text2, Common.GetCSCode(codeCode, this._SelectFileInfo.ProjectName, inherits), this.chkPreviewCode.Checked);
             this.UpdateXml(tableEditSchema);
         }
     }
 }
Exemplo n.º 2
0
        private void UpdateXml(TableEditSchema tableEditSchema)
        {
            XmlNode businessNode = this._CodeConfigHelper.GetBusinessNode(this._BusinessNodeInfo.TableName);

            if (businessNode == null)
            {
                MessageBox.Show(this._BusinessNodeInfo.TableName + "表未配置,请一键生成配置文件!");
            }
            else
            {
                XmlElement xmlElement = (XmlElement)businessNode;
                if (xmlElement.ReadAttribute("UIProjectName", "") != this.txtUIProjectName.Text || xmlElement.ReadAttribute("UIProjectPath", "") != this.txtUIProjectPath.Text || xmlElement.ReadAttribute("ListUrl", "") != this.txtBackUrl.Text)
                {
                    xmlElement.SetAttribute("UIProjectName", this.txtUIProjectName.Text);
                    xmlElement.SetAttribute("UIProjectPath", this.txtUIProjectPath.Text);
                    xmlElement.SetAttribute("ListUrl", this.txtBackUrl.Text);
                    this._CodeConfigHelper.Save();
                }
            }
        }