Ejemplo n.º 1
0
 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
 {
     if (e.CommandName == "UDISABLED")
     {
         //编辑权限
         if (!VerifyPurview(",SM-SET,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
         bool          checkState = checkField.GetCheckedState(e.RowIndex);
         int           result     = new PCBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState);
         string        tipText    = (checkState ? "禁用" : "启用");
         if (result > 0)
         {
             Alert.ShowInParent(tipText + "成功!");
             BindData();
         }
         else
         {
             Alert.ShowInParent(tipText + "失败!");
         }
     }
     if (e.CommandName == "Edit")
     {
         txtID.Text          = Grid1.DataKeys[e.RowIndex][0].ToString();
         txtName.Text        = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][1].ToString());
         txtCode.Text        = HttpUtility.HtmlDecode(Grid1.DataKeys[e.RowIndex][2].ToString()).Split('-')[1];
         chkDisabled.Checked = Convert.ToBoolean(Grid1.DataKeys[e.RowIndex][3].ToString());
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Grid1行点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
        {
            string rowID = Grid1.DataKeys[e.RowIndex][0].ToString();

            //string parentId = Grid1.DataKeys[e.RowIndex][1].ToString();
            if (e.CommandName == "IsSelected")
            {
                CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected");
                if (checkField.GetCheckedState(e.RowIndex))
                {
                    if (!list.Contains(rowID))
                    {
                        list.Add(rowID);
                    }
                    //if (!parentIds.Contains(parentId + "," + rowID))
                    //{
                    //    parentIds.Add(parentId + "," + rowID);
                    //}
                }
                else
                {
                    if (list.Contains(rowID))
                    {
                        list.Remove(rowID);
                    }
                    //if (parentIds.Contains(parentId + "," + rowID))
                    //{
                    //    parentIds.Remove(parentId + "," + rowID);
                    //}
                }
            }
        }
Ejemplo n.º 3
0
 protected void btn_rePush_Click(object sender, EventArgs e)
 {
     try
     {
         //是否存在非异常单
         CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
         string        sqlCmd = string.Empty;
         foreach (GridRow row in Grid1.Rows)
         {
             int  rowIndex = row.RowIndex;
             bool isSel    = field1.GetCheckedState(rowIndex);
             if (isSel)
             {
                 string apiState = row.Values[7].ToString();//API状态
                 int    rowID    = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                 if (apiState != "异常")
                 {
                     continue;
                 }
                 else
                 {
                     sqlCmd = "update sfyordertab set isnew='0' where SOId='" + rowID + "'";
                     SqlSel_Pro.ExeSql(sqlCmd);
                 }
             }
         }
         Alert.Show("操作成功!");
         reBound();
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }
Ejemplo n.º 4
0
 public CheckBoxFieldViewModel(CheckBoxField checkBoxField) : base(checkBoxField)
 {
     CheckBoxField    = checkBoxField;
     Content          = checkBoxField.Content;
     IsChecked        = CheckBoxField.DefaultIsChecked;
     DefaultIsChecked = CheckBoxField.DefaultIsChecked;
 }
        private void AddCheckBoxConfigurationRows(FormGroup group, CheckBoxFieldViewModel element)
        {
            var textField = new TextField("defaultItem", LabelPosition.AboveElement, "Default Item",
                                          new ValidationRule <TextField>[]
            {
            }, element.Content);

            var checkedField = new CheckBoxField("checkbox", LabelPosition.AboveElement, "Default Value",
                                                 new ValidationRule <CheckBoxField>[]
            {
            }, element.Content, element.DefaultIsChecked);

            textField.OnFormEvent += (s, e) =>
            {
                if (e is TextFieldChangedEventArgs eventArgs)
                {
                    element.Content = eventArgs.NewContent;
                }
            };

            checkedField.OnFormEvent += (s, e) =>
            {
                if (e is CheckBoxFieldChangedEventArgs eventArgs)
                {
                    element.DefaultIsChecked = eventArgs.NewValue;
                }
            };

            group.Rows.Add(new FormRow(1, new[]
            {
                new FormColumn(1, textField),
                new FormColumn(1, checkedField)
            }));
        }
        /// <summary>
        /// 这个事件会在渲染每一行前调用,因此改变了列的属性,那么渲染每一行时此列的属性都发生了变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e)
        {
            LinkButtonField lbfAction1  = Grid1.FindColumn("lbfAction1") as LinkButtonField;
            LinkButtonField lbfAction2  = Grid1.FindColumn("lbfAction2") as LinkButtonField;
            CheckBoxField   cbxAtSchool = Grid1.FindColumn("cbxAtSchool") as CheckBoxField;

            if (e.RowIndex < 5)
            {
                cbxAtSchool.Enabled = true;
                lbfAction1.Enabled  = true;
                lbfAction2.Enabled  = true;
            }
            else
            {
                cbxAtSchool.Enabled = false;
                lbfAction1.Enabled  = false;
                lbfAction2.Enabled  = false;
            }

            // 如果绑定到 DataTable,那么这里的 DataItem 就是 DataRowView
            HyperLinkField linkField = Grid1.Columns[4] as HyperLinkField;
            DataRowView    row       = e.DataItem as DataRowView;

            if (row != null)
            {
                linkField.DataTextFormatString = "{0} (" + row["EntranceYear"].ToString() + ")";
            }
        }
Ejemplo n.º 7
0
        public void CheckBoxField_CreateField()
        {
            PokerCheckBoxField field = new PokerCheckBoxField();
            CheckBoxField      blank = (CheckBoxField)field.DoCreateField();

            Assert.IsNotNull(blank, "CreateField");
        }
Ejemplo n.º 8
0
 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
 {
     if (e.CommandName == "UDISABLED")
     {
         //上架操作权限
         if (!VerifyPurview(",SU-EDIT,"))
         {
             Alert.ShowInParent(CHECK_POWER_FAIL_ACTION_MESSAGE);
             return;
         }
         CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
         bool          checkState = checkField.GetCheckedState(e.RowIndex);
         int           result     = new UserBLL().SetDisabled(Convert.ToInt32(Grid1.DataKeys[e.RowIndex][0]), checkState);
         string        tipText    = checkState ? "禁用" : "启用";
         if (result > 0)
         {
             Alert.ShowInParent(tipText + "成功!");
             BindData();
         }
         else
         {
             Alert.ShowInParent(tipText + "失败!");
         }
     }
 }
Ejemplo n.º 9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            CheckBoxField field2 = (CheckBoxField)Grid1.FindColumn("CheckBoxField2");

            StringBuilder sb            = new StringBuilder();
            int           selectedCount = Grid1.SelectedRowIndexArray.Length;

            if (selectedCount > 0)
            {
                sb.AppendFormat("共选中了 {0} 行:", selectedCount);
                sb.Append("<ol class=\"result\">");
                for (int i = 0; i < selectedCount; i++)
                {
                    int rowIndex = Grid1.SelectedRowIndexArray[i];
                    sb.Append("<li><ul>");

                    sb.AppendFormat("<li>行号:{0}</li>", rowIndex + 1);
                    sb.AppendFormat("<li>是否在校(自动会发):{0}</li>", field2.GetCheckedState(rowIndex));

                    sb.Append("</ul></li>");
                }
                sb.Append("</ol>");
            }
            else
            {
                sb.Append("<strong>没有选中任何一行!</strong>");
            }

            labResult.Text = sb.ToString();
        }
Ejemplo n.º 10
0
        public override DataControlField RenderInTable()
        {
            CheckBoxField field = new CheckBoxField();

            field.HeaderText = column.Header;
            field.DataField  = column.Text;
            return(field);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="frm">The parent form</param>
 /// <param name="field">The fied to be edited</param>
 public CheckBoxFieldDefinition(MainForm frm, CheckBoxField field) : base(frm)
 {
     InitializeComponent();
     this.mode  = FormMode.Edit;
     this.field = field;
     this.page  = field.Page;
     LoadFormData();
 }
    private void InitGridView(DateTime begindate, DateTime enddate)
    {
        DateTime day = begindate;

        ViewState["FirstDateColumnIndex"] = gv_List.Columns.Count;

        while (day <= enddate)
        {
            CheckBoxField cbfield = new CheckBoxField();

            #region 转换星期几的名称
            string week = "";
            switch (day.DayOfWeek)
            {
            case DayOfWeek.Monday:
                week = "一";
                break;

            case DayOfWeek.Tuesday:
                week = "二";
                break;

            case DayOfWeek.Wednesday:
                week = "三";
                break;

            case DayOfWeek.Thursday:
                week = "四";
                break;

            case DayOfWeek.Friday:
                week = "五";
                break;

            case DayOfWeek.Saturday:
                week = "<font color=red>六</font>";
                break;

            case DayOfWeek.Sunday:
                week = "<font color=red>日</font>";
                break;

            default:
                break;
            }
            #endregion

            cbfield.HeaderText = day.ToString("M.d") + "<br/>" + week;
            cbfield.DataField  = "P" + day.ToString("MMdd");
            gv_List.Columns.Add(cbfield);

            day = day.AddDays(1);
        }
        if (620 + (enddate - begindate).Days * 40 > 1024)
        {
            gv_List.Width = new Unit(620 + (enddate - begindate).Days * 40);
        }
    }
Ejemplo n.º 13
0
        public void AddCheckBoxField(String header, String dataField, Int32 percentWidth)
        {
            CheckBoxField checkBoxField = new CheckBoxField();

            checkBoxField.HeaderText      = header;
            checkBoxField.DataField       = dataField;
            checkBoxField.ItemStyle.Width = Unit.Percentage(percentWidth);
            this.Columns.Add(checkBoxField);
        }
Ejemplo n.º 14
0
        private static void CreateFields(RadFixedDocument document)
        {
            CheckBoxField check = new CheckBoxField("checkBox");

            document.AcroForm.FormFields.Add(check);
            check.IsChecked = true;

            ComboBoxField combo = new ComboBoxField("combo");

            document.AcroForm.FormFields.Add(combo);
            combo.Options.Add(new ChoiceOption("Combo choice 1"));
            combo.Options.Add(new ChoiceOption("Combo choice 2"));
            combo.Options.Add(new ChoiceOption("Combo choice 3"));
            combo.Options.Add(new ChoiceOption("Combo choice 4"));
            combo.Options.Add(new ChoiceOption("Combo choice 5"));
            combo.Value = combo.Options[2];

            CombTextBoxField comb = new CombTextBoxField("comb");

            document.AcroForm.FormFields.Add(comb);
            comb.MaxLengthOfInputCharacters = 10;
            comb.Value = "0123456789";

            ListBoxField list = new ListBoxField("list");

            document.AcroForm.FormFields.Add(list);
            list.AllowMultiSelection = true;
            list.Options.Add(new ChoiceOption("List choice 1"));
            list.Options.Add(new ChoiceOption("List choice 2"));
            list.Options.Add(new ChoiceOption("List choice 3"));
            list.Options.Add(new ChoiceOption("List choice 4"));
            list.Options.Add(new ChoiceOption("List choice 5"));
            list.Options.Add(new ChoiceOption("List choice 6"));
            list.Options.Add(new ChoiceOption("List choice 7"));
            list.Value = new ChoiceOption[] { list.Options[0], list.Options[2] };

            PushButtonField push = new PushButtonField("push");

            document.AcroForm.FormFields.Add(push);

            RadioButtonField radio = new RadioButtonField("radio");

            document.AcroForm.FormFields.Add(radio);
            radio.Options.Add(new RadioOption("Radio option 1"));
            radio.Options.Add(new RadioOption("Radio option 2"));
            radio.Value = radio.Options[1];

            SignatureField signature = new SignatureField("signiture");

            document.AcroForm.FormFields.Add(signature);

            TextBoxField textBox = new TextBoxField("textBox");

            document.AcroForm.FormFields.Add(textBox);
            textBox.Value = "Sample text...";
        }
Ejemplo n.º 15
0
        public void CheckBoxField_CopyProperties()
        {
            PokerCheckBoxField field = new PokerCheckBoxField();
            CheckBoxField      copy  = new CheckBoxField();

            field.DataField = "test";
            field.Text      = "test";
            field.DoCopyProperties(copy);
            Assert.AreEqual("test", copy.Text, "Text");
            Assert.AreEqual("test", copy.DataField, "DataField");
        }
Ejemplo n.º 16
0
        private static BaseField GetCheckBox(PbBaseControlInfo pbCtl)
        {
            PbCheckboxInfo pbChk = (PbCheckboxInfo)pbCtl;
            CheckBoxField  ngChk = new CheckBoxField();

            ngChk.ID         = pbChk.Id;
            ngChk.Name       = pbChk.Name;
            ngChk.FieldLabel = pbChk.LeftText;
            ngChk.MustInput  = pbChk.IsMustInput;
            ngChk.XType      = "ngCheckbox";
            return(ngChk);
        }
Ejemplo n.º 17
0
 protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
 {
     if (e.CommandName == "CheckBox1")
     {
         CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
         bool          checkState = checkField.GetCheckedState(e.RowIndex);
         Alert.ShowInTop(String.Format("你点击了第 {0} 行,第 {1} 列,选中状态:{2}", e.RowIndex + 1, e.ColumnIndex + 1, checkState));
     }
     else if (e.CommandName == "Action1" || e.CommandName == "Action2")
     {
         Alert.ShowInTop(String.Format("你点击了第 {0} 行,第 {1} 列,行命令是 {2}", e.RowIndex + 1, e.ColumnIndex + 1, e.CommandName));
     }
 }
Ejemplo n.º 18
0
        private void EditForm_ChangeType(ActionType type, Guid actionId)
        {
            EditForm.Fields[2].Visible = true;                                 // NavigateUrl
            EditForm.Fields[3].Visible = true;                                 // OrderNumber
            EditForm.Fields[4].Visible = true;                                 // AuthenticationRequired
            CheckBoxField checkBoxField = EditForm.Fields[5] as CheckBoxField; // InstanceRequired

            if (checkBoxField != null)
            {
                checkBoxField.Visible = FrameworkConfiguration.Current.WebApplication.EnableMultipleInstances;
            }
            EditForm.Fields[6].Visible = true;  // Visible
            EditForm.Fields[7].Visible = false; // AlternativeParents

            EditForm_SetSubmenuFieldsVisible(false);
            EditForm_SetDetailMenuFieldsVisible(false);

            AlternativeParentsTree.Visible    = false;
            AlternativeParentsTree.DataSource = null;

            switch (type)
            {
            case ActionType.GlobalNavigationLink:
                EditForm.Fields[5].Visible = false;     // InstanceRequired
                break;

            case ActionType.Control:
                EditForm.Fields[2].Visible = false;     // NavigateUrl
                EditForm.Fields[3].Visible = false;     // OrderNumber
                EditForm.Fields[4].Visible = false;     // AuthenticationRequired
                EditForm.Fields[5].Visible = false;     // InstanceRequired
                EditForm.Fields[6].Visible = false;     // Visible
                break;

            case ActionType.Page:
                // AlternativeParents
                m_AlternativeParentActionsIdList = ActionProvider.GetAlternativeParentActionsIdList(actionId);
                if ((m_AlternativeParentActionsIdList != null) && (m_AlternativeParentActionsIdList.Count > 0))
                {
                    EditForm.Fields[7].Visible = true;     // AlternativeParents
                    AlternativeParentsTree_DataBind(actionId);
                }
                else
                {
                    EditForm.Fields[7].Visible = false;     // AlternativeParents
                }
                EditForm_SetSubmenuFieldsVisible(true);
                EditForm_SetDetailMenuFieldsVisible(true);
                break;
            }
        }
Ejemplo n.º 19
0
        private void ChangeCheckBoxStatus(bool checkedState)
        {
            CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
            CheckBoxField field2 = (CheckBoxField)Grid1.FindColumn("CheckBoxField2");
            CheckBoxField field3 = (CheckBoxField)Grid1.FindColumn("CheckBoxField3");


            foreach (int rowIndex in Grid1.SelectedRowIndexArray)
            {
                field1.SetCheckedState(rowIndex, checkedState);
                field2.SetCheckedState(rowIndex, checkedState);
                field3.SetCheckedState(rowIndex, checkedState);
            }
        }
        protected void Grid1_RowClick(object sender, FineUI.GridRowClickEventArgs e)
        {
            bool checkedState = false;

            if (new List <int>(Grid1.SelectedRowIndexArray).Contains(e.RowIndex))
            {
                checkedState = true;
            }

            CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
            CheckBoxField field2 = (CheckBoxField)Grid1.FindColumn("CheckBoxField2");
            CheckBoxField field3 = (CheckBoxField)Grid1.FindColumn("CheckBoxField3");

            field1.SetCheckedState(e.RowIndex, checkedState);
            field2.SetCheckedState(e.RowIndex, checkedState);
            field3.SetCheckedState(e.RowIndex, checkedState);
        }
Ejemplo n.º 21
0
        public void PutCheckBoxFieldTest()
        {
            const string name = "PdfWithAcroForm.pdf";

            UploadFile(name, name);
            var checkBox = new CheckBoxField(PageIndex: 1, IsGroup: false, _Checked: true)
            {
                Color       = new Color(255, 255, 0, 0),
                Rect        = new Rectangle(100, 100, 200, 200),
                ExportValue = "true",
                PartialName = "testField",
                Style       = BoxStyle.Star
            };

            var response =
                PdfApi.PutCheckBoxField(name, fieldName: "checkboxField", field: checkBox, folder: TempFolder);

            Assert.That(response.Code, Is.EqualTo(200));
        }
Ejemplo n.º 22
0
        protected void Grid1_RowClick(object sender, FineUI.GridRowClickEventArgs e)
        {
            //Alert.ShowInTop(String.Format("你点击了第 {0} 行(单击)", e.RowIndex + 1));

            bool checkedState = false;

            if (new List <int>(Grid1.SelectedRowIndexArray).Contains(e.RowIndex))
            {
                checkedState = true;
            }

            CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
            CheckBoxField field2 = (CheckBoxField)Grid1.FindColumn("CheckBoxField2");
            CheckBoxField field3 = (CheckBoxField)Grid1.FindColumn("CheckBoxField3");

            // Grid1.Rows[e.RowIndex].States[field1.ColumnIndex] = true;
            field1.SetCheckedState(e.RowIndex, checkedState);
            field2.SetCheckedState(e.RowIndex, checkedState);
            field3.SetCheckedState(e.RowIndex, checkedState);
        }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            gvSchedules.DataSource = scheduleFactory.getAll().OrderByDescending(schedule => schedule.id).ToList();

            BoundField id = new BoundField();
            id.DataField  = "id";
            id.HeaderText = "事項編號";

            BoundField user_id = new BoundField();
            user_id.DataField  = "user_id";
            user_id.HeaderText = "評估人編號";

            BoundField patient_id = new BoundField();
            patient_id.DataField  = "patient_id";
            patient_id.HeaderText = "住民編號";

            BoundField assess_name = new BoundField();
            assess_name.DataField  = "assess_name";
            assess_name.HeaderText = "評估表名稱";

            BoundField deadLine = new BoundField();
            deadLine.DataField        = "deadLine";
            deadLine.HeaderText       = "期限";
            deadLine.DataFormatString = "{0:yyyy/MM/dd}";

            CheckBoxField isFinished = new CheckBoxField();
            isFinished.DataField  = "isFinished";
            isFinished.HeaderText = "是否完成";

            gvSchedules.Columns.Add(id);
            gvSchedules.Columns.Add(user_id);
            gvSchedules.Columns.Add(patient_id);
            gvSchedules.Columns.Add(assess_name);
            gvSchedules.Columns.Add(deadLine);
            gvSchedules.Columns.Add(isFinished);

            gvSchedules.DataBind();
        }
    }
