public override void Run() { if (this.Owner is ObjectNode) { ObjectNode owner = (ObjectNode) this.Owner; DAODataForm form = new DAODataForm(); form.Id = StringHelper.GetNewGuid(); form.Name = "新数据表单"; form.Description = "新数据表单"; form.BindTables = new List<DAODataTable>(); form.DataControls = new List<DataControl>(); form.Save(); owner.AddSingleNode<DAODataForm, DAODataFormNode>(form); } }
public override void SetFormPermission(FormPermission formPermission, DAODataForm ddf, bool saveEnable) { base.SetFormPermission(formPermission, ddf, saveEnable); try { if (base.Controls.Contains(this.tblData)) { this.tblData.SelectedTabPageIndex = formPermission.PageIndex; } } catch (Exception exception) { LoggingService.Error(exception); } if (saveEnable) { Control control; if (!StringHelper.IsNull(formPermission.UnableFrame)) { string[] strArray = StringHelper.Split(formPermission.UnableFrame); foreach (string str in strArray) { control = this.FindControl(str); if (control != null) { this.SetControlDisable(control); } } } if (!StringHelper.IsNull(formPermission.InVisibleFrame)) { string[] strArray2 = StringHelper.Split(formPermission.InVisibleFrame, ','); foreach (string str in strArray2) { control = this.FindControl(str); if (control != null) { if (control.GetType().FullName == "DevExpress.XtraTab.XtraTabPage") { ((XtraTabPage) control).PageVisible = false; } else { control.Visible = false; } if (LoggingService.IsDebugEnabled) { LoggingService.DebugFormatted("set {0} invisible", new object[] { control.Name }); } } } this.ResizeMe(); } } else if (base.Controls.Contains(this.tblData)) { foreach (XtraTabPage page in this.tblData.TabPages) { foreach (Control control2 in page.Controls) { control2.Enabled = false; } } } }
public static ParticipantFormPermission GetFormPermissionsOfCurrentStaff(DAODataForm form) { SmPrincipal smPrincipal = SecurityUtil.GetSmPrincipal(); SmIdentity identity = smPrincipal.Identity as SmIdentity; bool flag = (identity.AdminLevel == AdminLevelType.Admin) || (identity.AdminLevel == AdminLevelType.AdminData); string userId = identity.UserId; string key = "new_2_formpermission_" + form.Id + "_" + userId; ParticipantFormPermission permission = DAOCacheService.Get(key) as ParticipantFormPermission; if ((permission == null) || (permission.DaoDataFormId != form.Id)) { permission = new ParticipantFormPermission(); List<ParticipantFormPermission> list = new List<ParticipantFormPermission>(); if (form != null) { List<string> tmplist = new List<string>(smPrincipal.Participants); foreach (ParticipantFormPermission permission2 in ParticipantFormPermissions) { if ((permission2.DaoDataFormId == form.Id) && (flag || tmplist.Contains(permission2.ParticipantId))) { list.Add(permission2); } } } ParticipantFormPermission permission3 = null; StringBuilder sb = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); int count = list.Count; for (int i = 0; i < count; i++) { permission3 = list[i]; permission.DaoDataFormId = form.Id; if (i == 0) { if (!flag) { sb.Append(permission3.UnableFrame); builder2.Append(permission3.InVisibleFrame); permission.PageIndex = permission3.PageIndex; } permission.EnableDelete = permission3.EnableDelete; permission.PrintSetId = permission3.PrintSetId; } else { if (!flag) { sb.Append(",").Append(permission3.UnableFrame); builder2.Append(",").Append(permission3.InVisibleFrame); } if (!string.IsNullOrEmpty(permission3.PrintSetId)) { permission.PrintSetId = permission.PrintSetId + "," + permission3.PrintSetId; } if (!(!permission3.EnableDelete || permission.EnableDelete)) { permission.EnableDelete = true; } } } if (count == 1) { permission.UnableFrame = sb.ToString(); permission.InVisibleFrame = builder2.ToString(); } else if (count > 1) { permission.UnableFrame = GetUnablePerms(sb, count); permission.InVisibleFrame = GetUnablePerms(builder2, count); } if ((count == 0) && flag) { permission.DaoDataFormId = form.Id; } DAOCacheService.Put(key, permission); } if (StringHelper.IsNull(permission.DaoDataFormId)) { return null; } return permission; }
private void cmbDataForms_SelectedIndexChanged(object sender, EventArgs e) { this.daoDataForm = (DAODataForm) this.cmbDataForms.SelectedItem; if (this.daoDataForm != null) { this.gcDataControls.DataSource = null; this.gcDataControls.DataSource = this.daoDataForm.DataControls; this.gvDataControls.BestFitColumns(); } }
public virtual void SetFormPermission(FormPermission formPermission, DAODataForm ddf, bool saveEnable) { this.DataFormConntroller.SetFormPermission(formPermission, ddf, saveEnable); }
private void SyncDataSouce(string keyValue, DAODataForm form, DBConnection dbcn) { try { StringBuilder sb = new StringBuilder(); foreach (DataControl control in form.DataControls) { if (!string.IsNullOrEmpty(control.ValueDataSource)) { if (control.MapColumn != null) { object syncValue = this.GetSyncValue(control.ValueDataSource, keyValue); LoggingService.DebugFormatted("将同步业务:{0} 字段:{1} 到值:{2}", new object[] { keyValue, control.MapColumn.Name, syncValue }); if (!((syncValue == null) || Convert.IsDBNull(syncValue))) { sb.AppendFormat("update {0} set {1}='{2}' where {3}='{4}' and ({1} is null or {1}!='{2}');\r\n", new object[] { control.MapTable.Name, control.MapColumn.Name, syncValue.ToString().Replace("'", "''"), control.MapTable.Key, keyValue }); } } else { int? nullable = dbcn.ExecuteSql<int?>(string.Format("select count(1) from {0} where {1}='{2}'", control.MapTable.Name, control.MapTable.RelKey, keyValue)); if (!(nullable.HasValue && (nullable.Value > 1))) { DataTable syncDataTable = this.GetSyncDataTable(control.ValueDataSource, keyValue); this.BuildLowLevelSyncSQL(sb, nullable.Value, syncDataTable, control.MapTable, keyValue); } } } } if (sb.Length > 0) { LoggingService.DebugFormatted("将执行SQL语句:{0}", new object[] { sb.ToString() }); dbcn.ExecuteSql(sb.ToString()); } } catch (Exception exception) { LoggingService.Error("执行同步数据时出错:", exception); } }