예제 #1
0
        public static void AddChoiceQuestionAdvanced(BusinessLogicLayer.Entities.FormBuilder.FormField Q, Panel QuestionPanel)
        {
            QuestionPanel.ToolTip = Q.FormFieldType.Name;
             Label QuestionTitle = new Label();
             QuestionTitle.Text = String.Format(@"<span class='fb-Title'>{0}</span>", Q.Title);
             //-----
             Label IsReqired = new Label();
             IsReqired.Text = (Q.IsRequired) ? "*Required" : "";
             //-----
             Label HelpText = new Label();
             HelpText.Text = Q.HelpText;
             //-----

             ASPxRadioButtonList rbl = new ASPxRadioButtonList();
             rbl.ID = "AnswerList" + Q.FormFieldId.ToString();
             rbl.Border.BorderStyle = BorderStyle.None;
             foreach (FormFieldValue qa in Q.FormFieldValues)
             {
                 rbl.Items.Add(new ListEditItem(qa.FieldValue, qa.FormFieldValueId));
             }
             if (Q.IsRequired)
             {
                 rbl.ValidationSettings.CausesValidation = true;
                 rbl.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.Text;
                 rbl.ValidationSettings.RequiredField.IsRequired = true;
             }
             //-----
             ControlsAdder(QuestionPanel, QuestionsTemplates.Paragraph, new Control[4] { QuestionTitle, IsReqired, HelpText, rbl }, new String[4] { "@QuestionTitle", "@IsRequired", "@HelpText", "@AnswerTextBox" });
        }
        protected override WebControl CreateEditModeControlCore()
        {
            List = new ASPxRadioButtonList();
            List.RepeatDirection = RepeatDirection.Vertical;
            List.RepeatColumns   = 2;
            foreach (object enumValue in enumDescriptor.Values)
            {
                List.Items.Add(enumDescriptor.GetCaption(enumValue));
                controlsHash.Add(enumValue);
            }
            List.SelectedIndexChanged += List_SelectedIndexChanged;



            //Panel placeHolder = new Panel();
            //controlsHash.Clear();
            //foreach (object enumValue in enumDescriptor.Values) {
            //    ASPxRadioButton radioButton = new ASPxRadioButton();
            //    radioButton.ID = "radioButton_" + enumValue.ToString();
            //    controlsHash.Add(radioButton, enumValue);
            //    radioButton.Text = enumDescriptor.GetCaption(enumValue);
            //    radioButton.CheckedChanged += new EventHandler(radioButton_CheckedChanged);
            //    radioButton.GroupName = propertyName;
            //    placeHolder.Controls.Add(radioButton);
            //}
            //return placeHolder;
            return(List);
        }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsDeThi_DAL dethi = new clsDeThi_DAL();
        DataTable    dt    = new DataTable();

        dt = dethi.getDeThi("A2");
        listDataList1.DataSource = dt;
        listDataList1.DataBind();
        DataTable dt_CauLuaChon = new DataTable();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt_CauLuaChon = dethi.getcauluachon_cauhoi(dt.Rows[i]["MaCauHoi"].ToString());
            Image img = listDataList1.Items[i].FindControl("Image1") as Image;
            if (dt.Rows[i]["HinhAnh"] == DBNull.Value || dt.Rows[i]["HinhAnh"].ToString() == "")
            {
                img.Visible = false;
            }
            else
            {
                img.Visible  = true;
                img.ImageUrl = "~/hinh/" + dt.Rows[i]["HinhAnh"].ToString() + "";
            }
            ASPxRadioButtonList radCauLuaChon = listDataList1.Items[i].FindControl("radCauLuaChon") as ASPxRadioButtonList;
            radCauLuaChon.DataSource = dt_CauLuaChon;
            radCauLuaChon.TextField  = "NoiDungCLC";
            radCauLuaChon.DataBind();
        }
    }