Ejemplo n.º 24
0
        // Adds columns to the data grid that displays users with assigned roles.
        protected void AddColumns()
        {
            // Retrieve roles from session object.
            Role[] roles = (Role[])Session["roles"];

            // Adding Columns to Grid
            BoundField userName = new BoundField();

            userName.HeaderText = "Group/User";
            userName.DataField  = "GroupName";
            gvItemPermissions.Columns.Add(userName);

            foreach (Role currentRole in roles)
            {
                CheckBoxField roleName = new CheckBoxField();
                roleName.HeaderText = currentRole.Name;
                roleName.DataField  = currentRole.Name;
                roleName.ReadOnly   = false;
                gvItemPermissions.Columns.Add(roleName);
            }
        }
Ejemplo n.º 25
0
 protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Delete")
         {
             int    rowID    = e.RowIndex;
             string memberId = Grid1.DataKeys[rowID][0].ToString();
             string sqlCmd   = "delete from OA_Sys_ProjMember where id='" + memberId + "'";
             SqlSel.ExeSql(sqlCmd);
             ProjMemberBind(Grid2.DataKeys[Grid2.SelectedRowIndex][0].ToString());
             Alert.ShowInTop("已删除!");
         }
         if (e.CommandName == "isManager")
         {
             int           rowID      = e.RowIndex;
             CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
             bool          checkState = checkField.GetCheckedState(e.RowIndex);
             string        memberId   = Grid1.DataKeys[rowID][0].ToString();
             string        memberName = Grid1.Rows[rowID].Values[0].ToString();
             if (checkState == true)
             {
                 string sqlCmd = "update OA_Sys_ProjMember set isManager='1' where id='" + memberId + "'";
                 SqlSel.ExeSql(sqlCmd);
                 Alert.ShowInTop(string.Format("{0} 已设置为项目负责人!", memberName));
             }
             else
             {
                 string sqlCmd = "update OA_Sys_ProjMember set isManager='0' where id='" + memberId + "'";
                 SqlSel.ExeSql(sqlCmd);
                 Alert.ShowInTop(string.Format("已取消 {0} 项目负责人权限!", memberName));
             }
             ProjMemberBind(Grid2.DataKeys[Grid2.SelectedRowIndex][0].ToString());
         }
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }
Ejemplo n.º 26
0
        public override object ReadJson(JsonReader reader,
                                        Type objectType, object existingValue, JsonSerializer serializer)
        {
            var jo = JObject.Load(reader);

            var type = jo["Type"]?.Value <string>();

            FormElement item = null;

            switch (type)
            {
            case nameof(ButtonElement):
                item = new ButtonElement();
                break;

            case nameof(HtmlElement):
                item = new HtmlElement();
                break;

            case nameof(TextField):
                item = new TextField();
                break;

            case nameof(ComboBoxField):
                item = new ComboBoxField();
                break;

            case nameof(CheckBoxField):
                item = new CheckBoxField();
                break;

            default:
                return(null);
            }

            serializer.Populate(jo.CreateReader(), item);

            return(item);
        }
