public void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
        //    return;

        DataRowView row = (DataRowView)e.Item.DataItem;

        RadioButtonList rbl = new RadioButtonList();
        rbl.RepeatDirection = RepeatDirection.Vertical;
        //string[] ans1;

        //ans1 =Convert.ToString( row["ans"]);
        string[] ans1 = row["ans"].ToString().Split('|');
        //string[] ans1 = row["ans"].ToString();
        //for (int n = 0; n < Choices.Length; n++)
        //{
        //    rbl.Items.Add(new ListItem(Choices[n], n.ToString()));
        //}
        for (int n = 0; n < ans1.Length; n++)
        {
            rbl.Items.Add(new ListItem(ans1[n], n.ToString()));
        }
        if (row["ans"] != DBNull.Value)
            rbl.SelectedIndex = (int)row["ans"];
        //if (row["Answer"] != DBNull.Value)
        //    rbl.SelectedIndex = (int)row["Answer"];
        ((Label)e.Item.FindControl("ChoicesLabel")).Controls.Add(rbl);
    }
Example #2
0
 public ChoiceQuestion(int i, Question q, int[] choice)
 {
     base.domain = q.Domain;
     base.id = i;
     rbl = new RadioButtonList();
     count++;
     base.l.Text = q.Domain + ") " + q.QuestionText;
     if (q.Link.Length>0)
     {
         fh.Text = q.Link;
         fh.NavigateUrl = "~/Lectii.aspx#" + q.Link;
     }
     else
     {
         fh.Text = "Lectiile";
         fh.NavigateUrl = "~/Lectii.aspx";
     }
     String[] s = new String[4];
     s[0] = q.Answer1;
     s[1] = q.Answer2;
     s[2] = q.Answer3;
     s[3] = q.Answer4;
     answer = q.Answer[0] - 'a';
     s[answer] += "  !!!this"; //test purposes
     //trec a prin inversa perm ca sa aflu care dintre cei 4 itemi in ordine e acum raspunsul
     if (choice[0] == answer) { answer = 0; }
     else if (choice[1] == answer) { answer = 1; }
     else if (choice[2] == answer) { answer = 2; }
     else if (choice[3] == answer) { answer = 3; }
     rbl.Items.Clear();
     rbl.Items.Add(new ListItem(s[choice[0]]));
     rbl.Items.Add(new ListItem(s[choice[1]]));
     rbl.Items.Add(new ListItem(s[choice[2]]));
     rbl.Items.Add(new ListItem(s[choice[3]]));
 }
Example #3
0
 public static void Bind(RadioButtonList rdolst, ListItemCollection list)
 {
     foreach (ListItem item in list)
     {
         rdolst.Items.Add(item);
     }
 }
Example #4
0
		Control CreateTypeControls()
		{
			typeRadio = new RadioButtonList
			{
				Items =
				{ 
					new ListItem { Text = "Form (modeless)", Key = "form" },
					new ListItem { Text = "Dialog (modal)", Key = "dialog" }
				},
				SelectedKey = "form"
			};

			setOwnerCheckBox = new CheckBox { Text = "Set Owner", Checked = false };
			setOwnerCheckBox.CheckedChanged += (sender, e) => 
			{
				if (child != null)
					child.Owner = setOwnerCheckBox.Checked ?? false ? ParentWindow : null;
			};

			return new StackLayout
			{
				Orientation = Orientation.Horizontal,
				Items = { typeRadio, setOwnerCheckBox }
			};
		}
Example #5
0
 protected void CustomRangeValidator(RadioButtonList rbl)
 {
     rqvAmountRange.Type = ValidationDataType.Double;
     rqvAmountRange.MinimumValue = "1";
     rqvAmountRange.MaximumValue = rbl.SelectedValue; // No larger than account balance
     rqvAmountRange.SetFocusOnError = true;
     rqvAmountRange.Display = ValidatorDisplay.Dynamic;
 }
		Control ClearButton(RadioButtonList list)
		{
			var control = new Button { Text = "Clear" };
			control.Click += delegate
			{
				list.Items.Clear();
			};
			return control;
		}
Example #7
0
 public QuestionItem(string title, int itemType)
 {
     this.title = title;
     this.itemType = itemType;
     if(itemType == 0)
     {
         list = new RadioButtonList();
         item = list;
     }
 }
		Control AddRowsButton(RadioButtonList list)
		{
			var control = new Button { Text = "Add" };
			control.Click += delegate
			{
				for (int i = 0; i < 1; i++)
					list.Items.Add(new ListItem { Text = "Item " + list.Items.Count });
			};
			return control;
		}
		Control Orientation(RadioButtonList list)
		{
			var control = new EnumComboBox<RadioButtonListOrientation>();
			control.SelectedValue = list.Orientation;
			control.SelectedValueChanged += delegate
			{
				list.Orientation = control.SelectedValue;
			};
			return TableLayout.AutoSized(control, centered: true);
		}
		Control RemoveRowsButton(RadioButtonList list)
		{
			var control = new Button { Text = "Remove" };
			control.Click += delegate
			{
				if (list.SelectedIndex >= 0)
					list.Items.RemoveAt(list.SelectedIndex);
			};
			return control;
		}
    private void AddListItem(string to, string from, RadioButtonList list)
    {
        list.Items.Add(new ListItem(to));

        if (to != from)
        {
            list.Items.Add(new ListItem(from));
        }

        list.Items[0].Selected = true;
    }
		Control Default()
		{
			var control = new RadioButtonList();
			LogEvents(control);
			
			var layout = new DynamicLayout();
			layout.Add(TableLayout.AutoSized(control));
			layout.BeginVertical();
			layout.AddRow(null, AddRowsButton(control), RemoveRowsButton(control), ClearButton(control), Orientation(control), null);
			layout.EndVertical();
			
			return layout;
		}
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     int routineID = Convert.ToInt32(rbl.SelectedItem.Value);
     Routine rtn = routManager.changeRoutineName(routineID, tbRoutineName.Text);
     int index = rbl.SelectedIndex;
     if (rtn != null)
     {
         rbl = (RadioButtonList)this.Parent.FindControl("rblRoutines");
         rbl.DataSource = routManager.viewRoutines().ToList();
         rbl.DataTextField = "name";
         rbl.DataValueField = "id";
         rbl.DataBind();
         rbl.SelectedIndex = index;
     }
 }
Example #14
0
 public static void Bind(RadioButtonList rdolst, ListItemCollection list, EnumHelper.ListItemType listType)
 {
     foreach (ListItem item in list)
     {
         //if (listType == EnumHelper.ListItemType.CommissionType)
         //{
         //    if (Convert.ToInt32(item.Value) == Convert.ToInt32(EnumHelper.CommissionType.Dollar))
         //    {
         //        item.Text = "$";
         //    }
         //    if (Convert.ToInt32(item.Value) == Convert.ToInt32(EnumHelper.CommissionType.Percentage))
         //    {
         //        item.Text = "%";
         //    }
         //}
         rdolst.Items.Add(item);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        //when the page loads, we need to setup the UI of the site...

        //first we get all lines and store them to a string array from the loginID file
        string[] lines = System.IO.File.ReadAllLines(Path.GetFullPath(Server.MapPath("~\\files\\LoginIDFile.txt")));
        //initalise the static variables
        accCount = 0;
        loginIDList = new ArrayList();
        radioList = new ArrayList();
        // loop through every line of lines (of the file)
        foreach (string line in lines)
        {
            // creates a table row
            TableRow tr = new TableRow();
            // creates a table cell that contains the loginID;
            TableCell loginIDTableCell = new TableCell();
            loginIDTableCell.Text = line.Split(',')[0];
            // add the loginID to the loginIDList as well
            loginIDList.Add((string)line.Split(',')[0]);
            // create another cell to store the radio list
            TableCell accessLevelListTableCell = new TableCell();
            ///create radio list
            RadioButtonList accessLevelList = new RadioButtonList();
            // add radio list to radiolist arraylist
             radioList.Add(accessLevelList);
            // create the list items for the radio list of that row
            ((RadioButtonList) radioList[radioList.Count - 1]).Items.Add(new ListItem("Banned", "0"));
            ((RadioButtonList) radioList[radioList.Count - 1]).Items.Add(new ListItem("Normal", "1"));
            ((RadioButtonList) radioList[radioList.Count - 1]).Items.Add(new ListItem("Moderator", "2"));
            // select the list item that is currently loginID's access level
            ((RadioButtonList) radioList[radioList.Count - 1]).Items.FindByValue(line.Split(',')[4].ToString()).Selected = true;
            // add the radio to the approiate cell
            accessLevelListTableCell.Controls.Add((RadioButtonList) radioList[radioList.Count-1]);
            // add both table cells to table row
            tr.Controls.Add(loginIDTableCell);
            tr.Controls.Add(accessLevelListTableCell);
            // add table row to table
            mainTable.Rows.Add(tr);
            // increase the account number count by one
            accCount++;
        }
    }
    /// <summary>
    /// Dynamically creates panels that store each qualifier and answer
    /// </summary>
    /// <param name="study"></param>
    public Panel generateQualifiers(Study study)
    {
        Panel pnlQualifer = new Panel();
        foreach (Qualifier qualifier in study.Qualifiers) {
            //create a new panel that will hold all the information for this qualifier

            Label lblQualifier = new Label();
            RadioButtonList rblistAnswers = new RadioButtonList();
            foreach (Answer answer in qualifier.Answers) {
                rblistAnswers.Items.Add(answer.AnswerText);
            }
            lblQualifier.Text = qualifier.Question;
            pnlQualifer.Controls.Add(lblQualifier);
            rblistAnswers.Enabled = false;
            pnlQualifer.Controls.Add(rblistAnswers);
            //add the panel we just made to the form
        }
        return pnlQualifer;
    }
 /// <summary>
 /// Shows questions/answers and score for a particular study
 /// </summary>
 /// <param name="study"></param>
 private void showStudyInfo(Study study, Participant participant)
 {
     foreach (Qualifier qualifier in study.Qualifiers) {
         Label lblQualifier = new Label();
         pnlQualifiers.Controls.Add(lblQualifier);
         RadioButtonList rblistAnswers = new RadioButtonList();
         foreach (Answer answer in qualifier.Answers) {
             ListItem item = new ListItem(answer.AnswerText + "  [" + answer.Score + "]", answer.AnsID.ToString());
             rblistAnswers.Items.Add(item);
             foreach (Answer participantAnswer in participant.Answers) {
                 if (answer.AnsID == participantAnswer.AnsID) {
                     rblistAnswers.SelectedValue = answer.AnsID.ToString();
                 }
             }
         }
         pnlQualifiers.Controls.Add(rblistAnswers);
         lblQualifier.Text = qualifier.Question;
         rblistAnswers.Enabled = false;
     }
 }
    private void LoadControls()
    {
        var giftImage = new RadioButtonList();
        giftImage.ID = "giftImg";
        giftImage.RepeatDirection = RepeatDirection.Horizontal;

        System.IO.FileInfo file;

        var Images =
           from n in System.IO.Directory.GetFiles(Server.MapPath("GiftImages"))
           orderby n
           select n;

        foreach (var filename in Images)
        {
            file = new System.IO.FileInfo(filename);
            var tmpItem = new ListItem("<img src='" + "GiftImages/" + file.Name + "' alt='" + file.Name + "' title='" + file.Name + "' WIDTH=100 HEIGHT=100/>", file.Name);
            giftImage.Items.Add(tmpItem);
        }

        PlaceHolder1.Controls.Add(giftImage);
    }
Example #19
0
		public OptionsPageView(OptionsPageModel model)
		{
			var layout = new DynamicLayout();

			var infoLayout = new StackLayout { Spacing = 10 };

			foreach (var option in model.Options)
			{
				var currentOption = option;
				option.Selected = option.Values.FirstOrDefault();
                var infoLabel = new Label { Text = option.Selected?.Description };
				infoLayout.Items.Add(infoLabel);

                layout.Add(new Label { Text = option.Name });
				layout.BeginVertical();
				layout.BeginHorizontal();

				layout.Add(new Panel { Size = new Size(40, -1) }, xscale: false);

				var radioList = new RadioButtonList();
				radioList.Orientation = Orientation.Vertical;
				radioList.ItemTextBinding = Binding.Property((OptionValue v) => v.Name);
				radioList.DataStore = option.Values;
				radioList.SelectedValueChanged += (sender, e) =>
				{
					currentOption.Selected = radioList.SelectedValue as OptionValue;
					infoLabel.Text = currentOption.Selected?.Description;
				};
				radioList.SelectedIndex = 0;
				layout.Add(radioList);

				layout.EndHorizontal();
				layout.EndVertical();
			}

			Information = infoLayout;
            Content = layout;
		}
Example #20
0
    private void AddControl()
    {
        TextBox txt1 = new TextBox();
        txt1.ID = "TextName";
        txt1.Text = "Hello";
        PlaceHolder1.Controls.Add(txt1);
        Button btn = new Button();
        btn.ID = "ButtonOKay";
        btn.Text = "OKay";
        btn.Click += new EventHandler(ButtonOKay_Click);
        PlaceHolder1.Controls.Add(btn);

        PlaceHolder1.Controls.Add(new LiteralControl("<br />"));
        PlaceHolder1.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
        PlaceHolder1.Controls.Add(new LiteralControl("&nbsp;"));
        PlaceHolder1.Controls.Add(new LiteralControl("&nbsp;"));

        //CheckBoxList chkList = new CheckBoxList();
        //chkList.Items.Add("S/W");
        //chkList.Items.Add("TELCOM");
        //chkList.Items.Add("NON IT");
        //PlaceHolder1.Controls.Add(chkList);
        //DropDownList ddl = new DropDownList();
        //ddl.Items.Add("0");
        //ddl.Items.Add("1");
        //ddl.Items.Add("2");
        //ddl.Items.Add("3");
        //ddl.Items.Add("4");
        //PlaceHolder1.Controls.Add(ddl);

        RadioButtonList rbList = new RadioButtonList();
        rbList.ID="rbList1";
        rbList.Items.Add("S/W");
        rbList.Items.Add("IT");
        rbList.Items.Add("Banking");

        PlaceHolder1.Controls.Add(rbList);
    }
Example #21
0
    protected void Page_Init(object sender, EventArgs e)
    {
        List<string> roles = new List<string>(System.Web.Security.Roles.GetAllRoles());

        RadioButtonList editButtonList = new RadioButtonList();
        editButtonList.ID = "editButtonList";

        foreach (var role in roles)
        {
            editButtonList.Items.Add(role);
        }

        editButtonList.SelectedIndex = 0;
        editButtonList.AutoPostBack = true;

        RoleBox.Controls.Add(editButtonList);

        List<string> usersInRole = new List<string>(Roles.GetUsersInRole(editButtonList.SelectedItem.Text));
        RoleUsersList.DataSource = usersInRole;
        RoleUsersList.DataBind();

        DetermineRemaingUsers(editButtonList);
    }
Example #22
0
    private void DetermineRemaingUsers(RadioButtonList editButtonList)
    {
        MembershipUserCollection col = Membership.GetAllUsers();
        List<string> usersInRole = new List<string>(Roles.GetUsersInRole(editButtonList.SelectedItem.Text));
        List<string> remainingUsers = new List<string>();

        foreach (MembershipUser user in col)
        {
            if (!usersInRole.Contains(user.UserName))
            {
                remainingUsers.Add(user.UserName);
            }
        }

        AllUsersList.DataSource = remainingUsers;
        AllUsersList.DataBind();
    }
Example #23
0
 public void FillLeaseSchemeGroup(RadioButtonList rbl)
 {
     SqlConnection conn = new SqlConnection(strConn.connect());
     conn.Open();
     DataTable dtLSG = new DataTable();
     SqlDataAdapter adpDB = new SqlDataAdapter("Select SchmGCode, SchmGName From Lease_ScheemeGroup", conn);
     adpDB.Fill(dtLSG);
     for (int i = 0; i < dtLSG.Rows.Count; i++)
     {
         rbl.Items.Add(new ListItem(dtLSG.Rows[i]["SchmGName"].ToString(), dtLSG.Rows[i]["SchmGCode"].ToString()));
     }
     dtLSG.Clear();
     conn.Close();
 }
Example #24
0
 /// <summary>
 /// Disabled the parameter RadioButtonList control.
 /// </summary>
 /// <param name="cbx">The RadioButtonList to disable.</param>
 private void disableRadioButtonList(RadioButtonList rbl) {
     rbl.Enabled = false;
 }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String aaaa = DateTime.Now.ToString("yyyy/MM/dd");

            TextBox1.Text = aaaa;

            String KCheckListId = Session["KCheckListId"].ToString();
            String DBName       = Session["DatabaseName"].ToString();
            String Projectid    = Session["ProjectCode"].ToString();

            String Name = Session["Name"].ToString();

            personLabel.Text = Name;

            SqlConnection connStr = new SqlConnection(Utility.DBconnection.connect_string(DBName));
            SqlDataReader reader; //宣告一個DataReader

            connStr.Open();       //開啟資料庫的連結

            //查專案名稱
            String     selectproject = "select* from ProjectM0 where PID = '" + Projectid + "'"; //宣告SQL語法的字串,這邊可依照自行需求修改
            SqlCommand cmdproject    = new SqlCommand(selectproject, connStr);                   //宣告SqlCommand並將SQL語法及連結語法帶入

            reader = cmdproject.ExecuteReader();                                                 //使用SqlCommand的ExecuteReader()方法,
            //ExecuteReader()為查詢時使用,如要刪除、修改、新增,須改為ExecuteNonQuery()方法

            while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
            {
                ProjectLabel.Text = reader.GetString(7);
            }
            reader.Close();
            //查專案名稱

            //查位置跟自主檢查表ID
            String     select1 = "select * from KCheckList where  KCheckListId = '" + KCheckListId + "'"; //宣告SQL語法的字串,這邊可依照自行需求修改
            SqlCommand cmd1    = new SqlCommand(select1, connStr);                                        //宣告SqlCommand並將SQL語法及連結語法帶入

            reader = cmd1.ExecuteReader();                                                                //使用SqlCommand的ExecuteReader()方法,
                                                                                                          //ExecuteReader()為查詢時使用,如要刪除、修改、新增,須改為ExecuteNonQuery()方法

            while (reader.Read())                                                                         //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
            {
                //int KCheckListProjectid = (int)reader["KCheckListProject"];
                //ProjectidLabel.Text = KCheckListProjectid.ToString();

                //int KCheckListEngineeringListid = (int)reader["KCheckListEngineeringList"];
                //EngineeringidLabel.Text = KCheckListEngineeringListid.ToString();
                EngineeringidLabel.Text = reader.GetString(3);
                EngineeringLabel.Text   = reader.GetString(3);

                //LocationLabel.Text = reader.GetString(1);
            }
            reader.Close();
            //查位置跟自主檢查表ID

            /**
             * //查自主檢查表名稱
             * String selectEngineering = "select * from KCheckList where  KCheckListId = '" + EngineeringidLabel.Text + "'";  //宣告SQL語法的字串,這邊可依照自行需求修改
             * SqlCommand cmdEngineering = new SqlCommand(selectEngineering, connStr);   //宣告SqlCommand並將SQL語法及連結語法帶入
             * reader = cmdEngineering.ExecuteReader();   //使用SqlCommand的ExecuteReader()方法,
             *                               //ExecuteReader()為查詢時使用,如要刪除、修改、新增,須改為ExecuteNonQuery()方法
             *
             * while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
             * {
             *  EngineeringLabel.Text = reader.GetString(1);
             * }
             * reader.Close();
             * //查自主檢查表名稱
             **/

            /**
             * TableHeaderCell header = new TableHeaderCell();
             * header.RowSpan = 1;
             * header.ColumnSpan = 3;
             * header.Text = "施工前";
             * header.Font.Bold = true;
             * header.HorizontalAlign = HorizontalAlign.Center;
             * header.VerticalAlign = VerticalAlign.Middle;
             * // Add the header to a new row.
             * TableRow headerRow = new TableRow();
             * headerRow.Cells.Add(header);
             *
             * // Add the header row to the table.
             * Table1.Rows.AddAt(1, headerRow);
             **/

            i = 1;

            TableRow  row;
            TableCell cell;
            TableCell cell1;
            TableCell cell2;

            String     selectKEngineeringListItem1 = "select * from KCheckListItem where KCheckListId ='" + KCheckListId + "' and KCheckListItemPhase='施工前'"; //宣告SQL語法的字串,這邊可依照自行需求修改
            SqlCommand cmdKEngineeringListItem1    = new SqlCommand(selectKEngineeringListItem1, connStr);                                                    //宣告SqlCommand並將SQL語法及連結語法帶入

            reader = cmdKEngineeringListItem1.ExecuteReader();

            while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
            {
                String itemname = reader.GetString(1);

                Label Label = new Label();
                Label.ID      = "labl" + i;
                Label.Visible = false;

                int KCheckListItemId = (int)reader["KCheckListItemId"];
                Label.Text = KCheckListItemId.ToString();
                this.Form.Controls.Add(Label);


                //for(i=0;i<=reader.FieldCount-1;i++){
                //CheckBox radio = new CheckBox();
                RadioButtonList radioList = new RadioButtonList();

                radioList.ID = "radio" + i;

                TextBox textbox = new TextBox();
                textbox.ID       = "textboxxx" + i;
                textbox.CssClass = "TBmiddle";

                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("合格", "合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("不合格", "不合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("未檢查", "未檢查"));

                cell  = new TableCell();
                row   = new TableRow();
                cell1 = new TableCell();

                cell2       = new TableCell();
                cell1.Width = 400;

                cell.Text = itemname;
                cell1.Controls.Add(radioList);
                cell2.Controls.Add(textbox);

                row.Cells.Add(cell);
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);

                Table1.Rows.Add(row);
                i = i + 1;
            }

            reader.Close();



            String     selectKEngineeringListItem2 = "select * from KCheckListItem where KCheckListId ='" + KCheckListId + "' and KCheckListItemPhase='施工中'"; //宣告SQL語法的字串,這邊可依照自行需求修改
            SqlCommand cmdKEngineeringListItem2    = new SqlCommand(selectKEngineeringListItem2, connStr);                                                    //宣告SqlCommand並將SQL語法及連結語法帶入

            reader = cmdKEngineeringListItem2.ExecuteReader();

            while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
            {
                String itemname = reader.GetString(1);

                Label Label = new Label();
                Label.ID      = "labl" + i;
                Label.Visible = false;

                int KCheckListItemId = (int)reader["KCheckListItemId"];
                Label.Text = KCheckListItemId.ToString();
                this.Form.Controls.Add(Label);


                //for(i=0;i<=reader.FieldCount-1;i++){
                //CheckBox radio = new CheckBox();
                RadioButtonList radioList = new RadioButtonList();

                radioList.ID = "radio" + i;

                TextBox textbox = new TextBox();
                textbox.ID       = "textboxxx" + i;
                textbox.CssClass = "TBmiddle";

                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("合格", "合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("不合格", "不合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("未檢查", "未檢查"));

                cell  = new TableCell();
                row   = new TableRow();
                cell1 = new TableCell();

                cell2       = new TableCell();
                cell1.Width = 400;

                cell.Text = itemname;
                cell1.Controls.Add(radioList);
                cell2.Controls.Add(textbox);

                row.Cells.Add(cell);
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);

                Table2.Rows.Add(row);
                i = i + 1;
            }
            reader.Close();

            String     selectKEngineeringListItem3 = "select * from KCheckListItem where KCheckListId ='" + KCheckListId + "' and KCheckListItemPhase='施工後'"; //宣告SQL語法的字串,這邊可依照自行需求修改
            SqlCommand cmdKEngineeringListItem3    = new SqlCommand(selectKEngineeringListItem3, connStr);                                                    //宣告SqlCommand並將SQL語法及連結語法帶入

            reader = cmdKEngineeringListItem3.ExecuteReader();

            while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
            {
                String itemname = reader.GetString(1);

                Label Label = new Label();
                Label.ID      = "labl" + i;
                Label.Visible = false;

                int KCheckListItemId = (int)reader["KCheckListItemId"];
                Label.Text = KCheckListItemId.ToString();
                this.Form.Controls.Add(Label);


                //for(i=0;i<=reader.FieldCount-1;i++){
                //CheckBox radio = new CheckBox();
                RadioButtonList radioList = new RadioButtonList();

                radioList.ID = "radio" + i;

                TextBox textbox = new TextBox();
                textbox.ID       = "textboxxx" + i;
                textbox.CssClass = "TBmiddle";

                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("合格", "合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("不合格", "不合格"));
                radioList.Items.Add(new System.Web.UI.WebControls.ListItem("未檢查", "未檢查"));

                cell  = new TableCell();
                row   = new TableRow();
                cell1 = new TableCell();

                cell2       = new TableCell();
                cell1.Width = 400;

                cell.Text = itemname;
                cell1.Controls.Add(radioList);
                cell2.Controls.Add(textbox);

                row.Cells.Add(cell);
                row.Cells.Add(cell1);
                row.Cells.Add(cell2);

                Table3.Rows.Add(row);
                i = i + 1;
            }
            reader.Close();



            connStr.Close();
        }