예제 #4
0
        private void renderQuestions()
        {
            tblQuestions = getQuestions();
            if (validateTicket() > -1)
            {
                foreach (DataRow dr in tblQuestions.Rows)
                {
                    int    id        = Convert.ToInt32(dr["ID"]);
                    string detail    = dr["Detail"].ToString();
                    string typeInput = dr["TypeInput"].ToString();
                    int    options   = Convert.ToInt32(dr["Options"]);

                    ASPxPanel pnlQuestion = new ASPxPanel();
                    pnlQuestion.ID                     = "pnl" + id;
                    pnlQuestion.Style["width"]         = "100%";
                    pnlQuestion.Style["margin-bottom"] = "15px";

                    ASPxLabel lblDetail = new ASPxLabel();
                    lblDetail.ID   = "Q" + id;
                    lblDetail.Text = detail;
                    lblDetail.Style["font-weight"]   = "bold";
                    lblDetail.Style["margin-bottom"] = "15px";
                    lblDetail.Style["font-size"]     = "15px;";
                    pnlQuestion.Controls.Add(lblDetail);

                    if (typeInput == "TEXT")
                    {
                        ASPxMemo memo = new ASPxMemo();
                        memo.ID             = "memo" + id;
                        memo.Style["width"] = "100%";
                        memo.Height         = 70;
                        pnlQuestion.Controls.Add(memo);
                    }

                    if (typeInput == "RADIOBUTTON")
                    {
                        ASPxRadioButtonList radio = new ASPxRadioButtonList();
                        radio.ID              = "radio" + id;
                        radio.Style["width"]  = "100%";
                        radio.Style["border"] = "none";
                        for (int i = 1; i <= options; i++)
                        {
                            radio.Items.Add(new ListEditItem(i.ToString(), i));
                        }
                        radio.RepeatDirection = RepeatDirection.Horizontal;
                        radio.SelectedIndex   = 0;
                        pnlQuestion.Controls.Add(radio);
                    }

                    phContent.Controls.Add(pnlQuestion);
                }
            }
            else
            {
                lblMsg.Text           = "Survey does not exist or has already been registered";
                popMsg.ShowOnPageLoad = true;
            }
        }
예제 #5
0
    protected void radioButtonList_DataBound(object sender, EventArgs e)
    {
        ASPxRadioButtonList rbl = sender as ASPxRadioButtonList;

        foreach (ListEditItem item in rbl.Items)
        {
            item.Text = string.Format("{0} ({1})", item.Text, item.Value);
        }
    }
예제 #6
0
    protected void ASPxRadioButtonList1_Init(object sender, EventArgs e)
    {
        ASPxRadioButtonList rb = (ASPxRadioButtonList)sender;

        GridViewDataItemTemplateContainer templateContainer = (GridViewDataItemTemplateContainer)rb.NamingContainer;

        rb.ID = string.Format("rb_{0}", templateContainer.VisibleIndex);
        rb.ClientInstanceName = string.Format("rb_{0}", templateContainer.VisibleIndex);
        rb.ClientSideEvents.SelectedIndexChanged = string.Format("function(s, e) {{ OnSelectedIndexChangedEventHandler({0}, '{1}'); }}", rb.ClientInstanceName, templateContainer.VisibleIndex);
    }
예제 #7
0
        protected void gvUser_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
        {
            ASPxGridView        gridView             = sender as ASPxGridView;
            ASPxRadioButtonList ASPxRadioButtonList2 = gridView.FindEditFormTemplateControl("ASPxRadioButtonList2") as ASPxRadioButtonList;
            ASPxRadioButtonList ASPxRadioButtonList1 = gridView.FindEditFormTemplateControl("ASPxRadioButtonList1") as ASPxRadioButtonList;

            ASPxRadioButtonList1.Value         = 1;
            ASPxRadioButtonList1.SelectedIndex = 0;
            ASPxRadioButtonList2.Value         = 2;
            ASPxRadioButtonList2.SelectedIndex = 0;
        }
예제 #8
0
    protected void combo_Init(object sender, EventArgs e)
    {
        HttpCookie c = Request.Cookies["Culture"];

        if (c == null)
        {
            return;
        }
        ASPxRadioButtonList rbl  = (sender as ASPxRadioButtonList);
        ListEditItem        item = rbl.Items.FindByValue(c.Value);

        rbl.SelectedItem = item;
    }
예제 #9
0
    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        int startIndex = ASPxGridView1.PageIndex * ASPxGridView1.SettingsPager.PageSize;
        int endIndex   = Math.Min(ASPxGridView1.VisibleRowCount, startIndex + ASPxGridView1.SettingsPager.PageSize);

        for (int i = startIndex; i < endIndex; i++)
        {
            ASPxRadioButtonList rb   = (ASPxRadioButtonList)ASPxGridView1.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1.Columns[4], string.Format("rb_{0}", i));
            ASPxComboBox        cmb  = (ASPxComboBox)ASPxGridView1.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1.Columns[5], string.Format("cmb_{0}", i));
            ASPxMemo            memo = (ASPxMemo)ASPxGridView1.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1.Columns[5], string.Format("memo_{0}", i));
            //SAVE DATA
        }
    }