Ejemplo n.º 27
0
        private Field CreateFieldFromSourceData(int r, int c)
        {
            string CellID = ID + "-r" + r + "c" + c;
            Field  f      = new Field("", "", "", "");

            if (Columns[c].ReadOnly)
            {
                if (Columns[c].Type == ColumnType.CheckBox)
                {
                    f = new CheckBoxField("", CellID, "", SourceData.Rows[r].ItemArray[c].ToString().Trim() == "TRUE" ? true : false, false);
                }
                else
                {
                    f = new LabelField(SourceData.Rows[r].ItemArray[c].ToString().Trim());
                }
            }
            else
            {
                switch (Columns[c].Type)
                {
                case ColumnType.Unknown:
                case ColumnType.Text:
                    f = new TextBoxField(CellID, "dbfieldid", "DGCellTB", SourceData.Rows[r].ItemArray[c].ToString().Trim());
                    break;

                case ColumnType.CheckBox:
                    f = new CheckBoxField("", CellID, "", SourceData.Rows[r].ItemArray[c].ToString().Trim() == "TRUE" ? true : false, false);
                    break;

                default:
                    break;
                }
            }
            string DBFieldID = SourceData.Rows[r].ItemArray[DbTableUniqueIDColumnNumber].ToString();

            f.DBFieldID = DBFieldID;

            return(f);
        }