Example #26
0
        private Control BuildContent()
        {
            return(new StackLayout
            {
                Padding = 0,
                Spacing = 0,
                VerticalContentAlignment = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Items =
                {
                    new StackLayout
                    {
                        Visible = false,
                        Padding = 5,
                        Spacing = 5,
                        Orientation = Orientation.Horizontal,
                        HorizontalContentAlignment = HorizontalAlignment.Stretch,
                        VerticalContentAlignment = VerticalAlignment.Center,
                        Items =
                        {
                            new StackLayoutItem
                            {
                                Control = _chkEnableBot = new CheckBox{
                                    Text = "Enable Bot"
                                },
                                HorizontalAlignment = HorizontalAlignment.Left,
                            },

                            new StackLayoutItem
                            {
                                Control = new Label{
                                    Text = "   "
                                },
                            },

                            new StackLayoutItem
                            {
                                Control = _btnCompile = new Button{
                                    Text = "Compile"
                                },
                                HorizontalAlignment = HorizontalAlignment.Right,
                            },

                            new StackLayoutItem
                            {
                                Control = _lblCompileStatus = new Label{
                                    Text = "success", TextColor = Colors.Green
                                },
                                HorizontalAlignment = HorizontalAlignment.Right,
                            },

                            new StackLayoutItem
                            {
                                Control = new Label{
                                    Text = "   "
                                },
                            },

                            new StackLayoutItem
                            {
                                Control = _btnNew = new Button{
                                    Text = "New"
                                },
                            },
                            new StackLayoutItem
                            {
                                Control = _btnOpen = new Button{
                                    Text = "Open"
                                },
                            },
                            new StackLayoutItem
                            {
                                Control = _btnSave = new Button{
                                    Text = "Save"
                                },
                            },
                            new StackLayoutItem
                            {
                                Control = _btnSaveAs = new Button{
                                    Text = "Save As"
                                },
                            },
                        },
                    },
                    new StackLayoutItem
                    {
                        Control = new Panel
                        {
                            Content = (_radBotLanguages = new RadioButtonList{
                            }),
                            Padding = 5,
                        }
                    },
                    new StackLayoutItem
                    {
                        Control = _textSourceCode = new SyntaxHightlightTextArea{
                            Style = EtoStyles.SourceEditor,
                        },
                        Expand = true,
                    },
                    //new StackLayoutItem
                    //{
                    //    Control = new AceSourceEditor(),
                    //    Expand = true,
                    //},
                },
            });
        }
Example #27
0
        public ProjectWizardPageView(ProjectWizardPageModel model)
        {
            var content = new TableLayout
            {
                Spacing = new Size(10, 10)
            };

            if (model.ShowAppName)
            {
                var nameBox = new TextBox();
                nameBox.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.AppName);
                Application.Instance.AsyncInvoke(nameBox.Focus);

                content.Rows.Add(new TableRow(new Label {
                    Text = (model.IsLibrary ? "Library" : "App") + " Name:", TextAlignment = TextAlignment.Right, VerticalAlignment = VerticalAlignment.Center
                }, nameBox));
            }
            else if (!string.IsNullOrEmpty(model.AppName))
            {
                var label = new Label {
                    Text = model.AppName, VerticalAlignment = VerticalAlignment.Center
                };
                content.Rows.Add(new TableRow(new Label {
                    Text = (model.IsLibrary ? "Library" : "App") + " Name:", TextAlignment = TextAlignment.Right, VerticalAlignment = VerticalAlignment.Center
                }, label));
            }

            if (model.SupportsCombined)
            {
                var platformTypeList = new RadioButtonList
                {
                    Orientation = Orientation.Vertical,
                    Spacing     = new Size(0, 0),
                    Items       =
                    {
                        new ListItem {
                            Text = "Combined Windows && Linux assembly, separate Mac", Key = "combined"
                        },
                        new ListItem {
                            Text = "Separate platform assemblies", Key = "separate"
                        }
                    }
                };
                platformTypeList.SelectedKeyBinding.Convert(v => v == "combined", v => v ? "combined" : "separate").BindDataContext((ProjectWizardPageModel m) => m.Combined);
                content.Rows.Add(new TableRow(new Label {
                    Text = "Launcher:", TextAlignment = TextAlignment.Right
                }, platformTypeList));
            }

            /*
             * eventually select platforms to include?
             *
             * var platformCheckBoxes = new DynamicLayout();
             * platformCheckBoxes.BeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "Gtk2" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Gtk3" });
             * platformCheckBoxes.EndBeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "WinForms" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Wpf" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Direct2D" });
             * platformCheckBoxes.EndBeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "Mac" });
             * platformCheckBoxes.Add(new CheckBox { Text = "XamMac" });
             * platformCheckBoxes.Add(new CheckBox { Text = "XamMac2" });
             * platformCheckBoxes.EndHorizontal();
             *
             * content.Rows.Add(new TableRow(new Label { Text = "Platforms:", TextAlignment = TextAlignment.Right }, platformCheckBoxes));
             * /**/

            if (model.SupportsProjectType)
            {
                var sharedCodeList = new RadioButtonList
                {
                    Orientation = Orientation.Vertical,
                    Spacing     = new Size(0, 0),
                };
                if (model.SupportsPCL)
                {
                    sharedCodeList.Items.Add(new ListItem {
                        Text = "Portable Class Library", Key = "pcl"
                    });
                    sharedCodeList.SelectedKeyBinding.Convert(v => v == "pcl", v => v ? "pcl" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UsePCL);
                }
                if (model.SupportsSAL)
                {
                    sharedCodeList.Items.Add(new ListItem {
                        Text = "Shared Project", Key = "sal"
                    });
                    sharedCodeList.SelectedKeyBinding.Convert(v => v == "sal", v => v ? "sal" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UseSAL);
                }

                sharedCodeList.Items.Add(new ListItem {
                    Text = "Full .NET", Key = "net"
                });
                sharedCodeList.SelectedKeyBinding.Convert(v => v == "net", v => v ? "net" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UseNET);

                content.Rows.Add(new TableRow(new Label {
                    Text = model.IsLibrary ? "Type:" : "Shared Code:", TextAlignment = TextAlignment.Right
                }, sharedCodeList));
            }

            var informationLabel = new Label();

            informationLabel.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.Information);
            Information = informationLabel;

            Content     = content;
            DataContext = model;
        }