예제 #10
0
        public override System.Web.UI.Control Build()
        {
            base.Build();
            ASPxPanel           panel     = new ASPxPanel();
            ASPxRadioButtonList radioList = new ASPxRadioButtonList();

            radioList.ClientInstanceName = "radioList";
            //是否必填
            radioList.ValidationSettings.RequiredField.IsRequired = ModuleField.IsRequired;
            //选项为空的提示
            radioList.ValidationSettings.RequiredField.ErrorText = ModuleField.ErrorText;
            //排列方式
            radioList.RepeatDirection = RepeatDirection.Horizontal;
            //代码分类
            List <DictionaryItem> itemslist = new List <DictionaryItem>();

            using (TestDBEntities entity = new TestDBEntities())
            {
                itemslist = entity.DictionaryItem.Where(oo => oo.DictionaryItemCode.StartsWith(ModuleField.CodeCat) && oo.DictionaryItemCode.Length == 7).ToList();
            }
            foreach (DictionaryItem item in itemslist)
            {
                radioList.Items.Add(item.DictionaryItemName, item.DictionaryItemValue);
            }
            //默认值与当前值
            string selected = ModuleField.CurrentValue == null ? ModuleField.DefaultValue == null ? null : ModuleField.DefaultValue.ToString() : ModuleField.CurrentValue.ToString();

            if (selected != null)
            {
                radioList.Items.FindByText(selected).Selected = true;
            }
            //为RBlist添加改变事件
            radioList.ClientSideEvents.SelectedIndexChanged = "function (s,e){RBchange(s);}";
            //添加一个隐藏控件
            ASPxHiddenField RBhiddenfield = new ASPxHiddenField();

            RBhiddenfield.ClientInstanceName = "RBhiddenfield";
            RBhiddenfield.Clear();
            //写入值
            if (selected != null)
            {
                RBhiddenfield.Add(radioList.Items.FindByText(selected).Text, radioList.Items.FindByText(selected).Value);
            }
            panel.Controls.Add(radioList);
            panel.Controls.Add(RBhiddenfield);
            return(panel);
        }
예제 #11
0
    protected void ASPxRadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ASPxRadioButtonList rblOptions = sender as ASPxRadioButtonList;

        switch (rblOptions.SelectedIndex)
        {
        case 0:
            ASPxTreeView1.AllowCheckNodes = false;
            break;

        case 1:
            ASPxTreeView1.AllowCheckNodes = true;
            PerformActionOnNodesRecursive(ASPxTreeView1.Nodes, delegate(TreeViewNode node) { node.AllowCheck = node.Nodes.Count == 0; });
            break;

        case 2:
            ASPxTreeView1.AllowCheckNodes = true;
            PerformActionOnNodesRecursive(ASPxTreeView1.Nodes, delegate(TreeViewNode node) { node.AllowCheck = true; });
            break;
        }
    }
예제 #12
0
        protected void btnTiepTheo_Click(object sender, EventArgs e)
        {
            //Lựa chọn đáp án, tính điểm, chuyển câu tiêp theo
            ASPxRadioButtonList rbl   = (ASPxRadioButtonList)this.FindControl("radListDA");
            ListEditItem        item1 = rbl.SelectedItem;

            if (item1 != null)
            {
                int dadung    = (int)Session["dad"];
                int dapanchon = Convert.ToInt32(item1.Value);
                if (dapanchon == (int)Session["dad"])
                {
                    //Tăng tổng điểm
                    int diemtong = (int)Session["diem"];
                    Session["diem"] = diemtong + 1;
                }
            }
            //Chuyển qua câu tiếp theo

            //Load câu hỏi tiếp theo vào bảng câu hỏi
            int soch = (int)Session["no_ch"];

            if (((ArrayList)Session["dsch"]).Count > soch)
            {
                CAUHOI ch1 = (CAUHOI)((ArrayList)Session["dsch"])[(int)Session["no_ch"]];
                txtCauHoi.Text     = "Câu hỏi " + ((int)Session["no_ch"] + 1).ToString() + ": " + ch1.NOIDUNG;
                imgCauHoi.ImageUrl = "~/image/" + ch1.HINHANH;
                //Lấy danh sách đáp án
                ArrayList dsda = new ArrayList();
                dsda = chBus.getDapAn(ch1.MACH);
                radListDA.Items.Clear();
                int index = 1;
                foreach (DAPAN item in dsda)
                {
                    if (index == 1)
                    {
                        radListDA.Items.Add("A. " + item.NOIDUNGDA, index);
                    }
                    if (index == 2)
                    {
                        radListDA.Items.Add("B. " + item.NOIDUNGDA, index);
                    }
                    if (index == 3)
                    {
                        radListDA.Items.Add("C. " + item.NOIDUNGDA, index);
                    }
                    if (index == 4)
                    {
                        radListDA.Items.Add("D. " + item.NOIDUNGDA, index);
                    }

                    if ((bool)item.DADUNG)
                    {
                        Session["dad"] = index;
                    }
                    index++;
                }
                Session["no_ch"] = (int)Session["no_ch"] + 1;
            }
            else
            {
                lblNotify.Text      = "Kết thúc bài thi, mời bạn Nộp bài thi";
                btnTiepTheo.Enabled = false;
            }
        }