Ejemplo n.º 28
0
        private RectangleF DrawCheckbox(string text)
        {
            var fld = new CheckBoxField();

            fld.Widget.Page = CurrPage;
            var p = _lastBaselineOffset.HasValue ?
                    new PointF(_ip.X, _ip.Y + _lastBaselineOffset.Value - Checkbox.BaselineOffset) : _ip;

            fld.Widget.Rect = new RectangleF(p.X, p.Y, Checkbox.Height, Checkbox.Height);
            _doc.AcroForm.Fields.Add(fld);
            if (!_lastBaselineOffset.HasValue)
            {
                _lastBaselineOffset = Checkbox.BaselineOffset;
            }
            var pSave = _ip;

            _ip.X = fld.Widget.Rect.Right + Checkbox.LabelSpacing;
            var r = DrawText(text, TsNormal);

            _ip = pSave;
            return(new RectangleF(fld.Widget.Rect.X, r.Y, r.Right - fld.Widget.Rect.Left, r.Height));
        }
Ejemplo n.º 29
0
        protected internal static void LoadResources(MagicForm form, string className)
        {
            if (form == null)
            {
                return;
            }

            string editFormResourceName = string.Concat(className, "_", form.ID, "_");

            string value = Resources.ResourceManager.GetString(editFormResourceName + "ObjectName");

            if (value != null)
            {
                form.ObjectName = value;
            }

            foreach (DataControlField field in form.Fields)
            {
                BoundField boundField = field as BoundField;
                if (boundField != null)
                {
                    value = Resources.ResourceManager.GetString(string.Concat(editFormResourceName, boundField.DataField, "Field_HeaderText"));
                    if (value != null)
                    {
                        boundField.HeaderText = value;
                    }

                    CheckBoxField checkBoxField = field as CheckBoxField;
                    if (checkBoxField != null)
                    {
                        value = Resources.ResourceManager.GetString(string.Concat(editFormResourceName, checkBoxField.DataField, "Field_Text"));
                        if (value != null)
                        {
                            checkBoxField.Text = value;
                        }
                    }
                }
            }
        }
Ejemplo n.º 30
0
        private List <Control> GetControls(CheckBoxField field, Size canvasSize)
        {
            DragableCheckBox checkBox = new DragableCheckBox();

            checkBox.Width = defaultControlWidth;
            SetControlProperties(checkBox, field, canvasSize);
            checkBox.Text      = field.PromptText;
            checkBox.FlatStyle = flatStyle;
            checkBox.BackColor = System.Drawing.Color.Transparent;
            checkBox.Font      = field.PromptFont;
            checkBox.AutoSize  = true;

            if (field.BoxOnRight)
            {
                checkBox.CheckAlign = ContentAlignment.MiddleRight;
            }

            List <Control> controls = new List <Control>();

            controls.Add(checkBox);
            return(controls);
        }