Example #28
0
        protected void SaveAction(object sender, EventArgs e)
        {
            String KCheckListIdd = Session["KCheckListId"].ToString();

            if (datacheck(KCheckListIdd, Request.Form["TextBox1"].Trim(), personLabel.Text, EngineeringidLabel.Text, TextBox2.Text) == false)
            {
                String        DBName   = Session["DatabaseName"].ToString();
                SqlConnection connStrr = new SqlConnection(Utility.DBconnection.connect_string(DBName));

                SqlDataReader reader;
                connStrr.Open();


                String     checkplacetimeperson    = "INSERT INTO KCheckListTime(CheckList,DateTime,Person,CheckListEngineering,Location) Values('" + KCheckListIdd + "','" + Request.Form["TextBox1"].Trim() + "','" + personLabel.Text + "','" + EngineeringidLabel.Text + "','" + TextBox2.Text + "')"; //宣告SQL語法的字串,這邊可依照自行需求修改
                SqlCommand cmdcheckplacetimeperson = new SqlCommand(checkplacetimeperson, connStrr);
                cmdcheckplacetimeperson.ExecuteNonQuery();

                String     selectKCheckListTimeId = "select* from KCheckListTime where CheckList = '" + KCheckListIdd + "' and DateTime = '" + Request.Form["TextBox1"].Trim() + "' and CheckListEngineering = '" + EngineeringidLabel.Text + "' and Location = '" + TextBox2.Text + "'"; //宣告SQL語法的字串,這邊可依照自行需求修改
                SqlCommand cmdKCheckListTimeId    = new SqlCommand(selectKCheckListTimeId, connStrr);                                                                                                                                                                                     //宣告SqlCommand並將SQL語法及連結語法帶入
                reader = cmdKCheckListTimeId.ExecuteReader();                                                                                                                                                                                                                             //使用SqlCommand的ExecuteReader()方法,
                //ExecuteReader()為查詢時使用,如要刪除、修改、新增,須改為ExecuteNonQuery()方法

                while (reader.Read())   //使用無限迴圈將SQL語法查詢的結果每筆查閱一次
                {
                    int KCheckListTimeIdd = (int)reader["KCheckListTimeId"];
                    KCheckListTimeId.Text = KCheckListTimeIdd.ToString();

                    //KCheckListTimeId.Text = reader.GetString(0);
                }
                reader.Close();



                for (int d = 1; d < i; d++)
                {
                    RadioButtonList gradee            = FindControl("radio" + d) as RadioButtonList;
                    Label           KCheckListItemidd = FindControl("labl" + d) as Label;
                    TextBox         textboxx          = FindControl("textboxxx" + d) as TextBox;

                    String gradeee = gradee.SelectedValue;
                    //if (gradeee == "") { }
                    //else {
                    //Request.Form["TextBox1"].Trim();
                    String     citem    = "INSERT INTO KCheckListItemSt(KCheckListItem,DateTime,Person,Grade,CheckListTime,Remark) Values('" + KCheckListItemidd.Text + "','" + Request.Form["TextBox1"].Trim() + "','" + personLabel.Text + "','" + gradee.SelectedValue + "','" + KCheckListTimeId.Text + "','" + textboxx.Text + "')"; //宣告SQL語法的字串,這邊可依照自行需求修改
                    SqlCommand cmdcitem = new SqlCommand(citem, connStrr);
                    cmdcitem.ExecuteNonQuery();

                    /**
                     *  if (gradeee == "不合格" || gradeee == "未檢查")
                     *  {
                     *      String checkmiss = "INSERT INTO KCheckListLost(KCheckListItem,DateTime,Person,CheckList,Remark,Status) Values('" + KCheckListItemidd.Text + "','" + Request.Form["TextBox1"].Trim() + "','" + personLabel.Text + "','" + KCheckListIdd + "','" + textboxx.Text + "','" + gradee.SelectedValue + "')";   //宣告SQL語法的字串,這邊可依照自行需求修改
                     *      SqlCommand cmdcheckmiss = new SqlCommand(checkmiss, connStrr);
                     *      cmdcheckmiss.ExecuteNonQuery();
                     *  }
                     *  else {
                     *
                     *  }
                     **/
                    //};
                    // String gradeee = gradee.SelectedValue;

                    //   Response.Write(chitemidd.Text+gradeee);
                }



                connStrr.Close();


                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('填報完成,請自行關閉頁面');", true);
                Response.Write("<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
                //Response.Write("<script>window.opener.document.getElementById('ContentPlaceHolder1_Self').click();self.close();opener.location.reload();</script>");
            }

            else
            {
                ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert('已有相同檢查紀錄');", true);
            }
        }
Example #29
0
    //==================执行与数据库的关联操作=====================
    protected void getCom(int i)
    {
        string        dd1 = Application["d1"].ToString();
        string        dd2 = Application["d2"].ToString();
        SqlConnection con = dataconn.getcon();

        switch (i)
        {
        //从数据库中选择单选题
        case 1:
            SqlDataAdapter myadapter1 = new SqlDataAdapter("select * "
                                                           + "from tb_Questions where que_type='单选题'and que_lessonid='"
                                                           + dd1 + "'and que_taotiid='" + dd2 + "'order by id desc", con);
            DataSet myds1 = new DataSet();
            myadapter1.Fill(myds1);
            DataList1.DataSource = myds1;
            DataList1.DataBind();
            //生成单选题题号
            for (int tID1 = 1; tID1 <= DataList1.Items.Count; tID1++)
            {
                Label lblSelect = (Label)DataList1.Items[tID1 - 1].FindControl("Label2");
                lblSelect.Text = tID1.ToString() + "、";
            }
            break;

        //从数据库中选择多选题
        case 2:
            SqlDataAdapter myadapter2 = new SqlDataAdapter("select * "
                                                           + "from tb_Questions where que_type='多选题'and que_lessonid='"
                                                           + dd1 + "'and que_taotiid='" + dd2 + "'order by id desc", con);
            DataSet myds2 = new DataSet();
            myadapter2.Fill(myds2);
            DataList2.DataSource = myds2;
            DataList2.DataBind();
            //生成多选题题号
            for (int tID2 = 1; tID2 <= DataList2.Items.Count; tID2++)
            {
                Label lblDSelect = (Label)DataList2.Items[tID2 - 1].FindControl("Label24");
                lblDSelect.Text = tID2.ToString() + "、";
            }
            break;

        //核对单选题答案
        case 3:
            SqlDataAdapter myadapter3 = new SqlDataAdapter("select id,que_answer"
                                                           + " from tb_Questions where que_type='单选题'and que_lessonid="
                                                           + dd1 + " and que_taotiid=" + dd2 + " order by id desc", con);
            DataSet myds3 = new DataSet();
            myadapter3.Fill(myds3);
            DataRow[] row1 = myds3.Tables[0].Select();
            //计算单选题成
            foreach (DataRow answer1 in row1)
            {
                int_row1 += 1;
                if (int_row1 <= 3)
                {
                    RadioButtonList rbl = (RadioButtonList)(DataList1.Items[int_row1 - 1].FindControl("RadioButtonList1"));
                    if (rbl.SelectedValue == "")
                    {
                        this.lblSel.Text = "0";
                    }
                    else
                    {
                        if (answer1["que_answer"].ToString().Trim() == rbl.SelectedValue.ToString().Trim())
                        {
                            int_row1Point   += 40 / DataList1.Items.Count;
                            this.lblSel.Text = int_row1Point.ToString();
                        }
                    }
                }
            }
            break;

        //核对多选题答案
        case 4:
            SqlDataAdapter myadapter4 = new SqlDataAdapter("select id,que_answer"
                                                           + " from tb_Questions where que_type='多选题'and que_lessonid="
                                                           + dd1 + " and que_taotiid=" + dd2 + " order by id desc", con);
            DataSet myds4 = new DataSet();
            myadapter4.Fill(myds4);
            DataRow[] row2 = myds4.Tables[0].Select();
            //计算多选题成绩
            foreach (DataRow answer2 in row2)
            {
                int_row2 += 1;
                if (int_row2 <= 3)
                {
                    CheckBoxList cbl = (CheckBoxList)(DataList2.Items[int_row2 - 1].FindControl("CheckBoxList1"));
                    if (cbl.SelectedValue == "")
                    {
                        lblDSel.Text = "0";
                    }
                    else
                    {
                        this.TextBox1.Text = "";
                        for (int q = 0; q < cbl.Items.Count; q++)
                        {
                            if (cbl.Items[q].Selected == true)
                            {
                                this.TextBox1.Text = TextBox1.Text.Trim() + cbl.Items[q].Value + ", ";
                            }
                        }
                        if (answer2["que_answer"].ToString().Trim() + "," == this.TextBox1.Text.Trim())
                        {
                            int_row2Point    += 60 / DataList2.Items.Count;
                            this.lblDSel.Text = int_row2Point.ToString();
                        }
                    }
                }
            }
            break;
        }
    }
Example #30
0
 private void BindPanel(Panel panel)
 {
     foreach (Control ctr in panel.Controls)
     {
         if (ctr is TextBox)
         {
             TextBox txt = (TextBox)ctr;
             if (dts.Columns.Contains(txt.ID.Substring(3)))
             {
                 txt.Text = dts.Rows[0][txt.ID.Substring(3)].ToString();
             }
         }
         if (ctr is Label)
         {
             Label lb = (Label)ctr;
             if (dts.Columns.Contains(lb.ID.Substring(2)))
             {
                 lb.Text = dts.Rows[0][lb.ID.Substring(2)].ToString();
             }
         }
         if (ctr is RadioButtonList)
         {
             RadioButtonList rbl = (RadioButtonList)ctr;
             if (dts.Columns.Contains(rbl.ID.Substring(3)))
             {
                 rbl.SelectedValue = dts.Rows[0][rbl.ID.Substring(3)].ToString();
             }
         }
         if (ctr is CheckBoxList)
         {
             CheckBoxList cbxl = (CheckBoxList)ctr;
             if (dts.Columns.Contains(cbxl.ID.Substring(4)))
             {
                 if (dts.Rows[0][cbxl.ID.Substring(4)].ToString().Contains('|'))
                 {
                     string[] str = dts.Rows[0][cbxl.ID.Substring(4)].ToString().Split('|');
                     for (int j = 0, a = str.Length; j < a; j++)
                     {
                         for (int k = 0, b = cbxl.Items.Count; k < b; k++)
                         {
                             if (cbxl.Items[k].Text == str[j])
                             {
                                 cbxl.Items[k].Selected = true;
                                 break;
                             }
                         }
                     }
                 }
                 else
                 {
                     for (int k = 0, b = cbxl.Items.Count; k < b; k++)
                     {
                         if (cbxl.Items[k].Text == dts.Rows[0][cbxl.ID.Substring(4)].ToString())
                         {
                             cbxl.Items[k].Selected = true;
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
        protected void uoVendorDropDownType_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //uoTextBoxHotelname.Text = "";
                //uoTextBoxEmailAdd.Text = "";
                //uoTextBoxRateContract.Text = "";
                //uoTextBoxRateConfirmed.Text = "";
                //uoTextBoxCheckInDate.Text = "";
                //uoDropDownListCurrency.SelectedIndex = 0;
                //uoHiddenFieldContractID.Value = "";
                //uoHiddenFieldVoucher.Value = "";

                DropDownList ddl = (DropDownList)sender;
                if (ViewState["NonTurnTransportation"] != null)
                {
                    List <NonTurnTransportation> ls = (List <NonTurnTransportation>)ViewState["NonTurnTransportation"];

                    var lst = ls.Where(n => n.VendorID == GlobalCode.Field2Int(ddl.SelectedItem.Value)).ToList();

                    if (lst.Count > 0)
                    {
                        DropDownList cbo = (DropDownList)sender;

                        uoTextBoxEmailAdd.Text = lst[0].Email;

                        uoTextBoxRateContract.Text  = lst[0].Rate.ToString();
                        uoTextBoxRateConfirmed.Text = lst[0].Rate.ToString();


                        uoTextBoxPickupDate.Text = GlobalCode.Field2DateTime(Request.QueryString["dt"]).ToString();
                        uoTextBoxPickupTime.Text = "07:00";

                        RadioButtonList r = (RadioButtonList)RadioButtonList1;

                        Label       lblRoutFrom;
                        Label       lblRoutTo;
                        HiddenField uoHiddenFieldRouteFrom;
                        HiddenField uoHiddenFieldRouteTo;

                        HiddenField uoHiddenFieldAiportArr;
                        HiddenField uoHiddenFieldAiportDept;

                        HiddenField uoHiddenFieldHotel;
                        HiddenField uoHiddenFieldSeaport;


                        if (r.Text == "On")
                        {
                            uoDropDownListTFrom.SelectedIndex = 3;
                            uoDropDownListTTo.SelectedIndex   = 2;



                            foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
                            {
                                lblRoutFrom = (Label)item.FindControl("lblRouteFrom");
                                lblRoutTo   = (Label)item.FindControl("lblRouteTo");

                                uoHiddenFieldRouteFrom = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                                uoHiddenFieldRouteTo   = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");

                                uoHiddenFieldAiportArr = (HiddenField)item.FindControl("uoHiddenFieldAiportArr");
                                uoHiddenFieldHotel     = (HiddenField)item.FindControl("uoHiddenFieldHotel");


                                lblRoutFrom.Text = uoHiddenFieldAiportArr.Value;
                                lblRoutTo.Text   = uoHiddenFieldHotel.Value;

                                uoHiddenFieldRouteFrom.Value = uoHiddenFieldAiportArr.Value;
                                uoHiddenFieldRouteTo.Value   = uoHiddenFieldHotel.Value;
                            }
                        }
                        else if (r.Text == "Off")
                        {
                            uoDropDownListTFrom.SelectedIndex = 1;
                            uoDropDownListTTo.SelectedIndex   = 2;


                            foreach (ListViewDataItem item in uoListviewVehicleInfo.Items)
                            {
                                lblRoutFrom            = (Label)item.FindControl("lblRouteFrom");
                                lblRoutTo              = (Label)item.FindControl("lblRouteTo");
                                uoHiddenFieldRouteFrom = (HiddenField)item.FindControl("uoHiddenFieldRouteFrom");
                                uoHiddenFieldRouteTo   = (HiddenField)item.FindControl("uoHiddenFieldRouteTo");


                                uoHiddenFieldHotel   = (HiddenField)item.FindControl("uoHiddenFieldHotel");
                                uoHiddenFieldSeaport = (HiddenField)item.FindControl("uoHiddenFieldSeaport");


                                lblRoutFrom.Text = uoHiddenFieldSeaport.Value;
                                lblRoutTo.Text   = uoHiddenFieldHotel.Value;

                                uoHiddenFieldRouteFrom.Value = uoHiddenFieldSeaport.Value;
                                uoHiddenFieldRouteTo.Value   = uoHiddenFieldHotel.Value;
                            }
                        }



                        uoDropDownListCurrency.SelectedIndex = GlobalCode.GetselectedIndex(uoDropDownListCurrency, lst[0].CurrentcyID);
                        uoHiddenFieldContractID.Value        = lst[0].ContractID.ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #32
0
        private void ShowInfo(int _id)
        {
            BLL.article   bll   = new BLL.article();
            Model.article model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text           = model.call_index;
            txtTitle.Text   = model.title;
            txtLinkUrl.Text = model.link_url;
            //不是相册图片就绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);

            if (!filename.StartsWith("thumb_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtSeoTitle.Text        = model.seo_title;
            txtSeoKeywords.Text     = model.seo_keywords;
            txtSeoDescription.Text  = model.seo_description;
            txtZhaiyao.Text         = model.zhaiyao;
            txtContent.Value        = model.content;
            txtSortId.Text          = model.sort_id.ToString();
            txtClick.Text           = model.click.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            txtAddTime.Text         = model.add_time.ToString("yyyy-MM-dd HH:mm:ss");


            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }

            if (model.vote_id != 0)
            {
                ddlvote_id.SelectedValue = model.vote_id.ToString();
            }

            //扩展字段赋值
            List <Model.article_attribute_field> ls1 = new BLL.article_attribute_field().GetModelList(this.channel_id, "");

            foreach (Model.article_attribute_field modelt1 in ls1)
            {
                switch (modelt1.control_type)
                {
                case "single-text":     //单行文本
                    TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox;
                    if (txtControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (modelt1.is_password == 1)
                        {
                            txtControl.Attributes.Add("value", model.fields[modelt1.name]);
                        }
                        else
                        {
                            txtControl.Text = model.fields[modelt1.name];
                        }
                    }
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea;
                    if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        txtAreaControl.Value = model.fields[modelt1.name];
                    }
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox;
                    if (cbControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (model.fields[modelt1.name] == "1")
                        {
                            cbControl.Checked = true;
                        }
                        else
                        {
                            cbControl.Checked = false;
                        }
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList;
                    if (rblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        rblControl.SelectedValue = model.fields[modelt1.name];
                    }
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList;
                    if (cblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        string[] valArr = model.fields[modelt1.name].Split(',');
                        for (int i = 0; i < cblControl.Items.Count; i++)
                        {
                            cblControl.Items[i].Selected = false;     //先取消默认的选中
                            foreach (string str in valArr)
                            {
                                if (cblControl.Items[i].Value == str)
                                {
                                    cblControl.Items[i].Selected = true;
                                }
                            }
                        }
                    }
                    break;
                }
            }
            //绑定图片相册
            if (filename.StartsWith("thumb_"))
            {
                hidFocusPhoto.Value = model.img_url; //封面图片
            }
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
            //绑定内容附件
            rptAttachList.DataSource = model.attach;
            rptAttachList.DataBind();
            //赋值用户组价格
            if (model.group_price != null)
            {
                for (int i = 0; i < this.rptPrice.Items.Count; i++)
                {
                    int hideId = Convert.ToInt32(((HiddenField)this.rptPrice.Items[i].FindControl("hideGroupId")).Value);
                    foreach (Model.user_group_price modelt in model.group_price)
                    {
                        if (hideId == modelt.group_id)
                        {
                            ((HiddenField)this.rptPrice.Items[i].FindControl("hidePriceId")).Value = modelt.id.ToString();
                            ((TextBox)this.rptPrice.Items[i].FindControl("txtGroupPrice")).Text    = modelt.price.ToString();
                        }
                    }
                }
            }
        }
        public void CreateAttributeControls()
        {
            var productVariant = this.ProductService.GetProductVariantById(this.ProductVariantId);

            if (productVariant != null)
            {
                this.phAttributes.Controls.Clear();
                var productVariantAttributes = productVariant.ProductVariantAttributes;
                if (productVariantAttributes.Count > 0)
                {
                    StringBuilder adjustmentTableScripts = new StringBuilder();
                    StringBuilder attributeScripts       = new StringBuilder();

                    this.Visible = true;
                    foreach (var attribute in productVariantAttributes)
                    {
                        var divAttribute   = new Panel();
                        var attributeTitle = new Label();
                        if (attribute.IsRequired)
                        {
                            attributeTitle.Text = "<span>*</span> ";
                        }

                        //text prompt / title
                        string textPrompt = string.Empty;
                        if (!string.IsNullOrEmpty(attribute.TextPrompt))
                        {
                            textPrompt = attribute.TextPrompt;
                        }
                        else
                        {
                            textPrompt = attribute.ProductAttribute.LocalizedName;
                        }

                        attributeTitle.Text += Server.HtmlEncode(textPrompt);
                        attributeTitle.Style.Add("font-weight", "bold");

                        //description
                        if (!string.IsNullOrEmpty(attribute.ProductAttribute.LocalizedDescription))
                        {
                            attributeTitle.Text += string.Format("<br /><span>{0}</span>", Server.HtmlEncode(attribute.ProductAttribute.LocalizedDescription));
                        }

                        bool addBreak = true;
                        switch (attribute.AttributeControlType)
                        {
                        case AttributeControlTypeEnum.TextBox:
                        {
                            addBreak = false;
                        }
                        break;

                        default:
                            break;
                        }
                        if (addBreak)
                        {
                            attributeTitle.Text += "<br />";
                        }
                        else
                        {
                            attributeTitle.Text += "&nbsp;&nbsp;&nbsp;";
                        }
                        divAttribute.Controls.Add(attributeTitle);
                        phAttributes.Controls.Add(divAttribute);

                        string controlId = string.Format("{0}_{1}", attribute.ProductAttribute.ProductAttributeId, attribute.ProductVariantAttributeId);
                        switch (attribute.AttributeControlType)
                        {
                        case AttributeControlTypeEnum.DropdownList:
                        {
                            var ddlAttributes = new DropDownList();
                            ddlAttributes.ID = controlId;
                            divAttribute.Controls.Add(ddlAttributes);
                            ddlAttributes.Items.Clear();

                            //dynamic price update
                            if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                            {
                                adjustmentTableScripts.AppendFormat("{0}['{1}'] = new Array(", AdjustmentTableName, ddlAttributes.ClientID);
                                attributeScripts.AppendFormat("$('#{0}').change(function(){{{1}();}});\n", ddlAttributes.ClientID, AdjustmentFuncName);
                            }

                            int numberOfJsArrayItems = 0;
                            if (!attribute.IsRequired)
                            {
                                ddlAttributes.Items.Add(new ListItem("---", "0"));

                                //dynamic price update
                                if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                                {
                                    adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0},", decimal.Zero);
                                    numberOfJsArrayItems++;
                                }
                            }
                            var pvaValues = attribute.ProductVariantAttributeValues;

                            //values
                            bool preSelectedSet = false;
                            foreach (var pvaValue in pvaValues)
                            {
                                string pvaValueName = pvaValue.LocalizedName;

                                //display price if allowed
                                if (!this.HidePrices &&
                                    (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                     (NopContext.Current.User != null &&
                                      !NopContext.Current.User.IsGuest)))
                                {
                                    decimal taxRate             = decimal.Zero;
                                    decimal priceAdjustmentBase = this.TaxService.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                    decimal priceAdjustment     = this.CurrencyService.ConvertCurrency(priceAdjustmentBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                    if (priceAdjustmentBase > decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                    }
                                    else if (priceAdjustmentBase < decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [-{0}]", PriceHelper.FormatPrice(-priceAdjustment, false, false));
                                    }

                                    //dynamic price update
                                    if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                                    {
                                        adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0},", (float)priceAdjustment);
                                        numberOfJsArrayItems++;
                                    }
                                }

                                var pvaValueItem = new ListItem(pvaValueName, pvaValue.ProductVariantAttributeValueId.ToString());
                                if (!preSelectedSet && pvaValue.IsPreSelected)
                                {
                                    pvaValueItem.Selected = pvaValue.IsPreSelected;
                                    preSelectedSet        = true;
                                }
                                ddlAttributes.Items.Add(pvaValueItem);
                            }

                            //dynamic price update
                            if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                            {
                                //If you create an array with a single numeric parameter, that number is used for specifying the number of elements in this array.
                                //so have a little hack here (we need at least two elements)
                                if (numberOfJsArrayItems == 1)
                                {
                                    adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0},", decimal.Zero);
                                }
                            }

                            //dynamic price update
                            if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                            {
                                adjustmentTableScripts.Length -= 1;
                                adjustmentTableScripts.Append(");\n");
                            }
                        }
                        break;

                        case AttributeControlTypeEnum.RadioList:
                        {
                            var rblAttributes = new RadioButtonList();
                            rblAttributes.ID = controlId;
                            divAttribute.Controls.Add(rblAttributes);
                            rblAttributes.Items.Clear();

                            var  pvaValues      = attribute.ProductVariantAttributeValues;
                            bool preSelectedSet = false;
                            foreach (var pvaValue in pvaValues)
                            {
                                string pvaValueName = pvaValue.LocalizedName;

                                //display price if allowed
                                if (!this.HidePrices &&
                                    (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                     (NopContext.Current.User != null &&
                                      !NopContext.Current.User.IsGuest)))
                                {
                                    decimal taxRate             = decimal.Zero;
                                    decimal priceAdjustmentBase = this.TaxService.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                    decimal priceAdjustment     = this.CurrencyService.ConvertCurrency(priceAdjustmentBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                    if (priceAdjustmentBase > decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                    }
                                    else if (priceAdjustmentBase < decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [-{0}]", PriceHelper.FormatPrice(-priceAdjustment, false, false));
                                    }

                                    //dynamic price update
                                    if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                                    {
                                        adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0}['{1}_{2}'] = {3};\n", AdjustmentTableName, rblAttributes.ClientID, rblAttributes.Items.Count, (float)priceAdjustment);
                                        attributeScripts.AppendFormat("$('#{0}_{1}').click(function(){{{2}();}});\n", rblAttributes.ClientID, rblAttributes.Items.Count, AdjustmentFuncName);
                                    }
                                }

                                var pvaValueItem = new ListItem(Server.HtmlEncode(pvaValueName), pvaValue.ProductVariantAttributeValueId.ToString());
                                if (!preSelectedSet && pvaValue.IsPreSelected)
                                {
                                    pvaValueItem.Selected = pvaValue.IsPreSelected;
                                    preSelectedSet        = true;
                                }
                                rblAttributes.Items.Add(pvaValueItem);
                            }
                        }
                        break;

                        case AttributeControlTypeEnum.Checkboxes:
                        {
                            var cblAttributes = new CheckBoxList();
                            cblAttributes.ID = controlId;
                            divAttribute.Controls.Add(cblAttributes);
                            cblAttributes.Items.Clear();

                            //values
                            var pvaValues = attribute.ProductVariantAttributeValues;
                            foreach (var pvaValue in pvaValues)
                            {
                                string pvaValueName = pvaValue.LocalizedName;

                                //display price if allowed
                                if (!this.HidePrices &&
                                    (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                     (NopContext.Current.User != null &&
                                      !NopContext.Current.User.IsGuest)))
                                {
                                    decimal taxRate             = decimal.Zero;
                                    decimal priceAdjustmentBase = this.TaxService.GetPrice(productVariant, pvaValue.PriceAdjustment, out taxRate);
                                    decimal priceAdjustment     = this.CurrencyService.ConvertCurrency(priceAdjustmentBase, this.CurrencyService.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                    if (priceAdjustmentBase > decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [+{0}]", PriceHelper.FormatPrice(priceAdjustment, false, false));
                                    }
                                    else if (priceAdjustmentBase < decimal.Zero)
                                    {
                                        pvaValueName += string.Format(" [-{0}]", PriceHelper.FormatPrice(-priceAdjustment, false, false));
                                    }

                                    //dynamic price update
                                    if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                                    {
                                        adjustmentTableScripts.AppendFormat(CultureInfo.InvariantCulture, "{0}['{1}_{2}'] = {3};\n", AdjustmentTableName, cblAttributes.ClientID, cblAttributes.Items.Count, (float)priceAdjustment);
                                        attributeScripts.AppendFormat("$('#{0}_{1}').click(function(){{{2}();}});\n", cblAttributes.ClientID, cblAttributes.Items.Count, AdjustmentFuncName);
                                    }
                                }

                                var pvaValueItem = new ListItem(Server.HtmlEncode(pvaValueName), pvaValue.ProductVariantAttributeValueId.ToString());
                                pvaValueItem.Selected = pvaValue.IsPreSelected;
                                cblAttributes.Items.Add(pvaValueItem);
                            }
                        }
                        break;

                        case AttributeControlTypeEnum.TextBox:
                        {
                            var txtAttribute = new TextBox();
                            txtAttribute.Width = this.SettingManager.GetSettingValueInteger("ProductAttribute.Textbox.Width", 300);
                            txtAttribute.ID    = controlId;
                            divAttribute.Controls.Add(txtAttribute);
                        }
                        break;

                        case AttributeControlTypeEnum.MultilineTextbox:
                        {
                            var txtAttribute = new TextBox();
                            txtAttribute.ID       = controlId;
                            txtAttribute.TextMode = TextBoxMode.MultiLine;
                            txtAttribute.Width    = this.SettingManager.GetSettingValueInteger("ProductAttribute.MultiTextbox.Width", 300);
                            txtAttribute.Height   = this.SettingManager.GetSettingValueInteger("ProductAttribute.MultiTextbox.Height", 150);
                            divAttribute.Controls.Add(txtAttribute);
                        }
                        break;

                        case AttributeControlTypeEnum.Datepicker:
                        {
                            var datePicker = new NopDatePicker();
                            //changes these properties in order to change year range
                            datePicker.FirstYear = DateTime.Now.Year;
                            datePicker.LastYear  = DateTime.Now.Year + 1;
                            datePicker.ID        = controlId;
                            divAttribute.Controls.Add(datePicker);
                        }
                        break;

                        default:
                            break;
                        }
                    }


                    //display price if allowed
                    if (!this.HidePrices &&
                        (!this.SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                         (NopContext.Current.User != null &&
                          !NopContext.Current.User.IsGuest)))
                    {
                        //dynamic price update
                        if (this.SettingManager.GetSettingValueBoolean("ProductAttribute.EnableDynamicPriceUpdate"))
                        {
                            lblAdjustmentTableScripts.Text = adjustmentTableScripts.ToString();
                            lblAttributeScripts.Text       = attributeScripts.ToString();
                            phDynPrice.Visible             = true;
                        }
                        else
                        {
                            phDynPrice.Visible = false;
                        }
                    }
                    else
                    {
                        phDynPrice.Visible = false;
                    }
                }
                else
                {
                    this.Visible = false;
                }
            }
            else
            {
                this.Visible = false;
            }
        }
Example #34
0
    private void BindingItem_P(DataListItemEventArgs e)
    {
        DataRowView dr           = (DataRowView)e.Item.DataItem;
        string      q_dfn_id     = DataTypeUtility.GetValue(dr["Q_DFN_ID"]);
        string      q_sbj_id     = DataTypeUtility.GetValue(dr["Q_SBJ_ID"]);
        string      q_obj_id     = DataTypeUtility.GetValue(dr["Q_OBJ_ID"]);
        string      q_sbj_define = DataTypeUtility.GetValue(dr["Q_SBJ_DEFINE"]);
        string      q_sbj_desc   = DataTypeUtility.GetValue(dr["Q_SBJ_DESC"]);
        double      weight       = DataTypeUtility.GetToDouble(dr["WEIGHT"]);

        Literal         ltrDefine     = e.Item.FindControl("ltrLevelDefine") as Literal;
        Literal         ltrDesc       = e.Item.FindControl("ltrLevelDesc") as Literal;
        RadioButtonList rBtnList      = e.Item.FindControl("rBtnList") as RadioButtonList;
        TextBox         txtValue      = e.Item.FindControl("txtLevelValue") as TextBox;
        HiddenField     hAttachNo     = e.Item.FindControl("hAttachNo") as HiddenField;
        DropDownList    ddlFileUpload = e.Item.FindControl("ddlFileUpload") as DropDownList;
        ImageButton     ibnDownload   = e.Item.FindControl("ibnDownload") as ImageButton;
        ImageButton     iBtnAttach    = e.Item.FindControl("iBtnAttach") as ImageButton;
        Literal         ltrUpload     = e.Item.FindControl("ltrUpload") as Literal;
        TextBox         txtTextValue  = e.Item.FindControl("txtLevelTextValue") as TextBox;
        TextBox         txtOpinion    = e.Item.FindControl("txtLevelOpinion") as TextBox;
        Literal         ltrPointData  = e.Item.FindControl("ltrLevelPointData") as Literal;
        Label           lblCnt        = e.Item.FindControl("lblCnt") as Label;

        TextBoxCommon.SetOnlyInteger(txtValue);

        ltrUpload.Text = string.Format("<a href='#null' onclick=\"mfUpload('{0}');\"><img src='../images/icon/icon_gr_po05.gif' align='absmiddle' border='0'/></a>", hAttachNo.ClientID);

        ibnDownload.CausesValidation = false;
        ibnDownload.CommandName      = ddlFileUpload.UniqueID;

        ltrDefine.Text = q_sbj_define;
        ltrDesc.Text   = q_sbj_desc;

        DropDownListCommom.BindDefaultValue(ddlFileUpload, "--------------------", "");

        Biz_QuestionItems questionItems = new Biz_QuestionItems();
        DataSet           ds            = questionItems.GetQuestionItem("", q_sbj_id, Q_OBJ_ID);

        if (ds.Tables[0].Rows.Count == 0)
        {
            rBtnList.Visible = false;
            txtValue.Visible = false;
            txtValue.Width   = Unit.Percentage(100);
        }
        else if (ds.Tables[0].Rows[0]["SUBJECT_ITEM_YN"].ToString() == "1")
        {
            rBtnList.Visible = false;
            txtValue.Visible = true;
            txtValue.Width   = Unit.Percentage(100);
        }
        else
        {
            // 평가자인지 피평가인지 따라
            if (EST_TGT_TYPE.Equals("EST"))
            {
                ibnDownload.Visible = true;
                ltrUpload.Visible   = false;
            }
            else if (EST_TGT_TYPE.Equals("TGT"))
            {
                ibnDownload.Visible = true;
                ltrUpload.Visible   = true;
                rBtnList.Visible    = false;
                txtOpinion.Visible  = false;
            }

            txtValue.Visible = false;

            // 만약 질의항목에 설명을 표시할 경우
            if (_q_item_desc_use_yn.Equals("Y"))
            {
                rBtnList.RepeatLayout  = RepeatLayout.Table;
                rBtnList.DataTextField = "Q_ITEM_DESC";
            }

            rBtnList.DataSource = ds;
            rBtnList.DataBind();

            Biz_QuestionDatas questionDatas = new Biz_QuestionDatas(COMP_ID
                                                                    , EST_ID
                                                                    , ESTTERM_REF_ID
                                                                    , ESTTERM_SUB_ID
                                                                    , this.IESTTERM_STEP_PREVIOUS_SELECT
                                                                    , 0
                                                                    , 0
                                                                    , TGT_DEPT_ID
                                                                    , TGT_EMP_ID
                                                                    , q_sbj_id);
            // 데이타 바인딩

            WebUtility.FindByValueRadioButtonList(rBtnList, questionDatas.Q_Itm_ID);
            TOTALPOINT += questionDatas.Point * weight;

            txtTextValue.Text = questionDatas.Text_Value;
            txtOpinion.Text   = questionDatas.Opinion;
            ltrPointData.Text = DataTypeUtility.GetToInt32_String(questionDatas.Point, "##.#0");
            hAttachNo.Value   = questionDatas.Attach_NO;

            SetUploadFileInfo(hAttachNo.Value, ddlFileUpload);

            if (ddlFileUpload.Items.Count > 1)
            {
                lblCnt.Text = string.Format("({0}건)", ddlFileUpload.Items.Count - 1);
            }

            //----------------- 라디오버튼 유효성 검사 시작 -------------------

            string clientIDs = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (i != 0)
                {
                    clientIDs += ";";
                }

                clientIDs += rBtnList.ClientID + "_" + i.ToString();
            }

            VALID_SCRIPT += string.Format("if(ValidQuestion('{0}', '{1}') == false) return false;", dr["Q_SBJ_NAME"], clientIDs);

            //----------------- 라디오버튼 유효성 검사 끝 -------------------
        }
    }
Example #35
0
    protected void ODS_SpecialTime_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        string          region     = ((TextBox)(this.FV_SpecialTime.FindControl("tbRegion"))).Text.Trim();
        string          workcenter = ((TextBox)(this.FV_SpecialTime.FindControl("tbWorkCenter"))).Text.Trim();
        RadioButtonList rblType    = (RadioButtonList)(this.FV_SpecialTime.FindControl("rblType"));

        SpecialTime specialTime = (SpecialTime)e.InputParameters[0];

        if (region == "")
        {
            specialTime.Region = null;
        }
        else
        {
            specialTime.Region = TheRegionMgr.LoadRegion(region);
            if (specialTime.Region == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.RegionInvalid", region);
                e.Cancel = true;
            }
        }
        if (workcenter == "")
        {
            specialTime.WorkCenter = null;
        }
        else
        {
            specialTime.WorkCenter = TheWorkCenterMgr.LoadWorkCenter(workcenter);
            if (specialTime.WorkCenter == null)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.WorkCenterInvalid", workcenter);
                e.Cancel = true;
            }
        }
        specialTime.Type = rblType.SelectedValue;
        try
        {
            Convert.ToDateTime(specialTime.StartTime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.StartTimeInvalid");
            e.Cancel = true;
        }
        try
        {
            Convert.ToDateTime(specialTime.EndTime);
        }
        catch (Exception)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.EndTimeInvalid");
            e.Cancel = true;
        }
        if (DateTime.Compare(specialTime.StartTime, specialTime.EndTime) >= 0)
        {
            ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.TimeCompare");
            e.Cancel = true;
        }
        IList specialTimes = TheSpecialTimeMgr.GetSpecialTime(specialTime.StartTime, specialTime.EndTime, region, workcenter);

        foreach (SpecialTime st in specialTimes)
        {
            if (st.Type == specialTime.Type)
            {
                ShowWarningMessage("MasterData.WorkCalendar.WarningMessage.Error3");
                e.Cancel = true;
            }
        }
    }
Example #36
0
    protected void answerImageButton_Click(object sender, ImageClickEventArgs e)
    {
        string      questId = Session["editQuestNum"].ToString();
        ImageButton btn     = (ImageButton)sender;
        string      AnsId   = btn.ID;
        int         ansNum  = Convert.ToInt16(AnsId.Substring(AnsId.Length - 1));

        Session["answer"] = ansNum;

        //FakexmlDoc = XmlDataSourceFakeGame.GetXmlDocument();

        XmlElement Answer = FakexmlDoc.CreateElement("Answer");

        Answer.SetAttribute("pic", "no");
        Answer.SetAttribute("result", "wrong");
        XmlNode answers = FakexmlDoc.SelectSingleNode("/tree/game/questions/question[@numberQues = " + questId + "]/Answers");

        answers.AppendChild(Answer);

        ImageButton delete = new ImageButton();

        delete.ID       = "answerDelete" + ansNum;
        delete.CssClass = "answer" + ansNum + "deleteClass";
        delete.ImageUrl = "images/Exit.png";
        delete.Click   += Delete_Answer;

        RadioButtonList answersList = (RadioButtonList)FindControl("answersList");
        ListItem        check       = new ListItem();

        check.Text  = "";
        check.Value = ansNum.ToString();
        answersList.Items.Add(check);

        ((Label)FindControl("answer" + ansNum + "tooltip")).Style.Add("visibility", "hidden");
        ((ImageButton)FindControl("ImageButton" + ansNum)).Enabled = false;
        ((Label)FindControl("Label" + ansNum)).Enabled             = false;
        ((ImageButton)FindControl("ImageButton" + ansNum)).Style.Add("visibility", "hidden");
        ((Label)FindControl("Label" + ansNum)).Style.Add("visibility", "hidden");

        if (ansNum != 6)
        {
            ((ImageButton)FindControl("ImageButton" + (ansNum + 1))).Style.Add("visibility", "visible");
            ((ImageButton)FindControl("answerImage" + (ansNum + 1))).Style.Add("visibility", "visible");
            ((Label)FindControl("Label" + (ansNum + 1))).Style.Add("visibility", "visible");
            ((Label)FindControl("answer" + (ansNum + 1) + "tooltip")).Style.Add("visibility", "visible");
            ((Label)FindControl("answer" + (ansNum + 1) + "tooltip")).Text = "ניתן להוסיף תשובה רק לאחר מילוי תוכן התשובות הקיימות";
        }

        if (AnsId.Contains("Button"))
        {
            TextBox ansewrText = new TextBox();
            ansewrText.TextMode = TextBoxMode.MultiLine;
            ansewrText.Attributes["placeholder"] = "הזן תשובה";
            ansewrText.Attributes["enableThis"]  = (ansNum + 1).ToString();
            ansewrText.ID       = "answer" + ansNum + "Textbox";
            ansewrText.CssClass = "ansText" + ansNum + "Class";
            ansewrText.Attributes["CharacterLimit"]    = "50";
            ansewrText.Attributes["CharacterForLabel"] = "AnslableCount" + ansNum;
            ansewrText.Attributes["ifEmptyDisable"]    = "ImageButton" + (ansNum + 1);
            Label lableCount = new Label();
            lableCount.ID       = "AnslableCount" + ansNum;
            lableCount.CssClass = "ansText" + ansNum + "Class";
            lableCount.Text     = ansewrText.Text.Length.ToString() + "/50";
            lableCount.Style.Add("visibility", "hidden");
            Panel1.Controls.Add(ansewrText);
            Panel1.Controls.Add(lableCount);
        }
        else
        {
            Answer.Attributes["pic"].Value = "yes";
            //נתיב לשמירה התמונות
            string imagesLibPath = "uploadedFiles/";

            string fileType = ((FileUpload)FindControl("FileUpload" + ansNum)).PostedFile.ContentType;

            if (fileType.Contains("image"))     //בדיקה האם הקובץ שהוכנס הוא תמונה
            {
                // הנתיב המלא של הקובץ עם שמו האמיתי של הקובץ
                string fileName = ((FileUpload)FindControl("FileUpload" + ansNum)).PostedFile.FileName;
                // הסיומת של הקובץ
                string endOfFileName = fileName.Substring(fileName.LastIndexOf("."));
                //לקיחת הזמן האמיתי למניעת כפילות בתמונות
                string myTime = DateTime.Now.ToString("dd_MM_yy-HH_mm_ss");
                // חיבור השם החדש עם הסיומת של הקובץ
                string imageNewName = myTime + ansNum + endOfFileName;
                // Bitmap המרת הקובץ שיתקבל למשתנה מסוג
                System.Drawing.Bitmap bmpPostedImage = new System.Drawing.Bitmap(((FileUpload)FindControl("FileUpload" + ansNum)).PostedFile.InputStream);
                //קריאה לפונקציה המקטינה את התמונה
                //אנו שולחים לה את התמונה שלנו בגירסאת הביטמאפ ואת האורך והרוחב שאנו רוצים לתמונה החדשה
                System.Drawing.Image objImage = FixedSize(bmpPostedImage, 300, 300);
                //שמירה של הקובץ לספרייה בשם החדש שלו
                objImage.Save(Server.MapPath(imagesLibPath) + imageNewName);
                //הצגה של הקובץ החדש מהספרייה
                ((ImageButton)FindControl("answerImage" + ansNum)).ImageUrl = imagesLibPath + imageNewName;
                Answer.InnerText = Server.UrlEncode(imagesLibPath + imageNewName);

                if (ansNum != 6)
                {
                    ((Label)FindControl("answer" + (ansNum + 1) + "tooltip")).Style.Add("visibility", "hidden");
                    ((ImageButton)FindControl("ImageButton" + (ansNum + 1))).Enabled = true;
                    ((ImageButton)FindControl("answerImage" + (ansNum + 1))).Enabled = true;
                    ((Label)FindControl("Label" + (ansNum + 1))).Enabled             = true;
                    ((Label)FindControl("Label" + (ansNum + 1))).CssClass            = "answerLabelClass";
                }
            }
            else
            {
                //הצגה של המסך האפור
                grayWindows.Visible = true;
                //הצגת הפופ-אפ של המחיקה
                DeleteConfPopUp.Visible = true;

                popUpmessage.Text     = "הקובץ שבחרת איננו מסוג PNG  /  JPEG";
                OkBtn0.Text           = "בחר קובץ אחר";
                OkBtn0.OnClientClick += "openFileUploader(" + ansNum + "); return false;";
                myExitBtn.Text        = "המשך עריכה";
            }
            ImageButton NewImageAns = (ImageButton)FindControl("answerImage" + ansNum);
            NewImageAns.CssClass = "answerImageClassTrue";
        }
        saveButton.Enabled = true;
        saveButtontooltip.Style.Add("visibility", "hidden");
        XmlDataSourceFakeGame.Save();
        Panel1.Controls.Add(delete);
        Panel1.DataBind();
    }
Example #37
0
    //输出一个字段
    //li_tdnums_onerow:当前行已输出了几列
    //li_colnums_show:每行显示几列(标准情况下)
    //pi_isnewdoc 0:新文档  1:旧文档
    //ifhavarole:表单上是否有权限  0:lable输出 1:input输出
    //ifflowdoc:是否流程表单 0:非流程 1:流程
    //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限
    public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid)
    {
        int li_return = li_tdnums_onerow;

        string ls_laborinput = "0";     //输出LABLE还是INPUT    0:LABLE    1:INPUT
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield();
        DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text);

        int li_left = 30;
        int li_right = 70;
        if (dtfield.Rows.Count > 0)
        {
            string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString();     //字段类型
            if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5")   //如果设置了不显示左侧说明文字,则不加载左侧列
            {
                li_return += 1;
                //插入单元格(左侧)
                TableCell tCell = new TableCell();
                tRow.Cells.Add(tCell);
                tCell.Width = Unit.Percentage((li_left / li_colnums_show));
                tCell.Height = Unit.Pixel(30);
                tCell.CssClass = "Tdcellleft";
                tCell.HorizontalAlign = HorizontalAlign.Center;
                tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString()));
            }
            else
            {
                li_left = 50;
                li_right = 50;
            }
            //插入单元格(右侧)
            TableCell tCell2 = new TableCell();
            tRow.Cells.Add(tCell2);
            tCell2.Width = Unit.Percentage((li_right / li_colnums_show));
            tCell2.Height = Unit.Pixel(30);
            tCell2.CssClass = "Tdcellright";
            if (dtfield.Rows[0]["hy_align"].ToString() == "left")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Left;
            }
            if (dtfield.Rows[0]["hy_align"].ToString() == "center")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Center;
            }
            if (dtfield.Rows[0]["hy_align"].ToString() == "right")
            {
                tCell2.HorizontalAlign = HorizontalAlign.Right;
            }
            tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());
            li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString());

            //赋值(新文档取配置的默认值,旧文档取数据库表中的值)
            string field_docvalue = "";
            if (pi_isnewdoc == "0")     //新文档
            {
                if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1")
                {
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0")
                    {
                        field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString();     //手工配置
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1")
                    {
                        DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString());
                        field_docvalue = dt_getfieldvalue.Rows[0][0].ToString();     //SQL语句
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2")
                    {
                        field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString();     //SESSION
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3")
                    {
                        if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                            field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd");     //当前时间
                        else
                            field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss");     //当前时间
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4")
                    {
                        //自动生成
                        if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值")
                        {
                            //得到目前最大的数值,然后+1,未找到则赋值为1
                            DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text);
                            if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "")
                                field_docvalue += "1";
                            else
                                field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString();
                        }
                        else
                        {
                            field_docvalue += System.Guid.NewGuid().ToString();
                        }
                    }
                    if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "5")
                    {
                        field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString();
                    }
                }
            }
            else
            {
                if (field_type == "文本" || field_type == "多行文本" || field_type == "多行文本_TEXT" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器")
                {
                    string ls_sql = "select hyc_" + hy_fieldid + " from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'";
                    DataTable dt_getdocvalue = Hyoa_global.GetDataTable(ls_sql);
                    if (dt_getdocvalue.Rows.Count > 0)
                    {
                        field_docvalue = dt_getdocvalue.Rows[0][0].ToString();
                        if (field_type == "日期")
                        {
                            if (field_docvalue.Length > 8)
                            {
                                if (field_docvalue.Substring(0, 8) == "1900-1-1")
                                {
                                    field_docvalue = "&nbsp;";
                                }
                                else
                                {
                                    if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd")
                                    {
                                        field_docvalue = System.DateTime.Parse(field_docvalue).ToString("yyyy-MM-dd");
                                    }
                                }
                            }
                        }
                    }
                }
                if (field_type == "说明文字")
                {
                    field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString();
                }
            }

            //判断是输出LABL还是INPUT
            if (pi_isnewdoc == "0")     //新文档
            {
                if (ifflowdoc == "0")   //非流程
                {
                    if (ifhavarole == "1")  //有权限
                    {
                        ls_laborinput = "1";
                    }
                }
                else
                {
                    if (ifhavarole == "1")  //有权限
                    {
                        //有流程(判断当前环节这个字段是否有权限)
                        HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
                        ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid);
                        if (ls_laborinput == "0")
                        {
                            field_docvalue = "";
                        }
                    }
                    else
                    {
                        field_docvalue = "";
                    }
                }
            }
            else     //旧文档
            {
                if (ifflowdoc == "0")   //非流程
                {
                    if (ifhavarole == "1")  //有权限
                    {
                        ls_laborinput = "1";
                        //如果文档已经确认,则输出lable
                        string ls_sql = "select hy_ifconfirm from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'";
                        DataTable dt_getifconfirm = Hyoa_global.GetDataTable(ls_sql);
                        if (dt_getifconfirm.Rows.Count > 0)
                        {
                            if (dt_getifconfirm.Rows[0]["hy_ifconfirm"].ToString() == "1")
                                ls_laborinput = "0";
                        }
                    }
                }
                else
                {
                    if (ifhavarole == "1")  //有权限
                    {
                        //有流程(判断当前环节这个字段是否有权限)
                        HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield();
                        ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid);
                        //如果流程结束了,则输出lable
                        if (hy_curtacheid.Text == "**")
                        {
                            ls_laborinput = "0";
                        }
                    }
                }
            }

            //如果是输出LABLE,值为空则赋为&nbsp;不为空时需要转换回车和空格
            if (ls_laborinput == "0")
            {
                if (field_docvalue == "")
                {
                    field_docvalue = "&nbsp;";
                }
                else
                {
                    if (field_type != "编辑器")
                    {
                        field_docvalue = RtfToText(field_docvalue);
                    }
                }
            }

            //单行文本
            if (field_type == "文本")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //多行文本
            if (field_type == "多行文本")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //多行文本_TEXT
            if (field_type == "多行文本_TEXT")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //按钮
            if (field_type == "按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = "&nbsp;";
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //一直显示的按钮
            if (field_type == "一直显示的按钮")
            {
                //-----开始输出字段------
                Label txtTextBox = new Label();
                txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                txtTextBox.Text = field_docvalue;
                tCell2.Controls.Add(txtTextBox);
            }
            //日期
            if (field_type == "日期")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //文本加按钮
            if (field_type == "文本加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    txtTextBox.Width = Unit.Parse("60%");
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                }
            }
            //多行文本加按钮
            if (field_type == "多行文本加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                }
            }
            //意见加按钮
            if (field_type == "意见加按钮")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.MultiLine;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    //txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" /><input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_cz' value=' 重 置 ' class=btn3 onclick=\"document.getElementById('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "').value='';\" />";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                }
            }
            //数值
            if (field_type == "数值")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //对话框列表(下拉框
            if (field_type == "对话框列表")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    DropDownList ddlDropDownList = new DropDownList();
                    ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                ddlDropDownList.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            //如果SQL语句中含有特殊标示,则需要替换
                            string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                            if (ls_sql.Contains("用户ID"))
                            {
                                ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                            }
                            if (ls_sql.Contains("用户名"))
                            {
                                ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                            }
                            if (ls_sql.Contains("部门ID"))
                            {
                                ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                            }
                            if (ls_sql.Contains("部门名"))
                            {
                                ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                            }
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            ddlDropDownList.DataSource = dt_options;
                            ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName;
                            ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName;
                            ddlDropDownList.DataBind();
                        }
                    }
                    ddlDropDownList.Items.Insert(0, new ListItem("--请选择--", ""));
                    ddlDropDownList.SelectedValue = field_docvalue;
                    tCell2.Controls.Add(ddlDropDownList);
                }
            }
            //复选框(查询时直接显示文本框)
            if (field_type == "复选框")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    CheckBoxList txtTextBox = new CheckBoxList();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                txtTextBox.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        //如果SQL语句中含有特殊标示,则需要替换
                        string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                        if (ls_sql.Contains("用户ID"))
                        {
                            ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("用户名"))
                        {
                            ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门ID"))
                        {
                            ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门名"))
                        {
                            ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                        }
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            txtTextBox.DataSource = dt_options;
                            txtTextBox.DataTextField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataValueField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataBind();
                        }
                    }
                    if (field_docvalue != "")
                    {
                        field_docvalue = "," + field_docvalue + ",";
                        foreach (ListItem li in txtTextBox.Items)
                        {
                            if (field_docvalue.Contains(li.Value))
                                li.Selected = true;
                        }
                    }
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //单选框(查询时直接显示文本框)
            if (field_type == "单选框")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    RadioButtonList txtTextBox = new RadioButtonList();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0")
                    {
                        //手工配置
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#');
                            for (int i = 0; i < lv_options.Length; i++)
                            {
                                txtTextBox.Items.Add(lv_options[i].ToString());
                            }
                        }
                    }
                    if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1")
                    {
                        //SQL语句
                        //如果SQL语句中含有特殊标示,则需要替换
                        string ls_sql = dtfield.Rows[0]["hy_options"].ToString();
                        if (ls_sql.Contains("用户ID"))
                        {
                            ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("用户名"))
                        {
                            ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门ID"))
                        {
                            ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'");
                        }
                        if (ls_sql.Contains("部门名"))
                        {
                            ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'");
                        }
                        if (dtfield.Rows[0]["hy_options"].ToString() != "")
                        {
                            DataTable dt_options = Hyoa_global.GetDataTable(ls_sql);
                            txtTextBox.DataSource = dt_options;
                            txtTextBox.DataTextField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataValueField = dt_options.Columns[0].ColumnName;
                            txtTextBox.DataBind();
                        }
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //口令
            if (field_type == "口令")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = "&nbsp;";
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.TextMode = TextBoxMode.Password;
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是")
                    {
                        txtTextBox.ReadOnly = true;
                    }
                    if (dtfield.Rows[0]["hy_class"].ToString() != "")
                    {
                        txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString();
                    }
                    if (dtfield.Rows[0]["hy_width"].ToString() != "")
                    {
                        txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_height"].ToString() != "")
                    {
                        txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onchange"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString());
                    }
                    if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "")
                    {
                        txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString());
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //附件组件
            if (field_type == "附件组件")
            {
                //读取附件内容
                HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt();
                DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatheridandFatherfield(this.txtdocid.Value, hy_fieldid);
                field_docvalue = "";
                if (dt_fileatt.Rows.Count > 0)
                {
                    for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++)
                    {
                        field_docvalue += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a><br />";
                    }
                }
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    if (field_docvalue == "")
                    {
                        field_docvalue = "&nbsp;";
                    }
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue += "<input type=button id='uploadfile1' value='附件管理' class=btn3 onclick=\"window.open('ggdy/main_fileatt.aspx?fatherid=" + this.txtdocid.Value + "&fatherfield=" + hy_fieldid + "','filewindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');\" />";
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //说明文字
            if (field_type == "说明文字")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //编辑器
            if (field_type == "编辑器")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    //隐藏文本框
                    TextBox txtTextBox = new TextBox();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    txtTextBox.Style.Value = "display:none";
                    tCell2.Controls.Add(txtTextBox);
                    //编辑器
                    Label txtTextBox2 = new Label();
                    txtTextBox2.ID = "eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString();
                    field_docvalue = "<iframe ID=\"eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_fieldid"].ToString() + "&style=Portal\" frameborder=0 scrolling=no width=" + dtfield.Rows[0]["hy_width"].ToString() + " height=" + dtfield.Rows[0]["hy_height"].ToString() + "></iframe>";
                    txtTextBox2.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox2);
                }
            }
            //痕迹保留
            if (field_type == "痕迹保留")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正  文' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正  文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                    //如果是流程模块,则根据环节判断一下
                    if (ifflowdoc == "1")
                    {
                        //判断是否为第一环节
                        HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork();
                        DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*");
                        if (dtflowwork.Rows.Count > 0)
                        {
                            if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text)
                            {
                                field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正  文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                            }
                            else
                            {
                                //判断是否为最后一个环节
                                dtflowwork.Clear();
                                dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text);
                                if (dtflowwork.Rows.Count > 0)
                                {
                                    if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**")
                                    {
                                        field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正  文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                                    }
                                    else
                                    {
                                        field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正  文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> ";
                                    }
                                }

                            }
                        }
                    }
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //IFRAME列表
            if (field_type == "IFRAME列表")
            {
                //-----开始输出字段------
                if (ls_laborinput == "0")   //输出LABLE
                {
                    field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
                else
                {
                    field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>";
                    Label txtTextBox = new Label();
                    txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString();
                    txtTextBox.Text = field_docvalue;
                    tCell2.Controls.Add(txtTextBox);
                }
            }
            //子表信息带链接

            //子表信息不带链接

        }
        return li_return;
    }
