Beispiel #1
0
 /// <summary>
 /// Hiện cửa sổ cấu hình combobox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void mnuComboBox_Click(object sender, DirectEventArgs e)
 {
     try
     {
         FormElementInfo control = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
         if (control != null && string.IsNullOrEmpty(control.ControlConfig) == false && control.InputControl == InputControl_ComboBox)
         {
             string[] config = control.ControlConfig.Split(',');
             foreach (string item in config)
             {
                 if (item.StartsWith("table"))
                 {
                     cbTableComboBox.SetValue(item.Replace("table:", ""));
                 }
                 else if (item.StartsWith("value"))
                 {
                     cbValueColumn.SetValue(item.Replace("value:", ""));
                 }
                 else if (item.StartsWith("text"))
                 {
                     cbDisplayColumn.SetValue(item.Replace("text:", ""));
                 }
                 else if (item.StartsWith("allowInsert"))
                 {
                     chkAllowInsert.Checked = bool.Parse(item.Replace("allowInsert:", ""));
                 }
             }
         }
         wdSetComboBox.Show();
     }
     catch (Exception ex)
     {
         Dialog.ShowError("Base\\Window\\mnuComboBox_Click : " + ex.Message);
     }
 }
Beispiel #2
0
 protected void mnuImage_Click(object sender, DirectEventArgs e)
 {
     try
     {
         FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
         if (chkAllowChangeImage.Checked)
         {
             element.ControlConfig = txtImageFolderUrl.Text;
         }
         else
         {
             element.ControlConfig = "";
         }
         element.InputControl = InputControl_Image;
         if (element.GroupID.HasValue == false)
         {
             element.GroupID = 0;
         }
         FormElementController.GetInstance().Update(element);
         Dialog.ShowNotification("Thiết lập thành công !");
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
        /// <summary>
        /// Lưu thông số cấu hình AjaxSearch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSetAjaxSearch_Click(object sender, DirectEventArgs e)
        {
            try
            {
                FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
                element.InputControl  = InputControl_AjaxSearch;
                element.ControlConfig = string.Format(
                    "Table:{0},SearchField:{1},ValueField:{2},DisplayField:{3},PageSize:{4},AllowInsert:{5}",
                    cbTableSearch.SelectedItem.Value,
                    cbSearchField.SelectedItem.Value,
                    cbValueField.SelectedItem.Value,
                    cbDisplayField.SelectedItem.Value,
                    txtPageSize.Text,
                    chkAllowInsertAjaxSearch.Checked);
                if (element.GroupID.HasValue == false)
                {
                    element.GroupID = 0;
                }

                FormElementController.GetInstance().Update(element);
                wdSetAjaxSearch.Hide();
            }
            catch (Exception ex)
            {
                Dialog.ShowError(ex.Message);
            }
        }
Beispiel #4
0
    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;
            }
        }
    }
Beispiel #5
0
    protected void mnuHTMLInput_Click(object sender, DirectEventArgs e)
    {
        FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));

        if (!string.IsNullOrEmpty(element.ControlConfig))
        {
            txtHtmlHeight.Text = element.ControlConfig.Replace("Height:", "");
        }
        WdUpdateHtmlConfig.Show();
    }
Beispiel #6
0
    protected void btnUpdateHtmlConfig_Click(object sender, DirectEventArgs e)
    {
        FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));

        element.InputControl = InputControl_HTMLInput;
        if (string.IsNullOrEmpty(txtHtmlHeight.Text.Trim()) == false)
        {
            element.ControlConfig = "Height:" + txtHtmlHeight.Text;
        }
        if (element.GroupID.HasValue == false)
        {
            element.GroupID = 0;
        }
        FormElementController.GetInstance().Update(element);
        WdUpdateHtmlConfig.Hide();
        Dialog.ShowNotification("Thiết lập thành công !");
    }