예제 #13
0
 internal static void BindRadioList(ASPxRadioButtonList rbl, DataTable dt)
 {
     rbl.DataSource = dt;
     rbl.DataBind();
 }
 protected void gridView_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
 {
     try
     {
         ASPxRadioButtonList rdoAdjust   = gridView.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "rdoAdjust") as ASPxRadioButtonList;
         ASPxSpinEdit        txtQuantity = gridView.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "txtQuantity") as ASPxSpinEdit;
         ASPxSpinEdit        txtSortNo   = gridView.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "txtSortNo") as ASPxSpinEdit;
         ASPxTextBox         txtRemark   = gridView.FindRowCellTemplateControl(e.VisibleIndex, e.DataColumn, "txtRemark") as ASPxTextBox;
         if (rdoAdjust != null)
         {
             if (e.DataColumn.FieldName == "adjust_type")
             {
                 if (adjustDetailList != null)
                 {
                     var row = adjustDetailList.Where(t => t.id == Convert.ToInt32(e.KeyValue)).FirstOrDefault();
                     if (row != null)
                     {
                         rdoAdjust.Value = row.adjust_type;
                     }
                     if (hdDocStatus.Value == "CF")
                     {
                         rdoAdjust.Enabled = false;
                     }
                 }
             }
         }
         if (txtQuantity != null)
         {
             if (e.DataColumn.FieldName == "quantity")
             {
                 if (adjustDetailList != null)
                 {
                     var row = adjustDetailList.Where(t => t.id == Convert.ToInt32(e.KeyValue)).FirstOrDefault();
                     if (row != null)
                     {
                         txtQuantity.Value = row.quantity;
                     }
                 }
             }
         }
         if (txtSortNo != null)
         {
             if (e.DataColumn.FieldName == "sort_no")
             {
                 if (adjustDetailList != null)
                 {
                     var row = adjustDetailList.Where(t => t.id == Convert.ToInt32(e.KeyValue)).FirstOrDefault();
                     if (row != null)
                     {
                         txtSortNo.Value = row.sort_no;
                     }
                 }
             }
         }
         if (txtRemark != null)
         {
             if (e.DataColumn.FieldName == "remark")
             {
                 if (adjustDetailList != null)
                 {
                     var row = adjustDetailList.Where(t => t.id == Convert.ToInt32(e.KeyValue)).FirstOrDefault();
                     if (row != null)
                     {
                         txtRemark.Value = row.remark;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #15
0
    protected void gvM_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        //Get and Process the list of selected records in order to populate the list of pkvals
        #region process selected records
        var selected_keys = gvM.GetSelectedFieldValues("StudyMeasSubjID");


        ASPxCheckBox chkAllSelected    = gv.FindEditFormLayoutItemTemplateControl("chkUpdateAllSelected") as ASPxCheckBox;
        bool         updateALLSelected = chkAllSelected.Checked;


        List <int> pkvals = new List <int>();

        foreach (object key in e.Keys.Values)
        {
            int  ikey;
            bool isint = int.TryParse(key.ToString(), out ikey);
            if (isint)
            {
                pkvals.Add(ikey);
            }
        }

        //Add the other selected rows to the update if the user has selected the "Update All" checkbox
        if (selected_keys.Count > 0 && updateALLSelected)
        {
            foreach (object k in selected_keys)
            {
                int  ikey;
                bool isint = int.TryParse(k.ToString(), out ikey);
                if (!pkvals.Contains(ikey))
                {
                    pkvals.Add(ikey);
                }
            }
        }
        #endregion



        popupdata.AddField(e.NewValues, gvM, "MeasStatusID", "CboMS", DevExpress.Web.ControlType.ASPxComboBox);
        popupdata.AddField(e.NewValues, gvM, "MeasStatusDetailID", "CboMSD", DevExpress.Web.ControlType.ASPxComboBox);
        popupdata.AddField(e.NewValues, gvM, "Date", "DateCalendar", DevExpress.Web.ControlType.ASPxDateEdit);
        popupdata.AddField(e.NewValues, gvM, "Clinician", "CboClin", DevExpress.Web.ControlType.ASPxComboBox);
        popupdata.AddField(e.NewValues, gvM, "Notes", "notesEditor", DevExpress.Web.ControlType.ASPxMemo);


        ASPxRadioButtonList rblDate = gv.FindEditFormLayoutItemTemplateControl("rblDate") as ASPxRadioButtonList;

        if (rblDate.Value != null)
        {
            //remove the entered date as we will programmatically assign a different date
            e.NewValues.Remove("Date");

            //Update the date based on the selected mode
            string mode        = rblDate.Value.ToString();
            string date_update = dataops.dxGrid_Update_StudyMeasSubj_Dates(mode, pkvals);
        }


        string result = dataops.dxGrid_UpdateData("studymeassubjID", pkvals, e.NewValues, "backend", "dbo", "tblStudyMeasSubj");

        lblTest.Text = result;

        gv.CancelEdit();
        e.Cancel = true;

        ViewState["needBind"] = "true";
        gvM.DataBind();
    }
예제 #16
0
    public static void BindData(ASPxRadioButtonList rbllist, DevExpress.Xpo.Session s, string objectname, string filter = "", params object[] parameter)
    {
        try
        {
            DynamicDataTableClassInfo classInfo = dynamicClasses[objectname];

            if (classInfo != null)
            {
                XPServerCollectionSource ds = new XPServerCollectionSource(s, dynamicClasses[objectname], CriteriaOperator.Parse(filter, parameter));
                rbllist.DataSource = ds;
            }
            else
                throw new Exception(string.Format("Đối tượng {0} không tìm thấy trong database. Nếu không có dữ liệu hiển thị thì XPOProfiles để xem điều kiện lọc đúng chưa", objectname));
        }
        catch (Exception ex)
        {
            SiAuto.Main.LogColored(Color.Red, "Loi BindData:" + ex.ToString());
            throw ex;
        }
    }
예제 #17
0
    protected void rblMeals_Init(object sender, EventArgs e)
    {
        ASPxRadioButtonList list = sender as ASPxRadioButtonList;

        list.ValueType = typeof(CommonMeals);
    }
예제 #18
0
        protected void btnSaveQuestions_Click(object sender, EventArgs e)
        {
            Int64 ticketID = validateTicket();

            if (ticketID > -1)
            {
                tblQuestions = getQuestions();
                List <SqlParameter> sp;
                string query = "INSERT INTO tblAnswers values(@Aswer, @OptionValue, @UserAnswer, @DateAnswer, @QuestionsID, @TicketID)";
                foreach (DataRow dr in tblQuestions.Rows)
                {
                    int    id          = Convert.ToInt32(dr["ID"]);
                    string typeInput   = dr["TypeInput"].ToString();
                    string value       = string.Empty;
                    int    optionValue = 0;


                    ASPxPanel pnlQuestion = (ASPxPanel)phContent.FindControl("pnl" + id);

                    if (typeInput == "TEXT")
                    {
                        ASPxMemo memo = (ASPxMemo)pnlQuestion.FindControl("memo" + id);
                        if (memo != null)
                        {
                            value = memo.Text;
                        }
                    }

                    if (typeInput == "RADIOBUTTON")
                    {
                        ASPxRadioButtonList radio = (ASPxRadioButtonList)pnlQuestion.FindControl("radio" + id);
                        if (radio != null)
                        {
                            optionValue = Convert.ToInt32(radio.SelectedItem.Value);
                        }
                    }
                    sp = new List <SqlParameter>()
                    {
                        new SqlParameter()
                        {
                            ParameterName = "@Aswer", SqlDbType = SqlDbType.NVarChar, Value = value
                        },
                        new SqlParameter()
                        {
                            ParameterName = "@OptionValue", SqlDbType = SqlDbType.NVarChar, Value = optionValue
                        },
                        new SqlParameter()
                        {
                            ParameterName = "@UserAnswer", SqlDbType = SqlDbType.NVarChar, Value = User.Identity.Name
                        },
                        new SqlParameter()
                        {
                            ParameterName = "@DateAnswer", SqlDbType = SqlDbType.NVarChar, Value = DateTime.Now
                        },
                        new SqlParameter()
                        {
                            ParameterName = "@QuestionsID", SqlDbType = SqlDbType.NVarChar, Value = id
                        },
                        new SqlParameter()
                        {
                            ParameterName = "@TicketID", SqlDbType = SqlDbType.BigInt, Value = ticketID
                        }
                    };

                    DataBase.UpdateDB(sp, query);
                }

                query = "UPDATE tblTicket set QuestionUI = null WHERE ID = @ID";
                sp    = new List <SqlParameter>()
                {
                    new SqlParameter()
                    {
                        ParameterName = "@ID", SqlDbType = SqlDbType.BigInt, Value = ticketID
                    }
                };
                DataBase.UpdateDB(sp, query);

                lblMsg.Text = "Answers Saved Successfully";
            }
            else
            {
                lblMsg.Text = "Survey does not exist or has already been registered";
            }

            popMsg.ShowOnPageLoad = true;
        }
예제 #19
0
        private static void GetOrSetProperties(HtmlTable tblABM, object entidad, eGetOrSet getOrSet)
        {
            ASPxTextBox  tx;
            ucComboBox   uc;
            PropertyInfo myPropInfo;
            Type         entityType;

            PropertyInfo[] myPropertyInfo;

            //Recorro las properties de la entidad...
            //Por cada prop, busco en la tabla, un control tx[PROP], o uc[PROP] que coincida.
            //Si lo encuentro, lo cargo (Text o SelectedValue) con el valor de la propiedad.

            //Itero entre las propiedades de la entidad.
            entityType     = entidad.GetType();
            myPropertyInfo = entityType.GetProperties((BindingFlags.Public | BindingFlags.Instance));
            for (int i = 0; i < myPropertyInfo.Length; i++)
            {
                tx         = null;
                uc         = null;
                myPropInfo = ((PropertyInfo)myPropertyInfo[i]);

                if (myPropInfo.CanRead)
                {
                    tx = FindTextBoxByName(myPropInfo.Name, tblABM);
                    if (tx != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            tx.Text = Convert.ToString(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, tx.Text, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            tx.Text = string.Empty;
                        }
                    }

                    uc = FindComboBoxByName(myPropInfo.Name, tblABM);
                    if (uc != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            uc.SelectedValue = Convert.ToString(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, uc.SelectedValue, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            uc.SelectedValue = string.Empty;
                        }
                    }

                    ASPxSpinEdit sp = (ASPxSpinEdit)FindControlByName("sp" + myPropInfo.Name, tblABM);
                    if (sp != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                sp.Value = Convert.ToDecimal(myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                sp.Value = null;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, sp.Value, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            sp.Value = null;
                        }
                    }

                    ASPxCheckBox cb = (ASPxCheckBox)FindControlByName("cb" + myPropInfo.Name, tblABM);
                    if (cb != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            cb.Checked = Convert.ToBoolean(myPropInfo.GetValue(entidad, null));
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, cb.Checked, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            cb.Checked = false;
                        }
                    }

                    ASPxRadioButtonList rb = (ASPxRadioButtonList)FindControlByName("rb" + myPropInfo.Name, tblABM);
                    if (rb != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            rb.SelectedItem = rb.Items.FindByValue(Convert.ToString(myPropInfo.GetValue(entidad, null)).Trim());
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            if (rb.SelectedItem != null)
                            {
                                myPropInfo.SetValue(entidad, rb.SelectedItem.Value, null);
                            }
                            else
                            {
                                myPropInfo.SetValue(entidad, null, null);
                            }
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            rb.SelectedIndex = -1;
                        }
                    }

                    ASPxTimeEdit te = (ASPxTimeEdit)FindControlByName("te" + myPropInfo.Name, tblABM);
                    if (te != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                te.DateTime = ConvertToDateTime((TimeSpan)myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                te.DateTime = DateTime.MinValue;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, ConvertToTimeSpan(te.DateTime), null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            te.DateTime = DateTime.MinValue;
                        }
                    }

                    ASPxDateEdit de = (ASPxDateEdit)FindControlByName("de" + myPropInfo.Name, tblABM);
                    if (de != null)
                    {
                        if (getOrSet == eGetOrSet.GetFromProperty)
                        {
                            if (myPropInfo.GetValue(entidad, null) != null)
                            {
                                de.Date = Convert.ToDateTime(myPropInfo.GetValue(entidad, null));
                            }
                            else
                            {
                                de.Value = null;
                            }
                        }
                        else if (getOrSet == eGetOrSet.SetToProperty)
                        {
                            myPropInfo.SetValue(entidad, de.Date, null);
                        }
                        else if (getOrSet == eGetOrSet.ClearControls)
                        {
                            de.Value = null;
                        }
                    }
                }
            }
        }
예제 #20
0
        private void BuildControls(ABMControl[] controls)
        {
            HtmlTableRow  tr;
            HtmlTableCell td;

            tblControls.Rows.Clear();

            for (int i = 0; i < controls.Length; i++)
            {
                tr = new HtmlTableRow();

                td       = new HtmlTableCell();
                td.Width = "20%";
                td.Controls.Add(new Literal()
                {
                    Text = controls[i].Title
                });
                tr.Cells.Add(td);


                td       = new HtmlTableCell();
                td.Align = "Left";
                if (controls[i].TextBox != null)
                {
                    controls[i].TextBox.Width = new Unit(100, UnitType.Percentage);
                    controls[i].TextBox.ID    = "tx" + controls[i].FieldName;
                    td.Controls.Add(controls[i].TextBox);
                }
                else if (controls[i].ComboBox != null)
                {
                    controls[i].ComboBox.Width = new Unit(100, UnitType.Percentage);
                    controls[i].ComboBox.ID    = "uc" + controls[i].FieldName;
                    td.Controls.Add(controls[i].ComboBox);
                }
                else if (controls[i].Control != null)
                {
                    if (controls[i].Control is ASPxSpinEdit)
                    {
                        ASPxSpinEdit spinEdit = (ASPxSpinEdit)controls[i].Control;
                        spinEdit.Width = new Unit(100, UnitType.Percentage);
                        spinEdit.ID    = "sp" + controls[i].FieldName;
                        td.Controls.Add(spinEdit);
                    }
                    if (controls[i].Control is ASPxCheckBox)
                    {
                        ASPxCheckBox checkBox = (ASPxCheckBox)controls[i].Control;
                        checkBox.Width = new Unit(30, UnitType.Pixel);
                        checkBox.ID    = "cb" + controls[i].FieldName;
                        td.Controls.Add(checkBox);
                    }
                    if (controls[i].Control is ASPxRadioButtonList)
                    {
                        ASPxRadioButtonList radioButtonList = (ASPxRadioButtonList)controls[i].Control;
                        radioButtonList.Width = new Unit(100, UnitType.Percentage);
                        radioButtonList.ID    = "rb" + controls[i].FieldName;
                        td.Controls.Add(radioButtonList);

                        if (controls[i].Items != null)
                        {
                            foreach (Item item in controls[i].Items)
                            {
                                radioButtonList.Items.Add(item.Name, item.Value);
                            }
                        }
                    }
                }
                tr.Cells.Add(td);

                tblControls.Rows.Add(tr);
            }
        }
예제 #21
0
파일: clsUtils.cs 프로젝트: vijaymca/Dotnet
        /// <summary>
        /// For Binding the DevExpress RadioButton List
        /// </summary>
        /// <param name="rbl"></param>
        /// <param name="dt"></param>
        /// <param name="strValue"></param>
        /// <param name="strText"></param>
        public static void BindRadioButtonList(ASPxRadioButtonList rbl, DataTable dt, string strValue, string strText)
        {
            //clsDataFunctionsBAL objFunctions = null;

            try
            {
                if (DataTableHasRows(dt))
                {
                    rbl.DataSource = dt;
                    rbl.ValueField = strValue;
                    rbl.TextField = strText;
                    rbl.DataBind();
                }
            }
            catch (Exception ex)
            {
                //objFunctions = new clsDataFunctionsBAL();
                //objFunctions.SaveErrorLog(ex.Message, m_strModule, MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
               // objFunctions = null;
            }
        }
예제 #22
0
        public static void AddGridQuestionAdvanced(BusinessLogicLayer.Entities.FormBuilder.FormField Q, Panel QuestionPanel)
        {
            QuestionPanel.ToolTip = Q.FormFieldType.Name;
             Label QuestionTitle = new Label();
             QuestionTitle.Text = String.Format(@"<span class='fb-Title'>{0}</span>", Q.Title);
             //-----
             Label IsReqired = new Label();
             IsReqired.Text = (Q.IsRequired) ? "*Required" : "";
             //-----
             Label HelpText = new Label();
             HelpText.Text = Q.HelpText;
             HtmlTable table = new HtmlTable();
             int counter = 1;
             #region Header Row
             HtmlTableRow row = new HtmlTableRow();
             row.ID = "RowHeader" + Q.FormFieldId;
             HtmlTableCell cellInit1 = new HtmlTableCell();
             HtmlTableCell cellInit2 = new HtmlTableCell();
             HtmlTableCell cellInit3 = new HtmlTableCell();
             cellInit1.Attributes.Add("class", "ss-gridnumbers");
             cellInit2.Attributes.Add("class", "ss-gridnumbers ss-spacer");
             cellInit2.Attributes.Add("style", "width: 6.25%;");
             row.Cells.Add(cellInit1);
             //row.Cells.Add(cellInit2);
             foreach (BusinessLogicLayer.Entities.FormBuilder.FormFieldColumn column in Q.FormFieldColumns)
             {
                 HtmlTableCell cell = new HtmlTableCell();
                 cell.Attributes.Add("class", "ss-gridnumbers");
                 cell.Attributes.Add("style", "width: 12.5%;");
                 Label label = new Label();
                 label.CssClass = "ss-gridnumber";
                 label.Text = column.FieldColumnValue;
                 cell.Controls.Add(label);
                 row.Cells.Add(cell);
             }

             table.Rows.Add(row);
             #endregion

             #region Content Rows
             foreach (FormFieldValue qa in Q.FormFieldValues)
             {
                 HtmlTableRow bodyRow = new HtmlTableRow();
                 bodyRow.ID = "Row" + qa.FormFieldValueId.ToString();
                 if(counter % 2 == 0)
                     bodyRow.Attributes.Add("class", "ss-gridrow ss-grid-row-odd");
                 else
                     bodyRow.Attributes.Add("class", "ss-gridrow ss-grid-row-even");
                 HtmlTableCell cellMain = new HtmlTableCell();
                 cellMain.Attributes.Add("class", "ss-gridrow ss-leftlabel");
                 cellMain.InnerText = qa.FieldValue;
                 bodyRow.Cells.Add(cellMain);
                 //HtmlTableCell cellSpacer = new HtmlTableCell();
                 //cellSpacer.Attributes.Add("class", "ss-gridrow ss-spacer");
                 //cellSpacer.Attributes.Add("style", "width: 6.25%;");
                 //bodyRow.Cells.Add(cellSpacer);
                 HtmlTableCell cellContent = new HtmlTableCell();
                 cellContent.ColSpan = Q.FormFieldColumns.Count;
                 ASPxRadioButtonList rbl = new ASPxRadioButtonList();
                 rbl.ID = String.Format("GridColumnList_{0}_{1}", counter, Q.FormFieldId);
                 rbl.RepeatColumns = Q.FormFieldColumns.Count;
                 rbl.Width = new Unit("100%");
                 rbl.Border.BorderStyle = BorderStyle.None;
                 if (Q.IsRequired)
                 {
                     rbl.ValidationSettings.CausesValidation = true;
                     rbl.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.Text;
                     rbl.ValidationSettings.RequiredField.IsRequired = true;
                 }
                 foreach (BusinessLogicLayer.Entities.FormBuilder.FormFieldColumn column in Q.FormFieldColumns)
                 {

                     rbl.Items.Add(new ListEditItem("", String.Format("{0}_{1}", column.FormFieldColumnId, qa.FormFieldValueId)));
                 }
                 cellContent.Controls.Add(rbl);
                 bodyRow.Cells.Add(cellContent);
                 table.Rows.Add(bodyRow);
                 counter++;
             }
             #endregion

             //-----
             ControlsAdder(QuestionPanel, QuestionsTemplates.Paragraph, new Control[4] { QuestionTitle, IsReqired, HelpText, table}, new String[4] { "@QuestionTitle", "@IsRequired", "@HelpText", "@AnswerTextBox" });
        }