Example #38
0
    //render a dataset as a radio button list
    public void RenderDataSet(BaseMaster BaseMstr,
                              DataSet ds,
                              RadioButtonList rbl,
                              string strTextFields,   //comma delimeted / LastName,FirstName
                              string strIDField,      //field used to uniquely id a row
                              string strSelectedID)
    {
        //clear exisiting Items, set properties
        try
        {
            rbl.DataSource = null;
            rbl.Items.Clear();
        }
        catch (Exception ew)
        {
            string str = ew.Message;
        }


        int nSelectedIndex = -1;

        if (ds == null)
        {
            return;
        }

        //split text fields used to load
        string[] splitTextFields = strTextFields.Split(new Char[] { ',' });
        if (splitTextFields.Length < 1)//nothing to do
        {
            BaseMstr.StatusComment = "";
            BaseMstr.StatusCode    = 0;
            return;
        }

        //loop over the dataset and load the dropdownlist
        foreach (DataTable table in ds.Tables)
        {
            foreach (DataRow row in table.Rows)
            {
                //build the rbl text
                string strRBLText = "";
                foreach (string txtField in splitTextFields)
                {
                    if (!row.IsNull(txtField))
                    {
                        string strValue = Convert.ToString(row[txtField]);
                        strRBLText += strValue;
                        strRBLText += " - ";
                    }
                }

                //strip last " - "
                if (strRBLText.Length > 4)
                {
                    strRBLText = strRBLText.Substring(0, strRBLText.Length - 3);
                }

                //set item properties
                ListItem RBLItm = new ListItem();
                if (!row.IsNull(strIDField))
                {
                    string strValue = Convert.ToString(row[strIDField]);
                    RBLItm.Value = strValue;
                }
                RBLItm.Text = strRBLText;
                rbl.Items.Add(RBLItm);

                //set the selected item if necessary
                if (RBLItm.Value == strSelectedID)
                {
                    nSelectedIndex = rbl.Items.Count - 1;
                }
            }

            //set the selected index
            try
            {
                rbl.SelectedIndex = nSelectedIndex;
            }
            catch (Exception e)
            {
                string strE = e.Message;
                //BaseMstr.StatusComment = "";
                //BaseMstr.StatusCode = 0;
            }
        }
    }
        /// <summary>
        /// Dynamically add controls to the form
        /// </summary>
        private void CreateFormFields()
        {
            foreach (var par in this.Settings.Parameters)
            {
                this.ErrorMsg.InnerHtml = string.Empty;
                this.ErrorMsg.Visible   = false;
                this.InfoMsg.InnerHtml  = string.Empty;
                this.InfoMsg.Visible    = false;

                // add label
                if (par.ParamType != ParameterType.Boolean)
                {
                    this.AddLabel(par.Label, string.Empty);
                }

                if (par.ParamType == ParameterType.Boolean)
                {
                    // add checkbox
                    var cb = new CheckBox {
                        Checked = false, ID = par.Name, CssClass = "mgrCheck"
                    };
                    this.phAddForm.Controls.Add(cb);
                    this.AddLabel(par.Label, "mgrCheckLbl");
                }
                else if (par.ParamType == ParameterType.DropDown)
                {
                    // add dropdown
                    var dd = new DropDownList();
                    foreach (var item in par.Values)
                    {
                        string[] parts = item.Split('|');
                        ListItem li    = new ListItem();
                        li.Text  = parts.Length == 1 ? parts[0] : parts[1];
                        li.Value = parts[0];

                        dd.Items.Add(li);
                    }

                    dd.SelectedValue = par.SelectedValue;
                    dd.ID            = par.Name;
                    dd.Width         = 250;
                    this.phAddForm.Controls.Add(dd);
                }
                else if (par.ParamType == ParameterType.ListBox)
                {
                    var lb = new ListBox {
                        Rows = par.Values.Count
                    };
                    foreach (var item in par.Values)
                    {
                        lb.Items.Add(item);
                    }

                    lb.SelectedValue = par.SelectedValue;
                    lb.ID            = par.Name;
                    lb.Width         = 250;
                    this.phAddForm.Controls.Add(lb);
                }
                else if (par.ParamType == ParameterType.RadioGroup)
                {
                    var rbl = new RadioButtonList();
                    foreach (var item in par.Values)
                    {
                        rbl.Items.Add(item);
                    }

                    rbl.SelectedValue   = par.SelectedValue;
                    rbl.ID              = par.Name;
                    rbl.RepeatDirection = RepeatDirection.Horizontal;
                    rbl.CssClass        = "mgrRadioList";
                    this.phAddForm.Controls.Add(rbl);
                }
                else
                {
                    // add textbox
                    var bx = new TextBox
                    {
                        Text = string.Empty, ID = par.Name, Width = new Unit(250), MaxLength = par.MaxLength
                    };
                    this.phAddForm.Controls.Add(bx);
                }

                using (var br2 = new Literal {
                    Text = @"<br />"
                })
                {
                    this.phAddForm.Controls.Add(br2);
                }
            }
        }