Beispiel #7
0
 protected void btnSetDefaultControl_Click(object sender, DirectEventArgs e)
 {
     try
     {
         FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
         element.ControlConfig = "";
         element.InputControl  = "";
         if (element.GroupID.HasValue == false)
         {
             element.GroupID = 0;
         }
         FormElementController.GetInstance().Update(element);
         Dialog.ShowNotification("Chuyển về control mặc định thành công !");
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
Beispiel #8
0
 /// <summary>
 /// Cập nhật Boolean Control
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void wdBooleanControl_Click(object sender, DirectEventArgs e)
 {
     try
     {
         FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
         element.InputControl  = InputControl_RadioButton;
         element.ControlConfig = txtTrueLabel.Text + "," + txtFalseLabel.Text;
         if (element.GroupID.HasValue == false)
         {
             element.GroupID = 0;
         }
         FormElementController.GetInstance().Update(element);
         wdBooleanControl.Hide();
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
        /// <summary>
        /// Lưu layout
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveLayout_Click(object sender, DirectEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(hdfGroupID.Text))
                {
                    Dialog.ShowNotification("Bạn chưa chọn nhóm");
                    return;
                }

                int      groupid  = int.Parse(hdfGroupID.Text);
                string[] columnID = e.ExtraParams["order"].Split(',');
                int      position = 0;
                foreach (var item in columnID)
                {
                    if (!string.IsNullOrEmpty(item))
                    {
                        FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(item));
                        element.GroupID  = int.Parse(hdfGroupID.Text);
                        element.Position = position++;
                        FormElementController.GetInstance().Update(element);
                    }
                }

                string[] removedColumnID = hdfRemoveColumnID.Text.ToString().Split(',');
                foreach (string item in removedColumnID)
                {
                    if (!string.IsNullOrEmpty(item) && columnID.Where(p => p == item).Count() == 0)
                    {
                        DataHandler.GetInstance()
                        .ExecuteNonQuery("update FormElements set GroupID = NULL where ID = " + item);
                    }
                }

                hdfRemoveColumnID.Text = "";
            }
            catch (Exception ex)
            {
                Dialog.ShowError("btnSaveLayout_Click : " + ex.Message);
            }

            // Dialog.ShowNotification("Lưu cấu hình thành công", false);
        }
Beispiel #10
0
 /// <summary>
 /// Cấu hình combobox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnwdSetComboBox_Click(object sender, DirectEventArgs e)
 {
     try
     {
         FormElementInfo control = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));
         control.ControlConfig = string.Format("table:{0},text:{1},value:{2},allowInsert:{3}", cbTableComboBox.SelectedItem.Value,
                                               cbDisplayColumn.SelectedItem.Value,
                                               cbValueColumn.SelectedItem.Value,
                                               chkAllowInsert.Checked);
         control.InputControl = InputControl_ComboBox;
         if (control.GroupID.HasValue == false)
         {
             control.GroupID = 0;
         }
         FormElementController.GetInstance().Update(control);
         wdSetComboBox.Hide();
     }
     catch (Exception ex)
     {
         Dialog.ShowError("Form/btnwdSetComboBox_Click = " + ex.Message);
     }
 }
Beispiel #11
0
        /// <summary>
        /// Hiện window cấu hình AjaxSearch
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void mnuAjaxSearch_Click(object sender, DirectEventArgs e)
        {
            FormElementInfo element = FormElementController.GetInstance().Get(int.Parse(hdfRecordId.Text));

            if (!String.IsNullOrEmpty(element.ControlConfig) && element.InputControl.Equals(InputControl_AjaxSearch))
            {
                string[] config = element.ControlConfig.Split(',');
                foreach (string item in config)
                {
                    if (item.StartsWith("Table"))
                    {
                        cbTableSearch.SetValue(item.Replace("Table:", ""));
                    }
                    else if (item.StartsWith("SearchField"))
                    {
                        cbSearchField.SetValue(item.Replace("SearchField:", ""));
                    }
                    else if (item.StartsWith("ValueField"))
                    {
                        cbValueField.SetValue(item.Replace("ValueField:", ""));
                    }
                    else if (item.StartsWith("DisplayField"))
                    {
                        cbDisplayField.SetValue(item.Replace("DisplayField:", ""));
                    }
                    else if (item.StartsWith("PageSize"))
                    {
                        txtPageSize.Text = item.Replace("PageSize:", "");
                    }
                    else if (item.StartsWith("AllowInsert"))
                    {
                        chkAllowInsertAjaxSearch.Checked = bool.Parse(item.Replace("AllowInsert:", ""));
                    }
                }
            }

            wdSetAjaxSearch.Show();
        }