protected void GroupStore_Change(object sender, DirectEventArgs e) { if (string.IsNullOrEmpty(hdfGroupID.Text)) { return; } FormGroupInfo groupInfo = FormGroupController.GetInstance().Get(int.Parse(hdfGroupID.Text)); List <FormElementInfo> columnfield = groupInfo.GetFormElements(1); string menuStr = "<li style='display:none;'></li>"; foreach (FormElementInfo field in columnfield) { menuStr = string.Concat(menuStr, string.Format("<li id='{0}'>{1}<b onclick=RemoveField('{2}')>.</b></li>", field.ID.ToString(), field.LabelName, field.ID.ToString())); } string output = @" <div class='demo'> <ul id='sortable'> {0} </ul> </div>"; lblOutput.Html = string.Format(output, menuStr); txtGroupTitle.Text = groupInfo.Title; txtWidth.Text = groupInfo.Width.ToString(); txtHeight.Text = groupInfo.Height.ToString(); cbFormLayout.SelectedIndex = (groupInfo.Layout == "RowLayout") ? 0 : 1; chkDisplayText.Checked = groupInfo.DisplayText; chkIsTab.Checked = groupInfo.IsTab; for (int i = 0; i < 3; i++) { if (groupInfo.LabelAlign.Equals(cbLabelAlign.Items[i].Value)) { cbLabelAlign.SelectedIndex = i; break; } } if (groupInfo.ParentID != 0) { int index = 0; foreach (Ext.Net.ListItem item in cbGroup2.Items) { if (item.Value == groupInfo.ParentID.ToString()) { cbGroup2.SelectedIndex = index++; cbGroup2.SetValue(groupInfo.ParentID); break; } } } else { cbGroup2.Clear(); } hdfCommand.Text = "update"; }
private void ToolStripMenuItemGroupInfo_Click(object sender, EventArgs e) { FormGroupInfo PageForm = new FormGroupInfo(); PageForm.m_DbAdaHelper = CGlobalInstance.Instance.m_UserDbAdaHelper; PageForm.ShowDialog(); PageForm.Dispose(); }
public void UpdateGroup(object index, string nodeName, object nodeID, object newParentNodeID) { int i = int.Parse(index.ToString()); if (nodeName.Contains("_") == false) //Cập nhật thông tin FormGroup { try { List <FormGroupInfo> sameParentGroup = (from t in FormGroupController.GetInstance().GetByParentID(int.Parse(newParentNodeID.ToString())) where t.Position >= i select t).ToList(); foreach (var item in sameParentGroup) { item.Position += 1; FormGroupController.GetInstance().Update(item); } FormGroupInfo group = FormGroupController.GetInstance().Get(int.Parse(nodeID.ToString())); group.ParentID = int.Parse(newParentNodeID.ToString()); group.Position = int.Parse(index.ToString()); FormGroupController.GetInstance().Update(group); } catch (Exception ex) { Dialog.ShowError("FormConfigLayout/UpdateGroup " + ex.Message); } } else //Cập nhật thông tin Control { try { int controlId = int.Parse(nodeID.ToString()); int groupID = int.Parse(newParentNodeID.ToString()); if (_formInfo == null) { _formInfo = FormController.GetInstance().GetForm(_FormName); } List <FormElementInfo> controlList = (from t in FormElementController.GetInstance().GetFormElements(_formInfo.ID, 1) where t.Position >= i && t.GroupID == groupID select t).ToList(); foreach (var item in controlList) { item.Position += 1; FormElementController.GetInstance().Update(item); } FormElementInfo controlInfo = FormElementController.GetInstance().Get(controlId); controlInfo.Position = i; controlInfo.GroupID = groupID; FormElementController.GetInstance().Update(controlInfo); } catch (Exception ex) { Dialog.ShowError("FormConfigLayout/UpdateGroup/Update control = " + ex.Message); throw; } } }
/// <summary> /// lấy các phần tử(control) trong nhóm đưa lên tree /// </summary> /// <param name="parent"></param> /// <param name="group"></param> private void LoadControl(Ext.Net.TreeNode parent, FormGroupInfo group) { List <FormElementInfo> element = group.GetFormElements(1); if (element.Count() == 0) { parent.Expanded = true; } else { foreach (FormElementInfo item in element) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = item.LabelName + "_"; node.NodeID = item.ID.ToString(); node.Leaf = true; // node.Disabled = true; parent.Nodes.Add(node); } } }
protected void btnSaveFormGroupInformation_Click(object sender, DirectEventArgs e) { if (hdfCommand.Text == "insert") { try { int groupid = 0; if (!string.IsNullOrEmpty(cbGroup2.SelectedItem.Value)) { groupid = int.Parse(cbGroup2.SelectedItem.Value); } if (_formInfo == null) { _formInfo = FormController.GetInstance().GetForm(_FormName); } double width = 0; if (txtWidth.Text.Contains("0.")) { width = Convert.ToDouble(txtWidth.Text) / 10; } else { width = Convert.ToDouble(txtWidth.Text); } int id = FormGroupController.GetInstance().CreateFormGroup(new FormGroupInfo(0, txtGroupTitle.Text, 0, _formInfo.ID, width, int.Parse(txtHeight.Text), groupid, cbFormLayout.SelectedItem.Text, chkDisplayText.Checked, cbLabelAlign.SelectedItem.Value, chkIsTab.Checked )); //reload lại store nhóm cấp trên GroupStoreRefresh(sender, null); //có khả năng gây lỗi } catch (Exception ex) { Dialog.ShowError(ex.Message); } txtGroupTitle.Text = ""; txtHeight.Text = "0"; txtWidth.Text = "0"; chkDisplayText.Checked = false; cbFormLayout.SelectedIndex = 0; } else if (hdfCommand.Text == "update") { try { FormGroupInfo formGroupInfo = FormGroupController.GetInstance().Get(int.Parse(hdfGroupID.Text)); formGroupInfo.DisplayText = chkDisplayText.Checked; formGroupInfo.Title = txtGroupTitle.Text; if (txtWidth.Text.Contains("0.")) { formGroupInfo.Width = double.Parse(txtWidth.Text) / 10; } else { formGroupInfo.Width = double.Parse(txtWidth.Text); } formGroupInfo.Height = int.Parse(txtHeight.Text); formGroupInfo.Layout = cbFormLayout.SelectedItem.Text; formGroupInfo.LabelAlign = cbLabelAlign.SelectedItem.Value; formGroupInfo.IsTab = chkIsTab.Checked; if (!string.IsNullOrEmpty(cbGroup2.SelectedItem.Value)) { formGroupInfo.ParentID = int.Parse(cbGroup2.SelectedItem.Value); } FormGroupController.GetInstance().Update(formGroupInfo); } catch (Exception ex) { Dialog.ShowNotification(ex.Message); } } // hdfCommand.Text = ""; // }