Example #40
0
 public void FillRadioButtons(RadioButtonList radioButtonList, int selectedIndex)
 {
     throw new NotImplementedException();
 }
Example #41
0
        private void CreateOtherField(int _channel_id)
        {
            List <Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(_channel_id, "is_sys=0");

            if (ls.Count > 0)
            {
                field_tab_item.Visible    = true;
                field_tab_content.Visible = true;
            }
            foreach (Model.article_attribute_field modelt in ls)
            {
                //创建一个dl标签
                HtmlGenericControl htmlDL = new HtmlGenericControl("dl");
                HtmlGenericControl htmlDT = new HtmlGenericControl("dt");
                HtmlGenericControl htmlDD = new HtmlGenericControl("dd");
                htmlDT.InnerHtml = modelt.title;

                switch (modelt.control_type)
                {
                case "single-text":     //单行文本
                    //创建一个TextBox控件
                    TextBox txtControl = new TextBox();
                    txtControl.ID = "field_control_" + modelt.name;
                    //CSS样式及TextMode设置
                    if (modelt.control_type == "single-text")     //单行
                    {
                        txtControl.CssClass = "input normal";
                        //是否密码框
                        if (modelt.is_password == 1)
                        {
                            txtControl.TextMode = TextBoxMode.Password;
                        }
                    }
                    else if (modelt.control_type == "multi-text")     //多行
                    {
                        txtControl.CssClass = "input";
                        txtControl.TextMode = TextBoxMode.MultiLine;
                    }
                    else if (modelt.control_type == "number")     //数字
                    {
                        txtControl.CssClass = "input small";
                    }
                    else if (modelt.control_type == "datetime")     //时间日期
                    {
                        txtControl.CssClass = "input rule-date-input";
                        txtControl.Attributes.Add("onfocus", "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})");
                    }
                    else if (modelt.control_type == "images" || modelt.control_type == "video")     //图片视频
                    {
                        txtControl.CssClass = "input normal upload-path";
                    }
                    //设置默认值
                    txtControl.Text = modelt.default_value;
                    //验证提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        txtControl.Attributes.Add("tipmsg", modelt.valid_tip_msg);
                    }
                    //验证失败提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_error_msg))
                    {
                        txtControl.Attributes.Add("errormsg", modelt.valid_error_msg);
                    }
                    //验证表达式
                    if (!string.IsNullOrEmpty(modelt.valid_pattern))
                    {
                        txtControl.Attributes.Add("datatype", modelt.valid_pattern);
                        txtControl.Attributes.Add("sucmsg", " ");
                    }
                    //创建一个Label控件
                    Label labelControl = new Label();
                    labelControl.CssClass = "Validform_checktip";
                    labelControl.Text     = modelt.valid_tip_msg;

                    //将控件添加至DD中
                    htmlDD.Controls.Add(txtControl);
                    //如果是图片则添加上传按钮
                    if (modelt.control_type == "images")
                    {
                        HtmlGenericControl htmlBtn = new HtmlGenericControl("div");
                        htmlBtn.Attributes.Add("class", "upload-box upload-img");
                        htmlBtn.Attributes.Add("style", "margin-left:4px;");
                        htmlDD.Controls.Add(htmlBtn);
                    }
                    //如果是视频则添加上传按钮
                    if (modelt.control_type == "video")
                    {
                        HtmlGenericControl htmlBtn = new HtmlGenericControl("div");
                        htmlBtn.Attributes.Add("class", "upload-box upload-video");
                        htmlBtn.Attributes.Add("style", "margin-left:4px;");
                        htmlDD.Controls.Add(htmlBtn);
                    }
                    htmlDD.Controls.Add(labelControl);
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea txtTextArea = new HtmlTextArea();
                    txtTextArea.ID = "field_control_" + modelt.name;
                    //txtTextArea.Attributes.Add("style", "visibility:hidden;");
                    //是否简洁型编辑器
                    if (modelt.editor_type == 1)
                    {
                        txtTextArea.Attributes.Add("class", "editor-mini");
                    }
                    else
                    {
                        txtTextArea.Attributes.Add("class", "editor");
                    }
                    txtTextArea.Value = modelt.default_value;     //默认值
                    //验证提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        txtTextArea.Attributes.Add("tipmsg", modelt.valid_tip_msg);
                    }
                    //验证失败提示信息
                    if (!string.IsNullOrEmpty(modelt.valid_error_msg))
                    {
                        txtTextArea.Attributes.Add("errormsg", modelt.valid_error_msg);
                    }
                    //验证表达式
                    if (!string.IsNullOrEmpty(modelt.valid_pattern))
                    {
                        txtTextArea.Attributes.Add("datatype", modelt.valid_pattern);
                        txtTextArea.Attributes.Add("sucmsg", " ");
                    }
                    //创建一个Label控件
                    Label labelControl2 = new Label();
                    labelControl2.CssClass = "Validform_checktip";
                    labelControl2.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(txtTextArea);
                    htmlDD.Controls.Add(labelControl2);
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "video":     //视频上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "datetime":     //时间日期
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = new CheckBox();
                    cbControl.ID = "field_control_" + modelt.name;
                    //默认值
                    if (modelt.default_value == "1")
                    {
                        cbControl.Checked = true;
                    }
                    HtmlGenericControl htmlDiv1 = new HtmlGenericControl("div");
                    htmlDiv1.Attributes.Add("class", "rule-single-checkbox");
                    htmlDiv1.Controls.Add(cbControl);
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv1);
                    if (!string.IsNullOrEmpty(modelt.valid_tip_msg))
                    {
                        //创建一个Label控件
                        Label labelControl3 = new Label();
                        labelControl3.CssClass = "Validform_checktip";
                        labelControl3.Text     = modelt.valid_tip_msg;
                        htmlDD.Controls.Add(labelControl3);
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = new RadioButtonList();
                    rblControl.ID = "field_control_" + modelt.name;
                    rblControl.RepeatDirection = RepeatDirection.Horizontal;
                    rblControl.RepeatLayout    = RepeatLayout.Flow;
                    HtmlGenericControl htmlDiv2 = new HtmlGenericControl("div");
                    htmlDiv2.Attributes.Add("class", "rule-multi-radio");
                    htmlDiv2.Controls.Add(rblControl);
                    //赋值选项
                    string[] valArr = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
                    for (int i = 0; i < valArr.Length; i++)
                    {
                        string[] valItemArr = valArr[i].Split('|');
                        if (valItemArr.Length == 2)
                        {
                            rblControl.Items.Add(new ListItem(valItemArr[0], valItemArr[1]));
                        }
                    }
                    rblControl.SelectedValue = modelt.default_value;     //默认值
                    //创建一个Label控件
                    Label labelControl4 = new Label();
                    labelControl4.CssClass = "Validform_checktip";
                    labelControl4.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv2);
                    htmlDD.Controls.Add(labelControl4);
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = new CheckBoxList();
                    cblControl.ID = "field_control_" + modelt.name;
                    cblControl.RepeatDirection = RepeatDirection.Horizontal;
                    cblControl.RepeatLayout    = RepeatLayout.Flow;
                    HtmlGenericControl htmlDiv3 = new HtmlGenericControl("div");
                    htmlDiv3.Attributes.Add("class", "rule-multi-checkbox");
                    htmlDiv3.Controls.Add(cblControl);
                    //赋值选项
                    string[] valArr2 = modelt.item_option.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
                    for (int i = 0; i < valArr2.Length; i++)
                    {
                        string[] valItemArr2 = valArr2[i].Split('|');
                        if (valItemArr2.Length == 2)
                        {
                            cblControl.Items.Add(new ListItem(valItemArr2[0], valItemArr2[1]));
                        }
                    }
                    cblControl.SelectedValue = modelt.default_value;     //默认值
                    //创建一个Label控件
                    Label labelControl5 = new Label();
                    labelControl5.CssClass = "Validform_checktip";
                    labelControl5.Text     = modelt.valid_tip_msg;
                    //将控件添加至DD中
                    htmlDD.Controls.Add(htmlDiv3);
                    htmlDD.Controls.Add(labelControl5);
                    break;
                }

                //将DT和DD添加到DL中
                htmlDL.Controls.Add(htmlDT);
                htmlDL.Controls.Add(htmlDD);
                //将DL添加至field_tab_content中
                field_tab_content.Controls.Add(htmlDL);
            }
        }
