protected void Button1_Click(object sender, EventArgs e) { int j = 0; Product prod = new Product(); List <Product> pl = prod.getProducts(); List <string> ids = new List <string>(); List <Product> slst = new List <Product>(); foreach (Product p in pl) { CheckBox cb = (CheckBox)PlaceHolder1.FindControl("cb" + j.ToString()); if (cb.Checked == true) { slst.Add(p); ids.Add("cb" + j.ToString()); } j++; } Session["tocart"] = slst; Session["idis"] = ids; Label lbl7 = new Label(); lbl7.Text = "the products you chose are: <br/>"; foreach (Product d in slst) { lbl7.Text += d.Title + "<br/>"; } PlaceHolder2.Controls.Add(lbl7); Response.Redirect("Cart.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { if (Session["count"] != null) { List <int> terminalList = null; count = int.Parse(Session["count"].ToString()); terminalList = new List <int>(); for (int i = 0; i < count; i++) { int txt = int.Parse(((TextBox)PlaceHolder1.FindControl("txtTerminalId" + i.ToString())).Text.ToString()); terminalList.Add(txt); } Session["terminalId"] = terminalList; Button1.Enabled = false; Response.Write("<script language=javascript> window.close();</script>"); } else if (Session["AgentCodeCount"] != null) { List <string> agentCodelist = null; count = int.Parse(Session["AgentCodeCount"].ToString()); agentCodelist = new List <string>(); for (int i = 0; i < count; i++) { string txt = ((TextBox)PlaceHolder1.FindControl("txtAgentCode" + i.ToString())).Text.ToString(); agentCodelist.Add(txt); } Session["agentCodelist"] = agentCodelist; Button1.Enabled = false; Response.Write("<script language=javascript> window.close();</script>"); Session.Remove("table"); } }
protected void JisuanZongfen(object sender, EventArgs e)//计算总分的同时显示种题型应选择多少道题,选择了哪些题型 { StringBuilder tixings = new StringBuilder(); DropDownList tixuzeshuDropdownList; DropDownList fenzhiDropdownList; int zongfen = 0; SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["kecheng2012ConnectionString"].ConnectionString; SqlCommand comm = conn.CreateCommand(); comm.CommandText = "select mingcheng from tb_timuleixing order by tixingid"; conn.Open(); SqlDataReader sdr = comm.ExecuteReader(); while (sdr.Read()) { tixuzeshuDropdownList = (DropDownList)(PlaceHolder1.FindControl("tixing" + sdr.GetString(0).Trim())); if (tixuzeshuDropdownList != null && tixuzeshuDropdownList.SelectedIndex > 0) { tixings.Append(sdr.GetString(0) + ","); fenzhiDropdownList = (DropDownList)(PlaceHolder1.FindControl("timufenzhi" + sdr.GetString(0).Trim())); if (fenzhiDropdownList != null) { zongfen += int.Parse(tixuzeshuDropdownList.SelectedValue) * int.Parse(fenzhiDropdownList.SelectedValue); } } } sdr.Close(); conn.Close(); TextBoxzongfen.Text = zongfen.ToString(); HiddenFieldtixings.Value = tixings.ToString();//选择了哪些题型 }
private void InitializeState() { if (_State == null) { if (!_Context.IsConfigurationTypeRegistered(typeof(SpeedSearchState))) { _Context.RegisterConfigurationType(typeof(SpeedSearchState)); } _State = _Context.GetConfiguration <SpeedSearchState>(); } if ((_State != null) && (_State.SelectedIndexes.Count > 0)) { SearchRequest.Text = _State.SearchText; SearchType.SelectedIndex = _State.SearchTypeIdx; MaxResults.SelectedValue = _State.MaxResults.ToString(); SearchFlags.Items[0].Selected = _State.Root; SearchFlags.Items[1].Selected = _State.Thesaurus; SearchFlags.Items[2].Selected = _State.SoundsLike; for (int idx = 0; idx < _Indexes.Count; idx++) { CheckBox thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + idx.ToString()); if (thisIndex != null) { thisIndex.Checked = false; if (_State.SelectedIndexes.Contains(idx)) { thisIndex.Checked = true; } } } } }
public void Removetextbox() { int count = this.NumberOfControls1; for (int i = 0; i < count; i++) { TextBox txcat = (TextBox)PlaceHolder1.FindControl("txtData" + i.ToString()); TextBox txsubcat = (TextBox)PlaceHolder1.FindControl("txtsubData" + i.ToString()); TextBox txsubcat1 = (TextBox)PlaceHolder1.FindControl("txtsubData_1" + i.ToString()); TextBox txsubcat2 = (TextBox)PlaceHolder1.FindControl("txtsubData_2" + i.ToString()); TextBox txsubcat3 = (TextBox)PlaceHolder1.FindControl("txtsubData_3" + i.ToString()); TextBox txsubcat4 = (TextBox)PlaceHolder1.FindControl("txtsubData_4" + i.ToString()); TextBox txsubcat5 = (TextBox)PlaceHolder1.FindControl("txtsubData_5" + i.ToString()); TextBox txsubcat6 = (TextBox)PlaceHolder1.FindControl("txtsubData_6" + i.ToString()); PlaceHolder1.Controls.Remove(txcat); PlaceHolder1.Controls.Remove(txsubcat); PlaceHolder1.Controls.Remove(txsubcat1); PlaceHolder1.Controls.Remove(txsubcat2); PlaceHolder1.Controls.Remove(txsubcat3); PlaceHolder1.Controls.Remove(txsubcat4); PlaceHolder1.Controls.Remove(txsubcat5); PlaceHolder1.Controls.Remove(txsubcat6); } }
protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e) { var num = DDL_layer.SelectedValue; string[] temp = new string[int.Parse(num)]; for (int i = 0; i < int.Parse(num); i++) { DropDownList ddl = (DropDownList)PlaceHolder1.FindControl(i.ToString()); temp[i] = ddl.SelectedItem.Value; } //if ((RadioButtonList2.SelectedIndex == 1)) //{ // DDL_layer.Enabled = true; //} //else //{ // DDL_layer.Enabled = true; //} //DropDwonList_layer(); // string layer = DDL_layer.SelectedItem.Value; //List<int> list = new List<int>(); //for (int i = 1; i <= int.Parse(layer); i++) //{ // DropDownList14.Items.Add(new ListItem(i.ToString(), i.ToString())); //} //StringBuilder sBuilder = new StringBuilder(); //for (int i = 1; i <= int.Parse(layer); i++) //{ // DropDownList ddl = new DropDownList(); // ddl.ID = i.ToString(); // //ddl.SelectedIndexChanged += dynamicDDL_SelectedIndexChanged; // //ddl.Items.Add(new ListItem("test1", "test1")); // //ddl.Items.Add(new ListItem("test2", "test2")); // //ddl.Items.Add(new ListItem("test3", "test3")); // ddl.DataSourceID = "SqlDataSource1"; // ddl.DataTextField = "OrderName"; // ddl.DataValueField = "Kind"; // ddl.AppendDataBoundItems = true; // ddl.Items.Insert(0, new ListItem("-請選擇-", "0")); // PlaceHolder1.Controls.Add(new LiteralControl("<tr><td class=\"auto-style13\">第 " + i + " 階</td><td class=\"auto-style14\">")); // // sb.Append("<input type='hidden' name='" + aa.Key + "' value='" + aa.Value + "'>").AppendLine(); // //sBuilder.AppendLine(@"" += ddl.DataBind() + ""); // PlaceHolder1.Controls.Add(ddl); // ddl.DataBind(); // PlaceHolder1.Controls.Add(new LiteralControl("</td></tr>")); //} }
public void testeMeteodo() { int[] crit; int[] usuarios; crit = new int[colsCount]; usuarios = new int[rowsCount]; string link = Request.QueryString["avaliacao"].ToString(); Res_Resposta res = new Res_Resposta(); Ava_Avaliacao ava = new Ava_Avaliacao(); Usu_Usuario usu1 = new Usu_Usuario(); Usu_Usuario usu = new Usu_Usuario(); TextBox txt = new TextBox(); int avali = Convert.ToInt32(link); for (int i = 0; i < rowsCount; i++) { for (int h = 0; h < colsCount; h++) { if (i == 0 && h > 0) { crit[h] = Convert.ToInt32(((Label)PlaceHolder1.FindControl("cri" + h)).Text); } if (h == 0 && i > 0) { usuarios[i] = Convert.ToInt32(((Label)PlaceHolder1.FindControl("nom" + (i - 1))).Text); } // int avali = Convert.ToInt32(link); res = new Res_Resposta(); ava = new Ava_Avaliacao(); usu1 = new Usu_Usuario(); usu = new Usu_Usuario(); txt = new TextBox(); if (i != 0 && h != 0) { Cri_Criterio crite = new Cri_Criterio(); txt = (TextBox)PlaceHolder1.FindControl("TextBoxRow_" + (i - 1) + "Col_" + h); crite.Cri_codigo = crit[h]; //usu1.Usu_codigo = 2; res.Usu_codigo1 = new Usu_Usuario(); Usu_Usuario usuario1 = (Usu_Usuario)Session["usuario"]; res.Usu_codigo1 = usuario1; //usu.Usu_codigo = usuarios[i]; res.Usu_codigo = new Usu_Usuario(); res.Usu_codigo.Usu_codigo = usuarios[i]; ava.Ava_codigo = avali; res.Ava_codigo = ava; res.Cri_codigo = crite; res.Res_nota = Convert.ToInt32(txt.Text); res.Res_codigo = Res_RespostaDB.Insert(res); } } } }
protected void Button1_Click(object sender, EventArgs e) { for (int i = 0; i < AttributesCount; i++) { TextBox tt = (TextBox)PlaceHolder1.FindControl("TextBoxAttributeName" + (i + 1)); Response.Write(tt.Text); //Response.Redirect("~/WebForm1.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { //if ((Button1.Text == "階層及編號設定並鎖定")) //{ // Button1.Text = "解除鎖定"; // Pnl_LayerSet.Enabled = false; // Section1.Text = "階層及編號設定(已鎖定)"; Pnl_Note1.Visible = false; Pnl_Note2.Visible = false; bool result1 = false; bool result2 = false; string UpdateItemOrder = ""; string[] LayerKind = new string[int.Parse(ViewState["i"].ToString())]; string database = Session["DatabaseName"].ToString(); int maxLayer = WebModel.MaxValue(database, "Bid_WBSLayer", "LayerNum"); string SQLDel = "Delete from Bid_WBSLayer where bid=" + Session["BID"].ToString() + ""; bool result = WebModel.SQLAction(database, SQLDel); for (int i = 0; i < int.Parse(ViewState["i"].ToString()); i++) { int Layernum = i + 1; DropDownList drop = new DropDownList(); drop = (DropDownList)PlaceHolder1.FindControl(i.ToString()); DropDownList DDL1; DDL1 = (DropDownList)PlaceHolder1.FindControl(i.ToString()); LayerKind[i] += DDL1.SelectedValue; string SQLLayer = "Insert into Bid_WBSLayer ([bid],[LayerNum],[LayerKind]) Values (" + Session["BID"].ToString() + "," + Layernum + "," + LayerKind[i] + ")"; result1 = WebModel.SQLAction(database, SQLLayer); } if (RadioButtonList2.SelectedValue == "0") { string SQLNumType = "Update BidM0 set BidNumType=0 where bid=" + Session["Bid"].ToString(); WebModel.SQLAction(database, SQLNumType); result2 = DAL.BidLayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["bid"].ToString()); UpdateItemOrder = "update Bid_WBS set Bid_WBS.ItemOrder = OrderName from Bid_WBSLayer join Bid_WBS on Bid_WBS.LayerNum=Bid_WBSLayer.LayerNum join LayerOrder on Bid_WBS.SortNum = LayerOrder.OrderNum and Bid_WBSLayer.LayerKind = LayerOrder.Kind where Bid_WBSLayer.BID=" + Session["Bid"].ToString() + ""; result1 = WebModel.SQLAction(database, UpdateItemOrder); } else if (RadioButtonList2.SelectedValue == "1") { string SQLNumType = "Update BidM0 set BidNumType=1 where bid=" + Session["bid"].ToString(); result1 = WebModel.SQLAction(database, SQLNumType); result2 = DAL.BidLayerCodeSort.Update_order_num(Session["DatabaseName"].ToString(), Session["bid"].ToString()); //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "addLayerCode();", true);//ajax 更新項次 Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "UpdtItemOrder();", true); //ajax 更新項次 } if (result1) { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 階層新增成功');", true); } else { ScriptManager.RegisterStartupScript((System.Web.UI.Page)HttpContext.Current.Handler, this.GetType(), "ShowMessage", "alert(' 階層新增失敗');", true); } Session["Itemadd"] = Session["Bid"].ToString(); Response.Write("<script>window.opener.document.getElementById('ContentPlaceHolder1_callback').click();</script>"); }
private void itemselect_indexchange(object sender, EventArgs e) { string[] LayerKind = new string[int.Parse(ViewState["i"].ToString())]; for (int i = 0; i < int.Parse(ViewState["i"].ToString()); i++) { DropDownList DDL = (DropDownList)PlaceHolder1.FindControl(i.ToString()); LayerKind[i] += DDL.SelectedValue; } }
protected void Button1_Click(object sender, EventArgs e) { HttpPostedFile postfile = (HttpPostedFile)Session["postfile"]; int i = Convert.ToInt32(Session["selectedvault"]); var uploadService = client.CreateChannel <IUploadService>(); string id; using (var fs = postfile.InputStream) { id = uploadService.UploadFileContent(fs, null); } var mcs = client.CreateChannel <IMediaContentService>(); var mediaItem = mcs.StoreContentInVault(id, postfile.FileName, "image/png", i); var mediaid = mediaItem.Id; var mi = client.Query <MediaItem>() .Where(u => u.Id == mediaid) .Include(x => x.Metadata.Where(md => md.DefinitionType == MetadataDefinitionTypes.User)) .FirstOrDefault(); mi.Metadata.Clear(); foreach (Control item in PlaceHolder1.Controls) { switch (item.GetType().Name) { case "TextBox": var m = new MetadataString(); m.MetadataDefinitionId = Convert.ToInt32(item.ID); Control mytextbox = (TextBox)PlaceHolder1.FindControl(item.ID); m.StringValue = (mytextbox as TextBox).Text; //m.StringValue = Request.Form[item.ID]; mi.Metadata.Add(m); break; } } var ms = client.CreateChannel <IMediaService>(); ms.Save(new List <MediaItem> { mi }, MediaServiceSaveOptions.Metadata); ms.Save(new List <MediaItem> { mediaItem }, MediaServiceSaveOptions.MarkAsOrganized); Console.WriteLine("Media item marked as organized"); Session.RemoveAll(); }
//人員切換之後指定EmpID protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { RadioButton RadioButton1 = sender as RadioButton; RadioButton1.Checked = true; GridView_RegisterPeoplinfo.SelectedIndex = (RadioButton1.NamingContainer as GridViewRow).RowIndex; EmpID = GridView_RegisterPeoplinfo.DataKeys[GridView_RegisterPeoplinfo.SelectedIndex].Value.ToString(); //載入個人資訊 //個人固定欄位 ObjectDataSource_fixA.SelectParameters["activity_id"].DefaultValue = ActivityID.ToString(); ObjectDataSource_fixA.SelectParameters["emp_id"].DefaultValue = EmpID; FormView_fixA.DataBind(); //載入動態欄位資料 ACMS.DAO.CustomFieldValueDAO myCustomFieldValueDAO = new ACMS.DAO.CustomFieldValueDAO(); List <ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = myCustomFieldValueDAO.SelectCustomFieldValue(ActivityID, EmpID); foreach (ACMS.VO.CustomFieldValueVO myCustomFieldValueVO in myCustomFieldValueVOList) { if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOX") { TextBox MyControl = new TextBox(); MyControl.ID = string.Format("txt{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TextBox).Text = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "TEXTBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("plh{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; CheckBoxList1_SelectedIndexChanged((PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList), null); } else if (myCustomFieldValueVO.field_control.ToUpper() == "CHECKBOXLIST") { TCheckBoxList MyControl = new TCheckBoxList(); MyControl.ID = string.Format("cbl{0}", myCustomFieldValueVO.field_id); (PlaceHolder1.FindControl(MyControl.ID) as TCheckBoxList).SelectedValueList = myCustomFieldValueVO.field_value; } else if (myCustomFieldValueVO.field_control.ToUpper() == "RADIOBUTTONLIST") { TRadioButtonList MyControl = new TRadioButtonList(); MyControl.ID = string.Format("radl{0}", myCustomFieldValueVO.field_id); (MyControl as TRadioButtonList).ClearSelection(); (PlaceHolder1.FindControl(MyControl.ID) as TRadioButtonList).SelectedValue = myCustomFieldValueVO.field_value; } } }
protected void addIngredient_Click(object sender, EventArgs e) { count++; for (int j = 2; j < count; j++) { string uControl = "ucIngredient" + j; ucIngredient uc = (ucIngredient)PlaceHolder1.FindControl(uControl); uc.Visible = true; } }
protected void btnRead_Click(object sender, EventArgs e)// { int count = this.NumberOfControls; for (int i = 0; i < count; i++) { TextBox tx = (TextBox)PlaceHolder1.FindControl("txtData" + i.ToString()); // finds VALUE LABEL //Add the Controls to the container of your choice Label1.Text += tx.Text + ","; // implement add value to label } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue == "TB") { Response.Write(((TextBox)PlaceHolder1.FindControl("TB1")).Text); } else if (DropDownList1.SelectedValue == "DDL") { Response.Write(((DropDownList)PlaceHolder1.FindControl("DDL1")).SelectedItem.Text); } }
protected void Button1_Click(object sender, EventArgs e) { RadioButtonList rdoltChoice1 = (RadioButtonList)PlaceHolder1.FindControl("rdoltChoice1"); if (rdoltChoice1.Text.ToString() == "") { Response.Write("<script>alert('请选择你的答案再点提交')</script>"); } else { Label1.Text = "你选择了:" + rdoltChoice1.SelectedValue; } }
protected void btnsave_Click(object sender, EventArgs e) { save_performancetest(); int count = this.NumberOfControls1; for (int i = 0; i < count; i++) { TextBox txcat = (TextBox)PlaceHolder1.FindControl("txtData" + i.ToString()); TextBox txsubcat = (TextBox)PlaceHolder1.FindControl("txtsubData" + i.ToString()); TextBox txsubcat1 = (TextBox)PlaceHolder1.FindControl("txtsubData_1" + i.ToString()); TextBox txsubcat2 = (TextBox)PlaceHolder1.FindControl("txtsubData_2" + i.ToString()); TextBox txsubcat3 = (TextBox)PlaceHolder1.FindControl("txtsubData_3" + i.ToString()); TextBox txsubcat4 = (TextBox)PlaceHolder1.FindControl("txtsubData_4" + i.ToString()); TextBox txsubcat5 = (TextBox)PlaceHolder1.FindControl("txtsubData_5" + i.ToString()); TextBox txsubcat6 = (TextBox)PlaceHolder1.FindControl("txtsubData_6" + i.ToString()); //Add the Controls to the container of your choice perf_valueHidden.Value = txcat.Text.Trim().Replace("'", "''") + "," + txsubcat.Text.Trim().Replace("'", "''") + "," + txsubcat1.Text.Trim().Replace("'", "''") + "," + txsubcat2.Text.Trim().Replace("'", "''") + "," + txsubcat3.Text.Trim().Replace("'", "''") + "," + txsubcat4.Text.Trim().Replace("'", "''") + "," + txsubcat5.Text.Trim().Replace("'", "''") + "," + txsubcat6.Text.Trim().Replace("'", "''") + ","; db1.strCommand = "insert into Performance_Values(PerfID,Perf_Value) values('" + Session["perfid"].ToString() + "','" + perf_valueHidden.Value + "')"; db1.insertqry(); txcat.Text = ""; txsubcat.Text = ""; txsubcat1.Text = ""; txsubcat2.Text = ""; txsubcat3.Text = ""; txsubcat4.Text = ""; txsubcat5.Text = ""; txsubcat6.Text = ""; } db1.strCommand = "select Top " + count + " ValueID from Performance_Values order by ValueID desc"; DataTable dt_valueid = db1.selecttable(); if (dt_valueid.Rows.Count > 0) { for (int i = 0; i < count; i++) { db1.strCommand = "insert into perfvaluesplit(PerfID,ValueID)values('" + Session["PerfID"].ToString() + "','" + dt_valueid.Rows[i]["ValueID"].ToString() + "')"; db1.insertqry(); } } Removetextbox(); btnadd.Focus(); }
/// <summary> /// Help-function; Sets CssClass of all Buttons to the default class /// </summary> private void ResetAllButtons() { if (Session["_currentImportance"] != null) { Button current = (Button)PlaceHolder1.FindControl(Session["_currentImportance"].ToString()); current.CssClass = "btn-Importance"; } List <String> allMarkedButtons = (List <String>)Session["allMarkedButtons"]; foreach (string s in allMarkedButtons) { Button temp = (Button)PlaceHolder1.FindControl(s); temp.CssClass = "btn-Answer"; } Session["allMarkedButtons"] = new List <String>(); }
protected void btnRead_Click(object sender, EventArgs e) { int count = this.NumberOfControls; for (int i = 0; i < count; i++) { TextBox tx = (TextBox)PlaceHolder1.FindControl("txtData" + i.ToString()); //Add the Controls to the container of your choice SqlConnection con = new SqlConnection(sqlcon); con.Open(); SqlCommand cmd = new SqlCommand("insert into Category(CategoryName)values('" + tx.Text + "')", con); cmd.ExecuteNonQuery(); tx.Text = ""; } }
//選擇費用項目時要加總金額 protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { int intSum = 0; foreach (ListItem theListItem in (sender as CheckBoxList).Items) { if (theListItem.Selected == true) { intSum = intSum + Convert.ToInt32(theListItem.Text.Replace("元", "").Split(':')[1]); } } string lblSumValueID = string.Format("lblSumValue_{0}", (sender as TCheckBoxList).ID.Substring(3)); (PlaceHolder1.FindControl(lblSumValueID) as Label).Text = intSum.ToString(); }
/// <summary> /// Button Handler for all Importance Buttons /// </summary> /// <param name="sender">Button which got pressed</param> /// <param name="e"></param> protected void ImportanceClick(object sender, EventArgs e) { if (Session["_currentImportance"] != null) { Button current = (Button)PlaceHolder1.FindControl(Session["_currentImportance"].ToString()); current.CssClass = "btn-Importance"; } Button btn = (Button)sender; int curImportance = Int32.Parse(btn.Text); Session["gaveImportanceFactor"] = true; Session["tempImportancy"] = curImportance; btn.CssClass = "btn-Importance-clicked"; Session["_currentImportance"] = btn.ID; }
private void getSocialHistory(int patientId) { var PSM = new PatientScreeningManager(); List <PatientScreening> screeningList = PSM.GetPatientScreening(patientId); if (screeningList != null) { foreach (var value in screeningList) { RadioButtonList rbl = (RadioButtonList)PlaceHolder1.FindControl(value.ScreeningCategoryId.ToString()); if (rbl != null) { rbl.SelectedValue = value.ScreeningValueId.ToString(); } } } }
private void AddIngredientToRecipe(Recipe aRecipe) { for (int i = 1; i < 16; i++) { ucIngredient uc = (ucIngredient)PlaceHolder1.FindControl("ucIngredient" + i); if (uc != null && uc.Visible == true) { PlaceHolder1.Controls.Add(uc); var ing = new Ingredient(); ing.Name = uc.NameOfIngredient; ing.Quantity = uc.Qty; ing.UnitOfMeasure = uc.Unit; //lblResult.Text += " "+ing.Name + " " + ing.Quantity + " " + ing.UnitOfMeasure+" "; aRecipe.Needs[i - 1] = ing; } } }
private SpeedSearchQuery BuildQuery() { var ssq = new SpeedSearchQuery { SearchText = SearchRequest.Text }; if (string.IsNullOrEmpty(ssq.SearchText)) { throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Keyword_Required").ToString()); } ssq.SearchType = SearchType.SelectedIndex; ssq.IncludeStemming = SearchFlags.Items[0].Selected; ssq.IncludeThesaurus = SearchFlags.Items[1].Selected; ssq.IncludePhonic = SearchFlags.Items[2].Selected; ssq.WhichPage = _whichResultsPage; ssq.ItemsPerPage = 10; _state.SelectedIndexes.Clear(); for (var i = 0; i < _indexes.Count; i++) { var thisIndex = (CheckBox)PlaceHolder1.FindControl("Index" + i); if ((thisIndex != null) && (thisIndex.Checked)) { ssq.Indexes.Add(new SpeedSearchIndex(_indexes[i].IndexName, _indexes[i].Type.Value, _indexes[i].IsSecure ?? false)); _state.SelectedIndexes.Add(i); } } if (ssq.Indexes.Count == 0) { throw new UserObservableException(GetLocalResourceObject("SpeedSearch_Error_Index_Required").ToString()); } var freqfilter = (CheckBox)PlaceHolder2.FindControl("FreqUsed"); if ((freqfilter != null) && (freqfilter.Checked)) { ssq.UseFrequentFilter = true; } foreach (var fd in _searchFilters.Values) { var filter = (TextBox)PlaceHolder2.FindControl(fd.DisplayName); if ((filter != null) && (!string.IsNullOrEmpty(filter.Text))) { ssq.Filters.Add(new SpeedSearchFilter(fd.DisplayName, filter.Text, fd.CommonIndexes, fd.FieldType, fd.IndexType)); } } return(ssq); }
//取得自訂欄位值 private List <ACMS.VO.CustomFieldValueVO> GetCustomFieldValueVOList() { List <ACMS.VO.CustomFieldValueVO> myCustomFieldValueVOList = new List <ACMS.VO.CustomFieldValueVO>(); if (MyHashtable != null) { foreach (DictionaryEntry HashtableItem in MyHashtable) { ACMS.VO.CustomFieldValueVO myCustomFieldValueVO = new ACMS.VO.CustomFieldValueVO(); myCustomFieldValueVO.id = Guid.NewGuid(); myCustomFieldValueVO.emp_id = EmpID; //HashtableItem(MyControl.ID, myCustomFieldVO.field_id) Control MyControl = PlaceHolder1.FindControl(HashtableItem.Key.ToString()); myCustomFieldValueVO.field_id = Convert.ToInt32(HashtableItem.Value); if (MyControl is TCheckBoxList) { myCustomFieldValueVO.field_value = (MyControl as TCheckBoxList).SelectedValueList; } else if (MyControl is TRadioButtonList) { myCustomFieldValueVO.field_value = (MyControl as TRadioButtonList).SelectedValue; } else if (MyControl is TDropDownList) { myCustomFieldValueVO.field_value = (MyControl as TDropDownList).SelectedValue; } else if (MyControl is TextBox) { myCustomFieldValueVO.field_value = (MyControl as TextBox).Text; } myCustomFieldValueVOList.Add(myCustomFieldValueVO); } } return(myCustomFieldValueVOList); }
protected void subButton_Click(object sender, EventArgs e) { FileUpload FileUpload1 = (FileUpload)PlaceHolder1.FindControl("FileUpload1"); if (IsPostBack) { Boolean fileOK = false; //String path = Server.MapPath("~/"); String path = @"C:/"; if (FileUpload1.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); String[] allowedExtensions = { ".c" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName); Label2.Text = "File uploaded!"; Session["filesubmit"] = FileUpload1.FileName; } catch (Exception ex) { Label2.Text = "File could not be uploaded."; } } else { Label2.Text = "Cannot accept files of this type."; } } }
protected void newBtn2_Click(object sender, EventArgs e) { TextBox t = (TextBox)PlaceHolder1.FindControl("tbox1"); Session["persons"] = t.Text; VacationHouse v = (VacationHouse)Session["vacationHouse"]; string s = (string)Session["destination"]; int i = (int)Session["vacationWeekNumber"]; List <int> spots = Service.Instance.getAirplaneSpots(s, i); if (Convert.ToInt32(t.Text) > v.MaxPersons) { Label newLbl = new Label(); newLbl.Text = "Too many persons"; PlaceHolder2.Controls.Add(newLbl); } else { Response.Redirect("BookingPage.aspx"); } }
protected void CheckBox_CheckChanged(object sender, EventArgs e) { int j = 0; Product prod = new Product(); List <Product> pl = prod.getProducts(); List <Product> slst2 = new List <Product>(); foreach (Product p in (List <Product>)Session["tocart"]) { CheckBox cb = (CheckBox)PlaceHolder1.FindControl("cb" + j.ToString()); if (cb.Checked == false) { slst2.Add(p); } j++; } Session["tocart"] = slst2; show((List <Product>)Session["tocart"], (List <string>)Session["idis"]); }
/// <summary> /// AnswerButton Handler for every question which can be answered with exactly one answers /// </summary> /// <param name="sender">Button which got pressed</param> /// <param name="e"></param> protected void AnswerButtons_1_String(object sender, EventArgs e) { List <String> allMarkedButtons = (List <String>)Session["allMarkedButtons"]; if (Session["_currentButton"] != null) { Button current = (Button)PlaceHolder1.FindControl(Session["_currentButton"].ToString()); current.CssClass = "btn-Answer"; allMarkedButtons.Remove(current.ID); Session["allMarkedButtons"] = allMarkedButtons; } Button btn = (Button)sender; Session["answeredQuestion"] = true; Session["tempAnswer"] = btn.Text; btn.CssClass = "btn-Answer-clicked"; Session["_currentButton"] = btn.ID; allMarkedButtons.Add(btn.ID); Session["allMarkedButtons"] = allMarkedButtons; }
public void getDepressionScreeningData() { var PSM = new PatientScreeningManager(); List <PatientScreening> screeningList = PSM.GetPatientScreeningByVisitId(PatientId, PmVisitId); //.GetPatientScreening(PatientId); if (screeningList != null) { foreach (var value in screeningList) { depressionId = Convert.ToInt32(value.ScreeningTypeId); RadioButtonList rblPC1Qs = (RadioButtonList)PlaceHolder1.FindControl("uds" + value.ScreeningCategoryId.ToString()); if (rblPC1Qs != null) { rblPC1Qs.SelectedValue = value.ScreeningValueId.ToString(); } RadioButtonList rblPC2Qs = (RadioButtonList)PlaceHolder2.FindControl("uds" + value.ScreeningCategoryId.ToString()); if (rblPC2Qs != null) { rblPC2Qs.SelectedValue = value.ScreeningValueId.ToString(); } } } var PCN = new PatientClinicalNotesLogic(); List <PatientClinicalNotes> notesList = PCN.getPatientClinicalNotesByVisitId(PatientId, PmVisitId); //.getPatientClinicalNotes(PatientId); if (notesList.Any()) { foreach (var value in notesList) { TextBox ntb = (TextBox)PlaceHolder2.FindControl("uds" + value.NotesCategoryId.ToString()); if (ntb != null) { ntb.Text = value.ClinicalNotes; } } } }