Example #42
0
        private Control GetUserInputControl(SearchTag stag)
        {
            string          switchname = stag.TagName;
            string          typename   = stag.MyRuntimePropertyValue.GetType().ToString();
            FlowLayoutPanel flp        = new FlowLayoutPanel();;
            TextBox         tb         = null;
            Button          b          = null;
            NumericUpDown   nud        = null;
            ComboBox        cb         = null;

            switch (typename)
            {
            case "System.Boolean":
            {
                RadioButtonList     rdb   = new RadioButtonList();
                RadioButtonListItem itrue = new RadioButtonListItem()
                {
                    Text = "true"
                };
                RadioButtonListItem ifalse = new RadioButtonListItem()
                {
                    Text = "false"
                };
                rdb.Text = stag.TagName;
                rdb.Items.Add(itrue);
                rdb.Items.Add(ifalse);
                rdb.SelectedIndexChanged += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo as PropertyInfo;
                    info.SetValue(stag.MyParentTag.MyRuntimePropertyValue, itrue.Checked);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                return(rdb);

                break;
            }

            case "System.String":
            {
                tb = new TextBox();
                flp.Controls.Add(tb);
                b = new Button()
                {
                    Text = "OK"
                };
                b.Click += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo as PropertyInfo;
                    info.SetValue(stag.MyParentTag.MyRuntimePropertyValue, tb.Text);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(b);
                return(flp);

                break;
            }

            case "System.Int32":
            {
                nud = new NumericUpDown()
                {
                    Minimum = int.MinValue, Maximum = int.MaxValue
                };

                flp.Controls.Add(nud);
                b = new Button()
                {
                    Text = "OK"
                };
                b.Click += (sender, e) =>
                {
                    PropertyInfo info = stag.MyPropertyInfo as PropertyInfo;
                    info.SetValue(stag.MyParentTag.MyRuntimePropertyValue, (int)nud.Value);
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(b);
                return(flp);

                break;
            }

            case "Chummer.Backend.Uniques.Tradition":
            {
                var traditions = Chummer.Backend.Uniques.Tradition.GetTraditions(SINnersSearch.MySearchCharacter.MyCharacter);
                cb = new ComboBox
                {
                    DataSource    = traditions,
                    DropDownStyle = ComboBoxStyle.DropDownList,
                    FlatStyle     = FlatStyle.Standard,
                    DisplayMember = "Name"
                };
                cb.SelectedValueChanged += (sender, e) =>
                {
                    if (loading)
                    {
                        return;
                    }
                    PropertyInfo info = stag.MyPropertyInfo as PropertyInfo;
                    info.SetValue(stag.MyParentTag.MyRuntimePropertyValue, cb.SelectedValue);
                    stag.TagValue = (cb.SelectedValue as Chummer.Backend.Uniques.Tradition).Name;
                    MySetTags.Add(stag);
                    UpdateDialog();
                };
                flp.Controls.Add(cb);
                return(flp);

                break;
            }

            default:
                break;
            }
            Object obj = stag.MyRuntimePropertyValue;

            if (!typeof(String).IsAssignableFrom(obj.GetType()))
            {
                IEnumerable islist = obj as IEnumerable;
                if (islist == null)
                {
                    islist = obj as ICollection;
                }
                if (islist != null)
                {
                    Type listtype = StaticUtils.GetListType(islist);
                    if (listtype != null)
                    {
                        switchname = listtype.Name;
                    }
                }
            }

            switch (switchname)
            {
            ///these are sample implementations to get added one by one...
            case "Spell":
            {
                Button button = new Button();
                button.Text   = "select Spell";
                button.Click += ((sender, e) =>
                    {
                        var frmPickSpell = new frmSelectSpell(MySearchCharacter.MyCharacter);
                        frmPickSpell.ShowDialog();
                        // Open the Spells XML file and locate the selected piece.
                        XmlDocument objXmlDocument = XmlManager.Load("spells.xml");
                        XmlNode objXmlSpell = objXmlDocument.SelectSingleNode("/chummer/spells/spell[id = \"" + frmPickSpell.SelectedSpell + "\"]");
                        Spell objSpell = new Spell(MySearchCharacter.MyCharacter);
                        if (String.IsNullOrEmpty(objSpell?.Name))
                        {
                            return;
                        }
                        objSpell.Create(objXmlSpell, string.Empty, frmPickSpell.Limited, frmPickSpell.Extended, frmPickSpell.Alchemical);
                        MySearchCharacter.MyCharacter.Spells.Add(objSpell);
                        SearchTag spellsearch = new SearchTag(stag.MyPropertyInfo, stag.MyRuntimeHubClassTag);
                        spellsearch.MyRuntimePropertyValue = objSpell;
                        spellsearch.MyParentTag = stag;
                        spellsearch.TagName = objSpell.Name;
                        spellsearch.TagValue = "";
                        spellsearch.SearchOpterator = "exists";
                        MySetTags.Add(spellsearch);
                        UpdateDialog();
                    });
                return(button);

                break;
            }

            case "Quality":
            {
                Button button = new Button();
                button.Text   = "select Quality";
                button.Click += ((sender, e) =>
                    {
                        var frmPick = new frmSelectQuality(MySearchCharacter.MyCharacter);
                        frmPick.ShowDialog();
                        // Open the Spells XML file and locate the selected piece.
                        XmlDocument objXmlDocument = XmlManager.Load("qualities.xml");
                        XmlNode objXmlNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[id = \"" + frmPick.SelectedQuality + "\"]");
                        Quality objQuality = new Quality(MySearchCharacter.MyCharacter);
                        List <Weapon> lstWeapons = new List <Weapon>();
                        objQuality.Create(objXmlNode, QualitySource.Selected, lstWeapons);
                        MySearchCharacter.MyCharacter.Qualities.Add(objQuality);
                        SearchTag newtag = new SearchTag(stag.MyPropertyInfo, stag.MyRuntimeHubClassTag);
                        newtag.MyRuntimePropertyValue = objQuality;
                        newtag.MyParentTag = stag;
                        newtag.TagName = objQuality.Name;
                        newtag.TagValue = "";
                        newtag.SearchOpterator = "exists";
                        MySetTags.Add(newtag);
                        UpdateDialog();
                    });
                return(button);

                break;
            }
            break;

            default:
                break;
            }
            return(null);
        }
        protected async void Page_Load(object sender, EventArgs e)
        {
            ValidationSettings.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;
            examid = Convert.ToInt32(Request.QueryString["id"]);

            //questionServiceClient = new QuestionService.QuestionServiceClient();
            //examServiceClient = new ExamService.ExamServiceClient();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseAddress);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                string url = "api/exam/" + examid.ToString();
                HttpResponseMessage response = await client.GetAsync(url);

                if (response.IsSuccessStatusCode)
                {
                    var readTask = response.Content.ReadAsAsync <Online_Examination_Client.Models.Exam>();
                    readTask.Wait();

                    Online_Examination_Client.Models.Exam exam = readTask.Result;

                    int noq = exam.Questions.Count;
                    for (int i = 0; i < noq; i++)
                    {
                        string             question = exam.Questions[i];
                        HtmlGenericControl d        = getCustomDiv("row my-3");
                        HtmlGenericControl d1       = getCustomDiv("offset-4 col-6");
                        d.Controls.Add(d1);
                        HtmlGenericControl q = new HtmlGenericControl("h4");
                        q.Attributes.Add("class", "font-weight-bold form-label");
                        q.InnerText = (i + 1).ToString() + " " + question;

                        /*client.BaseAddress = new Uri(baseAddress);
                         * client.DefaultRequestHeaders.Accept.Clear();
                         * client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                         */
                        response = await client.PostAsJsonAsync("api/question/find-question/", question);

                        if (response.IsSuccessStatusCode)
                        {
                            var readTask1 = response.Content.ReadAsAsync <Question>();
                            readTask1.Wait();
                            Question ques = readTask1.Result;

                            questions.Add(ques);
                            RadioButtonList rdr = new RadioButtonList();
                            rdr.Items.Add(new ListItem(ques.Option1, ques.Option1));
                            rdr.Items.Add(new ListItem(ques.Option2, ques.Option2));
                            rdr.Items.Add(new ListItem(ques.Option3, ques.Option3));
                            rdr.Items.Add(new ListItem(ques.Option4, ques.Option4));
                            rdr.ID       = "que" + i.ToString();
                            rdr.CssClass = "mx-3 p-3";
                            d.Controls.Add(q);
                            d.Controls.Add(rdr);
                            this.Master.FindControl("MainContent").FindControl("ques").Controls.Add(d);
                        }
                        //QuestionService.Question ques = questionServiceClient.FindQuestion(question);
                    }
                }
            }

            //ExamService.Exam exam = examServiceClient.GetExam(examid);
        }
    protected void btnAgregar_Click(object sender, ImageClickEventArgs e)
    {
        string Requ_Numero, Reqd_CodLinea, Reqs_Correlativo, cleanMessage, Reqs_ItemSecuencia, A_FASES_AMPLIACION;

        int intregistros = 0;

        if (GridView1.Rows.Count == 0)
        {
            cleanMessage = "No existe registros";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }



        decimal total    = 0;
        decimal valor    = 0;
        decimal valorMov = 0;

        string codigos = string.Empty;

        foreach (GridViewRow Fila in GridView1.Rows)
        {
            Label lblMontoAlq = ((Label)Fila.FindControl("lblMontoAlq"));
            Label lblMontoMov = ((Label)Fila.FindControl("lblMontoMov"));
            Label lblMontoAmp = ((Label)Fila.FindControl("lblMontoAmp"));
            total = total +

                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAlq.Text) ? "0" : lblMontoAlq.Text) +
                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text) +
                    Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);
        }


        Guid g = Guid.NewGuid();

        foreach (GridViewRow row in GridView1.Rows)
        {
            Label lblMontoAmp = ((Label)row.FindControl("lblMontoAmp"));
            //Label lblMontoAlq = ((Label)row.FindControl("lblMontoAlq"));
            Label           lblMontoMov = ((Label)row.FindControl("lblMontoMov"));
            Label           lblFases    = ((Label)row.FindControl("lblFases"));
            RadioButtonList rb          = (RadioButtonList)row.FindControl("rdoOpcion");

            Label lblposicionAlq = ((Label)row.FindControl("lblposicionAlq"));

            TextBox txtNuevaPosicion = ((TextBox)row.FindControl("txtNuevaPosicion"));

            Requ_Numero        = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); // extrae key
            Reqd_CodLinea      = GridView1.DataKeys[row.RowIndex].Values[1].ToString(); // extrae key
            Reqs_Correlativo   = GridView1.DataKeys[row.RowIndex].Values[2].ToString(); // extrae key
            Reqs_ItemSecuencia = GridView1.DataKeys[row.RowIndex].Values[3].ToString(); // extrae key
            A_FASES_AMPLIACION = GridView1.DataKeys[row.RowIndex].Values[4].ToString(); // extrae key
            codigos           += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";

            if (A_FASES_AMPLIACION == "1")
            {
                if (rb.SelectedValue == "P")
                {
                    //agregar monto

                    valorMov = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text);
                    valor    = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);

                    BE_TBL_RequerimientoSubDetalle oBESol = new BE_TBL_RequerimientoSubDetalle();
                    oBESol.Requ_Numero      = Requ_Numero;
                    oBESol.Reqd_CodLinea    = Reqd_CodLinea;
                    oBESol.Reqs_Correlativo = Reqs_Correlativo;
                    oBESol.D_PDC            = txtPdc.Text.Trim();
                    //oBESol.D_PDC_FECHA = txtFechaPDC.Text;

                    oBESol.D_PDC_MONTO       = Convert.ToDecimal(string.IsNullOrEmpty(valor.ToString()) ? "0" : valor.ToString());
                    oBESol.D_PDC_MONTO_TOTAL = Convert.ToDecimal(string.IsNullOrEmpty(total.ToString()) ? "0" : total.ToString());
                    oBESol.D_PDC_MONTO_MOVIL = Convert.ToDecimal(string.IsNullOrEmpty(valorMov.ToString()) ? "0" : valorMov.ToString());
                    oBESol.GUID = g.ToString();
                    oBESol.A_FASES_AMPLIACION = lblFases.Text;
                    int dtrpta;
                    dtrpta = new BL_TBL_RequerimientoSubDetalle().uspINS_TBL_RequerimientoSubDetalle_AMPLIACION(oBESol);
                    if (dtrpta > 0)
                    {
                        intregistros++;
                    }
                }

                else if (rb.SelectedValue == "T/P")
                {
                    valorMov = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoMov.Text) ? "0" : lblMontoMov.Text);
                    valor    = Convert.ToDecimal(string.IsNullOrEmpty(lblMontoAmp.Text) ? "0" : lblMontoAmp.Text);

                    if (txtNuevaPosicion.Text.Trim() == string.Empty)
                    {
                        cleanMessage = "Falta ingresar nueva posicion al req. " + Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim();
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                    }
                    else
                    {
                        BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
                        DataTable dtResultado = new DataTable();

                        codigos += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";

                        dtResultado = obj.uspINS_TBL_GENERAR_AMPLIACION(
                            Requ_Numero,
                            Reqd_CodLinea,
                            Reqs_Correlativo,
                            lblFases.Text,
                            string.IsNullOrEmpty(lblposicionAlq.Text) ? "10" : lblposicionAlq.Text,
                            txtNuevaPosicion.Text.Trim(),
                            valor.ToString(),
                            total.ToString(),
                            txtPdc.Text.Trim(),
                            Reqs_ItemSecuencia
                            );
                        if (dtResultado.Rows.Count > 0)
                        {
                            BL_TBL_RequerimientoSubDetalle objx = new BL_TBL_RequerimientoSubDetalle();

                            string req = dtResultado.Rows[0]["ID"].ToString();
                            //string req = Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";
                            objx.USP_SEL_TBL_REQUERIMIENTO_CORREO_LIBERACION(req, "ALQUILER CARE", 21);

                            intregistros++;
                        }
                    }


                    String     datos         = string.Empty;
                    string     ArchivoFoto   = string.Empty;
                    String     fileExtension = string.Empty;
                    Boolean    fileOK        = false;
                    string     fileArchivo   = string.Empty;
                    string     Name          = string.Empty;
                    string     TipoArchivo   = "AMPLIACION";
                    FileUpload FileUpload1   = (FileUpload)row.FindControl("FileUpload1");



                    if (FileUpload1.HasFile)
                    {
                        string fileName = FileUpload1.FileName.ToString();
                        int    length   = FileUpload1.PostedFile.ContentLength;

                        fileExtension = Path.GetExtension(FileUpload1.FileName);

                        String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".txt" };
                        for (int i = 0; i < allowedExtensions.Length; i++)
                        {
                            if (fileExtension == allowedExtensions[i])
                            {
                                fileOK = true;
                            }
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            // Se carga la ruta física de la carpeta temp del sitio
                            string ruta = Server.MapPath(FolderAlquiler);

                            // Si el directorio no existe, crearlo
                            //if (!Directory.Exists(ruta))
                            //    Directory.CreateDirectory(ruta);

                            string archivo = String.Format("{0}\\{1}", ruta, FileUpload1.PostedFile.FileName);
                            Name = EliminarCaracteres.ReemplazarCaracteresEspeciales(FileUpload1.PostedFile.FileName);
                            // Verificar que el archivo no exista
                            if (File.Exists(archivo))
                            {
                                fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + DateTime.UtcNow.ToFileTimeUtc() + Path.GetExtension(FileUpload1.PostedFile.FileName));
                                FileUpload1.SaveAs(ruta + fileArchivo);
                            }

                            else
                            {
                                fileArchivo = EliminarCaracteres.ReemplazarCaracteresEspeciales(BL_Session.CENTRO_COSTO + "_" + TipoArchivo + "_" + Path.GetFileName(FileUpload1.FileName));
                                //FileUpload1.SaveAs(archivo);
                                FileUpload1.SaveAs(ruta + fileArchivo);
                            }
                        }
                        catch (Exception ex)
                        {
                            cleanMessage = "Archivo no puedo ser cargado";
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                        }
                    }
                }
            }
            else
            {
                cleanMessage = "Indicar tipo de ampliación";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }

        if (intregistros > 0)
        {
            codigos = string.Empty;

            Buscarrequerimientos();

            foreach (GridViewRow row in GridView1.Rows)
            {
                Requ_Numero      = GridView1.DataKeys[row.RowIndex].Values[0].ToString(); // extrae key
                Reqd_CodLinea    = GridView1.DataKeys[row.RowIndex].Values[1].ToString(); // extrae key
                Reqs_Correlativo = GridView1.DataKeys[row.RowIndex].Values[2].ToString(); // extrae key
                codigos         += Requ_Numero.Trim() + "." + Reqd_CodLinea.Trim() + "-" + Reqs_Correlativo.Trim() + ",";
            }
            BL_TBL_RequerimientoSubDetalle obj = new BL_TBL_RequerimientoSubDetalle();
            DataTable dtResultado = new DataTable();

            obj.USP_SEL_TBL_REQUERIMIENTO_CORREO_AMPLIACION(codigos, "ALQUILER CARE", 2);
            cleanMessage = "Actualización satisfactorio";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DataTable tbl = gvCvrg.DataSource as DataTable;

            if (tbl == null)
            {
                tbl = Data.GetPendingDependents(session_id, rblstEmployees.SelectedValue);
            }
            RadioButtonList rblst        = null;
            string          strRecord_id = "";

            Oracle.DataAccess.Client.OracleConnection  conn = SQLStatic.SQL.OracleConnection();
            Oracle.DataAccess.Client.OracleTransaction tx   = conn.BeginTransaction();
            try
            {
                foreach (DataRow dr in tbl.Rows)
                {
                    //rblst =  FindControl ("rblst_" + dr["Record_id"].ToString()) as RadioButtonList;
                    rblst        = Bas_Utility.Utilities.GetRadioButtonList(Page, "rblst_" + dr["Record_id"].ToString());
                    strRecord_id = rblst.ID.Replace("rblst_", "");
                    if (rblst.SelectedValue.Equals("1"))
                    {
                        Data.MoveOutOfPending(session_id, strRecord_id, ViewState["User_Name"].ToString(), ViewState["email_apprve"].ToString());
                        ViewState["email_apprve"] = "0";
                    }
                    else if (rblst.SelectedValue.Equals("0"))
                    {
                        Data.Deney_pending_Dep(session_id, strRecord_id, ViewState["User_Name"].ToString(), ViewState["email_descline"].ToString());
                        ViewState["email_descline"] = "0";
                    }
                    else
                    {
                        //tx.Rollback();
                        //string strError = "<script>alert('You must ckeck all the dependents first')</script>";
                        //Page.ClientScript.RegisterStartupScript(Page.GetType(), "strError", strError);
                        //return;
                    }
                }
                tx.Commit();
            }
            catch
            {
                tx.Rollback();
                throw;
            }
            finally
            {
                SQLStatic.SQL.CloseConnection(conn);
            }
            jscriptsFunctions.Misc.AlertSaved(Page);
            if (!string.IsNullOrEmpty(Request.Params["ee"]))
            {
                if (!Data.HasMorePendingDep(Request.Params["ee"]))
                {
                    Response.Redirect("default.aspx?SkipCheck=YES", true);
                }
            }
            if (!string.IsNullOrEmpty(Request.Params["ee"]))
            {
                DrawGrid();
                if (!btnSave.Visible)
                {
                    //btnNext.Enabled = true;
                    lblNoPending.Visible = true;
                    gvCvrg.Visible       = false;
                    return;
                }
            }
            Bulid_EEList();
            if (rblstEmployees.Items.Count.Equals(0))
            {
                Response.Redirect("Dependents.aspx?SkipCheck=YES&ee=" + Request.Params["ee"], true);
            }
            DrawGrid();
        }
Example #46
0
 public void SelectRadioButton(RadioButtonList radioButtonList, int index)
 {
     radioButtonList.Items[index].Selected = true;
 }
Example #47
0
    private void displayQuestions()
    {
        foreach (Question q in survey.getQuestions())
        {
            QuestionsPlaceholder.Controls.Add(new Literal()
            {
                Text = "<div class='container col-auto' style='border:2px solid "
                       + layout.getBackgroundColor() + ";border-radius:5px;margin:10px 10px 10px 10px;'>"
            });
            QuestionsPlaceholder.Controls.Add(new Literal()
            {
                Text = "<hr/>"
            });

            QuestionsPlaceholder.Controls.Add(new Literal()
            {
                Text = "Question " + q.getQuestionNumber() + "<hr/>"
            });
            QuestionsPlaceholder.Controls.Add(new Literal()
            {
                Text = q.getQuestionText() + "<br/>"
            });

            if (q.getType().Equals("YN"))
            {
                RadioButtonList buttonlist = new RadioButtonList();
                buttonlist.ID = "Question" + q.getQuestionNumber() + "Answer";
                buttonlist.RepeatDirection = RepeatDirection.Horizontal;
                buttonlist.Attributes.Add("style", "padding-top:10px");

                ListItem yesbtn = new ListItem()
                {
                    Text  = "Yes",
                    Value = "1"
                };
                buttonlist.Items.Add(yesbtn);

                ListItem nobtn = new ListItem()
                {
                    Text  = "No",
                    Value = "0"
                };
                buttonlist.Items.Add(nobtn);
                QuestionsPlaceholder.Controls.Add(buttonlist);
                QuestionsPlaceholder.Controls.Add(new Literal()
                {
                    Text = "<br/>"
                });
            }
            else if (q.getType().Equals("SC"))
            {
                RadioButtonList buttonlist = new RadioButtonList();
                buttonlist.ID = "Question" + q.getQuestionNumber() + "Answer";
                buttonlist.RepeatDirection = RepeatDirection.Horizontal;
                buttonlist.RepeatLayout    = RepeatLayout.Flow;
                buttonlist.TextAlign       = TextAlign.Left;

                for (int i = 1; i <= 10; i++)
                {
                    ListItem radiobtn = new ListItem()
                    {
                        Text  = i.ToString(),
                        Value = i.ToString()
                    };
                    radiobtn.Attributes.Add("style", "margin-left:10px");
                    buttonlist.Items.Add(radiobtn);
                }
                QuestionsPlaceholder.Controls.Add(buttonlist);
                QuestionsPlaceholder.Controls.Add(new Literal()
                {
                    Text = "<br/>"
                });
            }

            if (q.getCommentBox().Equals("1"))
            {
                TextBox tb = new TextBox()
                {
                    ID       = "Question" + q.getQuestionNumber() + "CommentBox",
                    TextMode = TextBoxMode.MultiLine,
                };
                tb.Attributes.Add("style", "width:100%");
                QuestionsPlaceholder.Controls.Add(tb);
            }


            QuestionsPlaceholder.Controls.Add(new Literal()
            {
                Text = "</div>"
            });
        }
    }
Example #48
0
    private void addToFilters(RadioButtonList rbl, String text) {
        changeAdvancedFilterMsgs();
        
        RadioButtonList rblClone = new RadioButtonList();
        foreach (ListItem li in rbl.Items) {
            rblClone.Items.Add(li);
        }
        rblClone.SelectedValue = rbl.SelectedValue;
        rblClone.RepeatDirection = rbl.RepeatDirection;
        rblClone.Enabled = false;

        Label lblAdditionalInfo = new Label();
        lblAdditionalInfo.Text = text;

        pnlFiltersSelected.Controls.Add(lblAdditionalInfo);
        pnlFiltersSelected.Controls.Add(rblClone);
        pnlFiltersSelected.Controls.Add(new LiteralControl("<br />"));
    }
Example #49
0
        private Dictionary <string, string> SetFieldValues(int _channel_id)
        {
            DataTable dt = new BLL.article_attribute_field().GetList(_channel_id, "").Tables[0];
            Dictionary <string, string> dic = new Dictionary <string, string>();

            foreach (DataRow dr in dt.Rows)
            {
                //查找相应的控件
                switch (dr["control_type"].ToString())
                {
                case "single-text":     //单行文本
                    TextBox txtControl = FindControl("field_control_" + dr["name"].ToString()) as TextBox;
                    if (txtControl != null)
                    {
                        dic.Add(dr["name"].ToString(), txtControl.Text.Trim());
                    }
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea htmlTextAreaControl = FindControl("field_control_" + dr["name"].ToString()) as HtmlTextArea;
                    if (htmlTextAreaControl != null)
                    {
                        dic.Add(dr["name"].ToString(), htmlTextAreaControl.Value);
                    }
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "video":     //视频上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "datetime":     //时间日期
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBox;
                    if (cbControl != null)
                    {
                        if (cbControl.Checked == true)
                        {
                            dic.Add(dr["name"].ToString(), "1");
                        }
                        else
                        {
                            dic.Add(dr["name"].ToString(), "0");
                        }
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = FindControl("field_control_" + dr["name"].ToString()) as RadioButtonList;
                    if (rblControl != null)
                    {
                        dic.Add(dr["name"].ToString(), rblControl.SelectedValue);
                    }
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = FindControl("field_control_" + dr["name"].ToString()) as CheckBoxList;
                    if (cblControl != null)
                    {
                        StringBuilder tempStr = new StringBuilder();
                        for (int i = 0; i < cblControl.Items.Count; i++)
                        {
                            if (cblControl.Items[i].Selected)
                            {
                                tempStr.Append(cblControl.Items[i].Value.Replace(',', ',') + ",");
                            }
                        }
                        dic.Add(dr["name"].ToString(), Utils.DelLastComma(tempStr.ToString()));
                    }
                    break;
                }
            }
            return(dic);
        }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string laiyuanbianhao = "";

        try
        {
            laiyuanbianhao = Request.QueryString["laiyuanbianhao"].ToString();
        }
        catch
        { }

        try
        {
            type = Request.QueryString["type"].ToString();
        }
        catch
        { }

        if (type == "edit")
        {
            string tablename = my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id=" + Request.QueryString["Model_id"].ToString() + "");
            string sql       = "update " + tablename + " set ";
            for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++)
            {
                if (d1 == 0)
                {
                    sql = sql + Model_dt.Rows[d1]["u1"].ToString() + "=" + db.get_kj(Table1, Model_dt, d1) + "";
                }
                else
                {
                    sql = sql + "," + Model_dt.Rows[d1]["u1"].ToString() + "=" + db.get_kj(Table1, Model_dt, d1) + "";
                }
            }

            sql = sql + " where id=" + Request.QueryString["id"].ToString();

            DataTable dt         = my_c.GetTable("select * from " + tablename + " where id=" + Request.QueryString["id"].ToString() + "");
            string    dingdanhao = my_c.GetTable("select * from " + my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id=" + Request.QueryString["Model_id"].ToString()) + " where id=" + Request.QueryString["id"].ToString() + "").Rows[0]["dingdanhao"].ToString();

            RadioButtonList dr = new RadioButtonList();
            dr = (RadioButtonList)form1.FindControl("zhuangtai");
            //if (dt.Rows[0]["zhuangtai"].ToString() == "已发货")
            //{
            my_c.genxin(sql);

            //审核通过发短信
            if (dr.SelectedValue == "订单完成")
            {
                //处理积分
                my_o.set_order_jifen(dingdanhao, my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id=" + Request.QueryString["Model_id"].ToString()));
                //end

                //发送短信

                //end
            }


            if (dr.SelectedValue == "已发货")
            {
                if (dt.Rows[0]["yonghuming"].ToString() != "")
                {
                    string wherestrig = "where id=" + dt.Rows[0]["id"].ToString() + "";

                    //  my_b.getWebFile(my_b.get_Domain() + "weixinmb.aspx?moban=order&tablename=" + tablename + "&wherestrig=" + HttpUtility.UrlEncode(wherestrig) + "");
                }
            }
            //处理订单配送发送微信消息

            //}
            //else
            //{
            //    my_c.genxin(sql);
            //}

            string order_log = tablename + "表被修改,状态改为[" + dr.SelectedValue + "],订单号:" + dingdanhao;

            my_c.genxin("insert into " + ConfigurationSettings.AppSettings["Prefix"].ToString() + "system (u1,u2,u3,u4) values('" + my_b.k_cookie("admin_id") + "','" + order_log + "','" + Request.UserHostAddress.ToString() + "','订单处理')");

            Response.Redirect("err.aspx?err=修改信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("Order_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "", "&", "fzw123") + "");
        }
        else
        {
            string sql = "insert into " + my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id=" + Request.QueryString["Model_id"].ToString() + "") + " ";
            sql = sql + "(";
            for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++)
            {
                if (d1 == 0)
                {
                    sql = sql + Model_dt.Rows[d1]["u1"].ToString();
                }
                else
                {
                    sql = sql + "," + Model_dt.Rows[d1]["u1"].ToString();
                }
            }
            sql = sql + ") values (";
            for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++)
            {
                if (d1 == 0)
                {
                    sql = sql + db.get_kj(Table1, Model_dt, d1);
                }
                else
                {
                    sql = sql + "," + db.get_kj(Table1, Model_dt, d1);
                }
            }
            sql = sql + ")";

            my_c.genxin(sql);
            Response.Redirect("err.aspx?err=增加信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("Order_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "", "&", "fzw123") + "");
        }
    }
Example #51
0
        private void ShowInfo(int _channel_id, int _id)
        {
            BLL.article   bll   = new BLL.article();
            Model.article model = bll.GetModel(_channel_id, _id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text           = model.call_index;
            txtTitle.Text   = model.title;
            txtTags.Text    = model.tags;
            txtLinkUrl.Text = model.link_url;
            //不是相册图片就绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);

            if (!filename.StartsWith("thumb_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtZhaiyao.Text        = model.zhaiyao;
            txtContent.Value       = model.content;
            txtSortId.Text         = model.sort_id.ToString();
            txtClick.Text          = model.click.ToString();
            if (model.status == 2)
            {
                cbStatus.Checked = false;
            }
            else
            {
                cbStatus.Checked = true;
            }
            if (action == DTEnums.ActionEnum.Edit.ToString())
            {
                txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss");
            }
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_slide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
            //扩展字段赋值
            List <Model.article_attribute_field> ls1 = new BLL.article_attribute_field().GetModelList(this.channel_id, "");

            foreach (Model.article_attribute_field modelt1 in ls1)
            {
                switch (modelt1.control_type)
                {
                case "single-text":     //单行文本
                    TextBox txtControl = FindControl("field_control_" + modelt1.name) as TextBox;
                    if (txtControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (modelt1.is_password == 1)
                        {
                            txtControl.Attributes.Add("value", model.fields[modelt1.name]);
                        }
                        else
                        {
                            txtControl.Text = model.fields[modelt1.name];
                        }
                    }
                    break;

                case "multi-text":     //多行文本
                    goto case "single-text";

                case "editor":     //编辑器
                    HtmlTextArea txtAreaControl = FindControl("field_control_" + modelt1.name) as HtmlTextArea;
                    if (txtAreaControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        txtAreaControl.Value = model.fields[modelt1.name];
                    }
                    break;

                case "images":     //图片上传
                    goto case "single-text";

                case "video":     //视频上传
                    goto case "single-text";

                case "number":     //数字
                    goto case "single-text";

                case "datetime":     //时间日期
                    goto case "single-text";

                case "checkbox":     //复选框
                    CheckBox cbControl = FindControl("field_control_" + modelt1.name) as CheckBox;
                    if (cbControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        if (model.fields[modelt1.name] == "1")
                        {
                            cbControl.Checked = true;
                        }
                        else
                        {
                            cbControl.Checked = false;
                        }
                    }
                    break;

                case "multi-radio":     //多项单选
                    RadioButtonList rblControl = FindControl("field_control_" + modelt1.name) as RadioButtonList;
                    if (rblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        rblControl.SelectedValue = model.fields[modelt1.name];
                    }
                    break;

                case "multi-checkbox":     //多项多选
                    CheckBoxList cblControl = FindControl("field_control_" + modelt1.name) as CheckBoxList;
                    if (cblControl != null && model.fields.ContainsKey(modelt1.name))
                    {
                        string[] valArr = model.fields[modelt1.name].Split(',');
                        for (int i = 0; i < cblControl.Items.Count; i++)
                        {
                            cblControl.Items[i].Selected = false;     //先取消默认的选中
                            foreach (string str in valArr)
                            {
                                if (cblControl.Items[i].Value == str)
                                {
                                    cblControl.Items[i].Selected = true;
                                }
                            }
                        }
                    }
                    break;
                }
            }
            //绑定商品规格
            List <Model.article_goods_spec> goodsSpecList = new BLL.article_goods_spec().GetList(_channel_id, model.id, "");

            hide_goods_spec_list.Value = JsonHelper.ObjectToJSON(goodsSpecList);
            rptGroupPrice.DataSource   = model.goods;
            rptGroupPrice.DataBind();
            //绑定图片相册
            if (filename.StartsWith("thumb_"))
            {
                hidFocusPhoto.Value = model.img_url; //封面图片
            }
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
            //绑定内容附件
            rptAttachList.DataSource = model.attach;
            rptAttachList.DataBind();
        }
Example #52
0
    //验证输入信息
    private bool GetOrderInfo()
    {
        ViewState["zongPrice"] = 0;
        decimal   zongPrice = 0;
        decimal   zongPv    = 0;
        int       count     = 0;
        decimal   price     = 0;
        decimal   pv        = 0;
        int       id        = 0;
        ArrayList list      = new ArrayList();

        //检查输入的数据是否合法,
        foreach (GridViewRow row in this.givproduct.Rows)
        {
            TextBox text = row.FindControl("txtPdtNum") as TextBox;
            if (text.Text.Trim() != "")
            {
                try
                {
                    count += Convert.ToInt32(text.Text.Trim());

                    if (count < 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("002003", "调拨数量必须为正整数!") + "');</script>");
                        return(false);
                    }
                }
                catch
                {
                    ScriptHelper.SetAlert(Page, GetTran("002006", "调拨数量请输入数字!"));
                    return(false);
                }
            }
        }
        //判断是否输入要报损的数据
        if (count == 0)
        {
            ScriptHelper.SetAlert(Page, GetTran("002007", "请输入调拨数量!"));
            return(false);
        }
        //检查单条数据
        foreach (GridViewRow row in this.givproduct.Rows)
        {
            TextBox text = row.FindControl("txtPdtNum") as TextBox;
            //验证用户输入的是否是数字
            if (text.Text.Trim() != "")
            {
                try
                {
                    count = Convert.ToInt32(text.Text.Trim());

                    if (count < 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("002003", "调拨数量必须为正整数!") + "');</script>");
                        return(false);
                    }
                }
                catch
                {
                    ScriptHelper.SetAlert(this.givproduct, GetTran("002006", "调拨数量请输入数字!"));
                    return(false);
                }
            }
            else
            {
                count = 0;
            }
            if (count > 0)
            {
                price = Convert.ToDecimal(((Label)row.FindControl("LblPrice")).Text.Trim());
                pv    = Convert.ToDecimal(((Label)row.FindControl("LblPV")).Text.Trim());
                RadioButtonList radiolist = row.FindControl("rdoBtnCate") as RadioButtonList;
                count = count * Convert.ToInt32(radiolist.SelectedValue);
                id    = Convert.ToInt32((row.FindControl("lblhuoID") as Label).Text.Trim());
                int wareDate = int.Parse((row.FindControl("WHouseDate") as Label).Text.Trim());
                if (count > wareDate)
                {
                    ScriptHelper.SetAlert(Page, GetTran("000501", "产品名称") + (row.FindControl("lblName") as Label).Text + GetTran("001859", "在该库位中的库存数量不足!"));
                    return(false);
                }
                InventoryDocDetailsModel invert = new InventoryDocDetailsModel();

                //invert.DepotSeatID = Convert.ToInt32(ddloutDepotSeatID.SelectedValue);
                invert.Batch           = "";
                invert.DocID           = "";
                invert.ExpectNum       = Convert.ToInt32(Application["maxqishu"]);
                invert.MeasureUnit     = "1";
                invert.ProductID       = id;
                invert.ProductQuantity = count;
                invert.ProductTotal    = Convert.ToDouble(count * price);
                invert.PV = Convert.ToDouble(pv);
                //invert.SelectedIndex = 0;
                invert.UnitPrice = Convert.ToDouble(price);
                list.Add(invert);
                zongPrice += count * price;
                zongPv    += pv * count;
            }
        }
        ViewState["list"]      = list;
        ViewState["zongPrice"] = zongPrice;
        ViewState["zongPv"]    = zongPv;
        return(true);
    }
Example #53
0
    protected void Page_init(object sender, EventArgs e)
    {
        Panel3.BackImageUrl = "/images/spaceship.png";
        gameID  = Session["gameIDSession"].ToString();
        questId = Session["editQuestNum"].ToString();

        XmlDataSourceRealGame.XPath = "/tree/game[@code = " + gameID + "]/questions/question";
        XmlDataSourceFakeGame.XPath = "/tree/game[@code = " + gameID + "]/questions/question";

        RealxmlDoc = XmlDataSourceRealGame.GetXmlDocument();
        RealxmlDoc.Load(Server.MapPath("tree/games.xml"));

        FakexmlDoc = XmlDataSourceFakeGame.GetXmlDocument();
        FakexmlDoc.Load(Server.MapPath("tree/fake.xml"));

        XmlNode fakeQuestNode = FakexmlDoc.SelectSingleNode("/tree/game[@code = " + gameID + "]/questions/question[@numberQues = " + questId + "]");
        XmlNode realQuestNode = RealxmlDoc.SelectSingleNode("/tree/game[@code = " + gameID + "]/questions/question[@numberQues = " + questId + "]");


        if (questId != "0")
        {
            saveButton.Text = "שמור שינויים";
            if (realQuestNode.InnerXml == fakeQuestNode.InnerXml)
            {
                save = false;
                saveButton.Enabled = false;
                saveButtontooltip.Style.Add("visibility", "visible");
                saveButtontooltip.Text = "טרם נערכו שינויים בשאלה";
            }
        }
        else
        {
            saveButtontooltip.Text = "טרם נערכו שינויים בשאלה";
            saveButton.Text        = "שמור שאלה";
        }

        gameName.Text = Server.UrlDecode(FakexmlDoc.SelectSingleNode("/tree/game[@code = " + gameID + "]/gameName").InnerText);

        XmlNode fakeQuest = FakexmlDoc.SelectSingleNode("/tree/game/questions/question[@numberQues = " + questId + "]");

        XmlNode fakeQuestText = FakexmlDoc.SelectSingleNode("/tree/game/questions/question[@numberQues = " + questId + "]/questionText");

        questionText.Text  = Server.UrlDecode(fakeQuestText.InnerText);
        QuestCuontLbl.Text = questionText.Text.Length.ToString() + "/100";
        XmlNode fakeQuestImage = FakexmlDoc.SelectSingleNode("/tree/game/questions/question[@numberQues = " + questId + "]/pic");

        if (fakeQuestImage != null)
        {
            questionText.CssClass        = "questImageTrue";
            ImageButtonquestImg.ImageUrl = Server.UrlDecode(fakeQuestImage.InnerText);
            ImageButtonquestImg.CssClass = "questImageClassTrue";
            ImageButton deleteImg0 = new ImageButton();
            deleteImg0.ID       = "deleteImg0";
            deleteImg0.ImageUrl = "images/Exit.png";
            deleteImg0.Click   += questImageDelete;
            Panel1.Controls.Add(deleteImg0);
            ImageButtonquestImgtooltip.Text = "החלפת תמונה";
            ((Label)FindControl("QuestCuontLbl")).CssClass = "IfImageTrue";
            ((Label)FindControl("QuestCuontLbl")).Style.Add("visibility", "hidden");
        }


        XmlNode fakeQuestAnsewrs = FakexmlDoc.SelectSingleNode("/tree/game/questions/question[@numberQues = " + questId + "]/Answers");

        int ansNum = 1;

        RadioButtonList answersList = new RadioButtonList();

        answersList.ID           = "answersList";
        answersList.AutoPostBack = true;
        Panel1.Controls.Add(answersList);

        if (questionText.Text.Length != 0)
        {
            ((Label)FindControl("answer1tooltip")).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("ImageButton1")).Enabled = true;
            ((ImageButton)FindControl("answerImage1")).Enabled = true;
            ((ImageButton)FindControl("ImageButton1")).Style.Add("visibility", "visible");
            ((ImageButton)FindControl("answerImage1")).Style.Add("visibility", "visible");
            ((Label)FindControl("Label1")).Enabled = true;
            ((Label)FindControl("Label1")).Style.Add("visibility", "visible");

            if (fakeQuestAnsewrs.ChildNodes.Count <= 1)
            {
                saveButtontooltip.Text = "שאלה חייבת להכיל שתי תשובות לפחות";
            }
        }

        for (int i = 3; i <= 6; i++)
        {
            ((Label)FindControl("answer" + i + "tooltip")).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("ImageButton" + i)).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("answerImage" + i)).Style.Add("visibility", "hidden");
            ((Label)FindControl("Label" + i)).Style.Add("visibility", "hidden");
        }


        foreach (XmlNode node in fakeQuestAnsewrs)
        {
            ((Label)FindControl("answer" + ansNum + "tooltip")).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("ImageButton" + ansNum)).Enabled = false;
            ((ImageButton)FindControl("answerImage" + ansNum)).Enabled = false;
            ((ImageButton)FindControl("ImageButton" + ansNum)).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("answerImage" + ansNum)).Style.Add("visibility", "hidden");
            ((Label)FindControl("Label" + ansNum)).Enabled = false;
            ((Label)FindControl("Label" + ansNum)).Style.Add("visibility", "hidden");

            ImageButton delete = new ImageButton();
            delete.ID       = "answerDelete" + ansNum;
            delete.CssClass = "answer" + ansNum + "deleteClass";
            delete.ImageUrl = "images/Exit.png";

            ListItem check = new ListItem();
            check.Text  = "";
            check.Value = ansNum.ToString();
            answersList.Items.Add(check);

            if (node.Attributes["result"].Value == "correct")
            {
                Session["CorrectAnswer"] = ansNum;
                check.Text     = ".";
                check.Selected = true;
            }

            if (node.Attributes["pic"].Value == "no")
            {
                TextBox ansewrText = new TextBox();
                ansewrText.Attributes["placeholder"] = "הזן תשובה";
                ansewrText.Attributes["enableThis"]  = (ansNum + 1).ToString();
                ansewrText.Text     = Server.UrlDecode(node.InnerText);
                ansewrText.TextMode = TextBoxMode.MultiLine;
                ansewrText.ID       = "answer" + ansNum + "Textbox";
                ansewrText.CssClass = "ansText" + ansNum + "Class";
                ansewrText.Attributes["CharacterLimit"]    = "50";
                ansewrText.Attributes["CharacterForLabel"] = "AnslableCount" + ansNum;

                Label lableCount = new Label();
                lableCount.ID       = "AnslableCount" + ansNum;
                lableCount.CssClass = "ansText" + ansNum + "Class";
                lableCount.Text     = ansewrText.Text.Length.ToString() + "/50";
                lableCount.Style.Add("visibility", "hidden");
                Panel1.Controls.Add(ansewrText);
                Panel1.Controls.Add(lableCount);
            }
            else
            {
                ((ImageButton)FindControl("answerImage" + ansNum)).Enabled = true;
                ((ImageButton)FindControl("answerImage" + ansNum)).Style.Add("visibility", "visible");
                ImageButton ansewrImage = (ImageButton)FindControl("answerImage" + ansNum);
                ansewrImage.ImageUrl = Server.UrlDecode(node.InnerText);
                ansewrImage.CssClass = "answerImageClassTrue";
            }

            delete.Click += Delete_Answer;
            Panel1.Controls.Add(delete);

            if (ansNum < 6)
            {
                ansNum++;
            }

            ((Label)FindControl("answer" + ansNum + "tooltip")).Style.Add("visibility", "hidden");
            ((ImageButton)FindControl("ImageButton" + ansNum)).Enabled = true;
            ((ImageButton)FindControl("answerImage" + ansNum)).Enabled = true;
            ((ImageButton)FindControl("ImageButton" + ansNum)).Style.Add("visibility", "visible");
            ((ImageButton)FindControl("answerImage" + ansNum)).Style.Add("visibility", "visible");
            ((Label)FindControl("Label" + ansNum)).Enabled = true;
            ((Label)FindControl("Label" + ansNum)).Style.Add("visibility", "visible");
        }
        if (answersList.SelectedValue == "")
        {
            saveButton.Enabled = false;
            if (answersList.Items.Count >= 2)
            {
                saveButtontooltip.Text = "חובה לסמן תשובה נכונה";
            }
        }
        else
        {
            if (answersList.Items.Count <= 1)
            {
                saveButtontooltip.Text = "שאלה חייבל להכיל שתי תשובות לפחות";
                saveButton.Enabled     = false;
            }
            else
            {
                if (saveButton.Enabled == true)
                {
                    saveButtontooltip.Style.Add("visibility", "hidden");
                }
            }
        }

        Panel1.Controls.Add(new LiteralControl("<br/>"));
        Panel1.DataBind();
    }
    private void initMembershipPlanList()
    {
        //remove 4, 5, 6, 7
        DateTime now = DateTime.Now;

        //Early Bird
        DateTime earlyBirdEnd = new DateTime(2014, 1, 18, 23, 59, 59);
        DateTime earlyBirdStart = new DateTime(2013, 12, 23);

        int thisyear = now.Year;
        DateTime fullPriceStartDate = new DateTime(thisyear, 12, 1);
        //endofyear = endofyear.AddDays(-1);

        //Set when end of year is
        //endofyear = endofyear.AddDays(-1);

        //early Bird is in play - comment this out if early bird has not been set up yet
        //endofyear = earlyBirdStart;

        DateTime halfPriceStartDate = new DateTime(thisyear, 7, 1);

        RadioButtonList membershiptypeBList = new RadioButtonList();
        membershiptypeBList.Style.Add("class", "pj");

        //check if we are in the period where half year is to be offered
        if (now >= halfPriceStartDate && now < fullPriceStartDate)
        {
            ListItem halfIndividual = new ListItem("Half-Year Individual: $12.00", "5");
            halfIndividual.Selected = true;
            membershiptypeBList.Items.Add(halfIndividual);
            membershiptypeBList.Items.Add(new ListItem("Half-Year Household: $18.00", "6"));
            membershiptypeBList.Items.Add(new ListItem("Half-Year Senior/Student Individual: $10.00", "7"));
            membershiptypeBList.Items.Add(new ListItem("Half-Year Senior/Student Household: $15.00", "8"));
        }
        else if (now <= earlyBirdEnd)
        {
            ListItem earlyBirdIndividual = new ListItem("Individual (Early Bird): $20.00", "9");
            earlyBirdIndividual.Selected = true;
            membershiptypeBList.Items.Add(earlyBirdIndividual);
            membershiptypeBList.Items.Add(new ListItem("Household (Early Bird): $30.00", "10"));
            membershiptypeBList.Items.Add(new ListItem("Senior/Student Individual (Early Bird): $15.00", "11"));
            membershiptypeBList.Items.Add(new ListItem("Senior/Student Household (Early Bird): $15.00", "12"));
        }
        //only offer full membership
        else
        {
            ListItem individual = new ListItem("Individual: $24.00", "1");
            individual.Selected = true;
            membershiptypeBList.Items.Add(individual);
            membershiptypeBList.Items.Add(new ListItem("Household: $36.00", "2"));
            membershiptypeBList.Items.Add(new ListItem("Senior/Student Individual: $20.00", "3"));
            membershiptypeBList.Items.Add(new ListItem("Senior/Student Household: $30.00", "4"));
        }
        memtypeblistst = membershiptypeBList;
        this.membershipTypeBlistHolder.Controls.Add(memtypeblistst);
    }
Example #55
0
 /// <summary>
 /// Gets the selected value from the given radiobuttonlists.
 /// </summary>
 /// <param name="rbl1">The first RadioButtonList.</param>
 /// <param name="rbl2">The second RadioButtonList.</param>
 /// <param name="rbl3">The third RadioButtonList.</param>
 /// <param name="rbl4">The fourth RadioButtonList.</param>
 /// <returns>the value from the first non-empty RadioButtonList</returns>
 /// <exception cref="System.ArgumentOutOfRangeException">One of the RadioButtonList must be selected.</exception>
 private string GetSelectedValue(RadioButtonList rbl1, RadioButtonList rbl2, RadioButtonList rbl3, RadioButtonList rbl4)
 {
     if (!string.IsNullOrEmpty(rbl1.SelectedValue))
     {
         return(rbl1.SelectedValue);
     }
     else if (!string.IsNullOrEmpty(rbl2.SelectedValue))
     {
         return(rbl2.SelectedValue);
     }
     else if (!string.IsNullOrEmpty(rbl3.SelectedValue))
     {
         return(rbl3.SelectedValue);
     }
     else if (!string.IsNullOrEmpty(rbl4.SelectedValue))
     {
         return(rbl4.SelectedValue);
     }
     else
     {
         throw new ArgumentOutOfRangeException("One of the RadioButtonList must be selected.");
     }
 }
Example #56
0
        private void LoadObligationData(GridView gv)
        {
            try
            {
                int     trId    = Convert.ToInt32(obligation.TigerReserveId);
                DataSet dsDraft = ObligationBAL.Instance.GetFieldDirectorObligations(trId);
                if (dsDraft.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < dsDraft.Tables[0].Rows.Count; i++)
                    {
                        DataRow dr = dsDraft.Tables[0].Rows[i];
                        foreach (GridViewRow row in gv.Rows)
                        {
                            Label           lblObligationId      = (Label)row.FindControl("lblObligationId");
                            Label           lblObligation        = (Label)row.FindControl("Descriptions");
                            RadioButtonList rblCompiledOrNot     = row.FindControl("rblCompiledOrNot") as RadioButtonList;
                            TextBox         txtLevelofComplaince = (TextBox)row.FindControl("txtLevelofComplaince");
                            TextBox         txtReason            = (TextBox)row.FindControl("txtReason");
                            //DataRow dr = dsDraft.Tables[0].Rows[0];
                            string str = dr["CompledOrNotOrNotApplicable"].ToString();
                            string id  = lblObligationId.Text;
                            if (dr["CompledOrNotOrNotApplicable"].ToString() == "Complied" && dr["ObligationId"].ToString() == lblObligationId.Text)
                            {
                                rblCompiledOrNot.SelectedValue = "1";
                                txtLevelofComplaince.Text      = "100";
                                txtLevelofComplaince.Enabled   = false;
                                txtReason.Enabled = false;
                                //txtLevelofComplaince.Attributes.Add("req", "1");
                                //txtLevelofComplaince.Attributes.Add("num", "1");
                            }
                            else if (dr["CompledOrNotOrNotApplicable"].ToString() == "Not Complied" && dr["ObligationId"].ToString() == lblObligationId.Text)
                            {
                                rblCompiledOrNot.SelectedValue = "2";
                                txtLevelofComplaince.Text      = Convert.ToString(dr["LevelOfCompliance"]);
                                txtReason.Text = dr["ReasonIfNotCompiled"].ToString();

                                if (string.IsNullOrEmpty(txtLevelofComplaince.Text))
                                {
                                    txtLevelofComplaince.CssClass = "less_size";
                                    txtLevelofComplaince.CssClass = "danger";
                                }
                                if (string.IsNullOrEmpty(txtReason.Text))
                                {
                                    txtReason.CssClass = "less_size";
                                    txtReason.CssClass = "danger";
                                }

                                txtLevelofComplaince.Enabled = true;
                                txtReason.Enabled            = true;
                                //  txtReason.Attributes.Add("req", "1");
                            }
                            else if (dr["CompledOrNotOrNotApplicable"].ToString() == "Not Applicable" && dr["ObligationId"].ToString() == lblObligationId.Text)
                            {
                                rblCompiledOrNot.SelectedValue = "3";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogFatal((ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex, this.GetType());
                Response.RedirectPermanent("~/ErrorPage.aspx", false);
            }
        }
Example #57
0
        public ProjectWizardPageView(ProjectWizardPageModel model)
        {
            var radioSpacing = Platform.IsGtk ? Size.Empty : new Size(2, 2);

            var content = new DynamicLayout
            {
                Spacing = new Size(10, 10)
            };

            if (model.SupportsAppName)
            {
                var nameBox = new TextBox();
                nameBox.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.AppName);
                Application.Instance.AsyncInvoke(nameBox.Focus);

                var nameValid = new Label {
                    TextColor = Global.Theme.ErrorForeground
                };
                nameValid.BindDataContext(c => c.Visible, (ProjectWizardPageModel m) => m.AppNameInvalid);
                nameValid.BindDataContext(c => c.Text, (ProjectWizardPageModel m) => m.AppNameValidationText);


                content.BeginHorizontal();
                content.Add(HeadingLabel((model.IsLibrary ? "Library" : "App") + " Name:"));
                content.AddColumn(nameBox, nameValid);
                content.EndHorizontal();
            }
            else if (!string.IsNullOrEmpty(model.AppName))
            {
                var label = new Label {
                    Text = model.AppName, VerticalAlignment = VerticalAlignment.Center
                };
                content.AddRow(HeadingLabel((model.IsLibrary ? "Library" : "App") + " Name:"), label);
            }

            if (model.SupportsCombined)
            {
                var platformTypeList = new RadioButtonList
                {
                    Orientation = Orientation.Vertical,
                    Spacing     = radioSpacing,
                    Items       =
                    {
                        new ListItem {
                            Text = "Separate projects for each platform", Key = "separate"
                        },
                        new ListItem {
                            Text = "Single Windows, Linux, and Mac desktop project", Key = "combined"
                        }
                    }
                };
                platformTypeList.BindDataContext(c => c.Enabled, (ProjectWizardPageModel m) => m.AllowCombined);
                platformTypeList.SelectedKeyBinding
                .Convert(v => v == "combined", v => v ? "combined" : "separate")
                .BindDataContext((ProjectWizardPageModel m) => m.Combined);
                content.AddRow(HeadingLabel("Launcher:"), platformTypeList);
            }

            if (model.SupportsXamMac)
            {
                var cb = new CheckBox
                {
                    Text    = "Include Xamarin.Mac project",
                    ToolTip = "This enables you to bundle mono with your app so your users don't have to install it separately.  You can only compile this on a Mac"
                };
                cb.CheckedBinding.BindDataContext((ProjectWizardPageModel m) => m.IncludeXamMac);
                content.AddRow(HeadingLabel(string.Empty), cb);
            }

            /*
             * eventually select platforms to include?
             *
             * var platformCheckBoxes = new DynamicLayout();
             * platformCheckBoxes.BeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "Gtk2" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Gtk3" });
             * platformCheckBoxes.EndBeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "WinForms" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Wpf" });
             * platformCheckBoxes.Add(new CheckBox { Text = "Direct2D" });
             * platformCheckBoxes.EndBeginHorizontal();
             * platformCheckBoxes.Add(new CheckBox { Text = "Mac" });
             * platformCheckBoxes.Add(new CheckBox { Text = "XamMac" });
             * platformCheckBoxes.Add(new CheckBox { Text = "XamMac2" });
             * platformCheckBoxes.EndHorizontal();
             *
             * content.Rows.Add(new TableRow(new Label { Text = "Platforms:", TextAlignment = TextAlignment.Right }, platformCheckBoxes));
             * /**/

            if (model.SupportsFramework)
            {
                var frameworkCheckBoxes = new CheckBoxList();
                frameworkCheckBoxes.BindDataContext(c => c.DataStore, (ProjectWizardPageModel m) => m.SupportedFrameworks);
                frameworkCheckBoxes.ItemTextBinding = Binding.Property((ProjectWizardPageModel.FrameworkInfo i) => i.Text);
                frameworkCheckBoxes.ItemKeyBinding  = Binding.Property((ProjectWizardPageModel.FrameworkInfo i) => i.Value);
                frameworkCheckBoxes.SelectedValuesBinding.BindDataContext((ProjectWizardPageModel m) => m.SelectedFrameworks);

                content.AddRow(HeadingLabel("Framework:"), frameworkCheckBoxes);
            }

            if (model.SupportsProjectType)
            {
                var sharedCodeList = new RadioButtonList
                {
                    Orientation = Orientation.Vertical,
                    Spacing     = radioSpacing,
                };
                if (model.SupportsPCL)
                {
                    sharedCodeList.Items.Add(new ListItem {
                        Text = "Portable Class Library", Key = "pcl"
                    });
                    sharedCodeList.SelectedKeyBinding.Convert(v => v == "pcl", v => v ? "pcl" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UsePCL);
                }
                if (model.SupportsNetStandard)
                {
                    sharedCodeList.Items.Add(new ListItem {
                        Text = ".NET Standard", Key = "netstandard"
                    });
                    sharedCodeList.SelectedKeyBinding.Convert(v => v == "netstandard", v => v ? "netstandard" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UseNetStandard);
                }
                if (model.SupportsSAL)
                {
                    sharedCodeList.Items.Add(new ListItem {
                        Text = "Shared Project", Key = "sal"
                    });
                    sharedCodeList.SelectedKeyBinding.Convert(v => v == "sal", v => v ? "sal" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UseSAL);
                }

                sharedCodeList.Items.Add(new ListItem {
                    Text = "Full .NET", Key = "net"
                });
                sharedCodeList.SelectedKeyBinding.Convert(v => v == "net", v => v ? "net" : sharedCodeList.SelectedKey).BindDataContext((ProjectWizardPageModel m) => m.UseNET);

                content.AddRow(new Label {
                    Text = model.IsLibrary ? "Type:" : "Shared Code:", TextAlignment = TextAlignment.Right
                }, sharedCodeList);
            }

            if (model.SupportsPanelType)
            {
                var panelTypeList = new RadioButtonList
                {
                    Orientation = Orientation.Horizontal,
                    Spacing     = radioSpacing,
                };

                panelTypeList.Items.Add(new ListItem {
                    Text = "Code", Key = "code"
                });
                panelTypeList.SelectedKeyBinding.BindDataContext((ProjectWizardPageModel m) => m.Mode);

                if (model.SupportsXeto)
                {
                    panelTypeList.Items.Add(new ListItem {
                        Text = "Xaml", Key = "xaml"
                    });
                }
                if (model.SupportsJeto)
                {
                    panelTypeList.Items.Add(new ListItem {
                        Text = "Json", Key = "json"
                    });
                }
                if (model.SupportsCodePreview)
                {
                    panelTypeList.Items.Add(new ListItem {
                        Text = "Code Preview", Key = "preview"
                    });
                }

                content.AddRow(HeadingLabel("Form:"), panelTypeList);
            }

            if (model.SupportsBase)
            {
                var baseTypeList = new RadioButtonList
                {
                    Orientation = Orientation.Horizontal,
                    Spacing     = radioSpacing,
                };

                baseTypeList.Items.Add(new ListItem {
                    Text = "Panel", Key = "Panel"
                });
                baseTypeList.Items.Add(new ListItem {
                    Text = "Dialog", Key = "Dialog"
                });
                baseTypeList.Items.Add(new ListItem {
                    Text = "Form", Key = "Form"
                });
                baseTypeList.SelectedKeyBinding.BindDataContext((ProjectWizardPageModel m) => m.Base);

                content.AddRow(HeadingLabel("Base:"), baseTypeList);
            }

#if DEBUG
            var showColorsButton = new Button {
                Text = "Show all themed colors"
            };
            showColorsButton.Click += (sender, e) => new ThemedColorsDialog().ShowModal(this);
            content.AddRow(new Panel(), showColorsButton);
#endif

            var informationLabel = new Label();
            informationLabel.TextBinding.BindDataContext((ProjectWizardPageModel m) => m.Information);
            Information = informationLabel;

            Content     = content;
            DataContext = model;
        }