protected void FillWyglad() { string userid = Request.QueryString["userid"]; string wyglad = Usr.SelectOpisCiala(userid); Label Wyglad = (Label)FormView1.FindControl("Wyglad"); if (wyglad != null) { Wyglad.Text = "Budowa: " + wyglad + "<br \\>"; } else { Wyglad.Visible = false; } }
protected void FillWaga() { string userid = Request.QueryString["userid"]; int waga = Usr.GetWaga(userid); Label Waga = (Label)FormView1.FindControl("Waga"); if (waga != null && waga != 0) { Waga.Text = "Waga: " + waga.ToString() + " kg" + "<br \\>"; } else { Waga.Visible = false; } }
protected void ServerValidation(object source, ServerValidateEventArgs arguments) { //Makes sure that the date range is valid. Calendar Calendar1 = FormView1.FindControl("Calendar1") as Calendar; Calendar Calendar2 = FormView1.FindControl("Calendar2") as Calendar; if (Calendar1.SelectedDate != new DateTime() && Calendar2.SelectedDate != null && Calendar1.SelectedDate <= Calendar2.SelectedDate) { arguments.IsValid = true; } else { arguments.IsValid = false; } }
protected void SelectSporty() { string userid = Request.QueryString["userid"]; List <string> sporty = Usr.GetSporty(userid); Label sportyUsera = (Label)FormView1.FindControl("Sporty"); if (sporty != null) { sportyUsera.Text = string.Join(", ", sporty); } else { sportyUsera.Visible = false; } }
private void SetDatesWhichCannotBeUsed() { DropDownList RoomDownList = FormView1.FindControl("RoomDownList") as DropDownList; CheckBox MorningSlotCheckBox = FormView1.FindControl("MorningSlotCheckBox") as CheckBox; using (var db = new SupervisionDBDataContext()) { List <DateTime> Date = new List <DateTime>(); datesUsed = db.RoomAssignments.Where( x => x.MorningSlot == MorningSlotCheckBox.Checked && x.RoomID == Int32.Parse(RoomDownList.SelectedValue)).ToList(); } }
protected void ReflectToAward(object sender, EventArgs e) { TextBox Award = ((TextBox)FormView1.FindControl("Award")); string a = ((DropDownList)FormView1.FindControl("suggaward")).SelectedItem.Value; if (a == "TC" || a == "TN") { Award.Enabled = true; } else { Award.Enabled = false; } AsyncForm.Update(); }
protected void FillWzrost() { string userid = Request.QueryString["userid"]; int wzrost = Usr.GetWzrost(userid); Label WzrostL = (Label)FormView1.FindControl("Wzrost"); if (wzrost != null && wzrost != 0) { WzrostL.Text = "Wzrost: " + wzrost.ToString() + " cm" + "<br \\>"; } else { WzrostL.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack != true) { if (!this.IsPostBack) { BitOP.Global.MenuControl.getMenu((Menu)Master.FindControl("NavigationMenu"), (Login)Master.FindControl("Login1"), BitOP.Global.Perfil); } lblFecha.Text = DateTime.Today.ToString("dd-MM-yyyy"); lblResponsable.Text = BitOP.Global.Nombre; Fill_User_Header(); TextBox txtInicio = (TextBox)FormView1.FindControl("Hora_IncidenteTextBox0"); txtInicio.Text = DateTime.Now.ToString("hh:mm"); } }
//ItemDeleting Event Control protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e) { Label lblId = FormView1.FindControl("ViewId") as Label; var id = long.Parse(lblId.Text); var elements = from element in _dataContext.Visits where element.icdId == id select element; if (elements.Count() != 0) { _dataContext.Visits.DeleteAllOnSubmit(elements); _dataContext.SubmitChanges(); return; } }
protected void FreeDatesChanged(object sender, EventArgs e) { DropDownList RoleDownList = FormView1.FindControl("RoleDownList") as DropDownList; CheckBox MorningSlotCheckBox = FormView1.FindControl("MorningSlotCheckBox") as CheckBox; using (var db = new SupervisionDBDataContext()) { List <DateTime> startDates = new List <DateTime>(); List <DateTime> endDates = new List <DateTime>(); dateRangesUsed = db.Designations.Where( x => x.MorningSlot == MorningSlotCheckBox.Checked && x.Role == RoleDownList.SelectedValue).ToList(); } }
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) { int dob = (DateTime.Parse(((TextBox)FormView1.FindControl("dobTextBox")).Text)).Year; int now = DateTime.Now.Year; int age = now - dob; if (age >= 18) { args.IsValid = true; } else { args.IsValid = false; } }
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { Label idser = (Label)FormView1.FindControl("lblidup"); TextBox referencia = (TextBox)FormView1.FindControl("txbrefup"); TextBox direcip = (TextBox)FormView1.FindControl("txbipup"); TextBox canmega = (TextBox)FormView1.FindControl("txbcmegup"); DropDownList barrio = (DropDownList)FormView1.FindControl("dropbarrio"); TextBox direcc = (TextBox)FormView1.FindControl("txbdirecup"); TextBox estrato = (TextBox)FormView1.FindControl("txbestratoup"); TextBox stado = (TextBox)FormView1.FindControl("txbestadoup"); srv.actualizarservicio(int.Parse(idser.Text), direcip.Text, int.Parse(canmega.Text), estrato.Text, stado.Text, referencia.Text, direcc.Text, int.Parse(barrio.SelectedValue)); FormView1.ChangeMode(FormViewMode.ReadOnly); cargardatos(int.Parse(Valor)); }
protected void FreeDatesChanged(object sender, EventArgs e) { DropDownList RoomDownList = FormView1.FindControl("RoomDownList") as DropDownList; CheckBox MorningSlotCheckBox = FormView1.FindControl("MorningSlotCheckBox") as CheckBox; using (var db = new SupervisionDBDataContext()) { List <DateTime> Date = new List <DateTime>(); datesUsed = db.RoomAssignments.Where( x => x.MorningSlot == MorningSlotCheckBox.Checked && x.RoomID == Int32.Parse(RoomDownList.SelectedValue)).ToList(); } }
protected void Page_Load(object sender, EventArgs e) { MembershipUser user = Membership.GetUser(Page.User.Identity.Name); if (Session["Mode"] != null) { this.FormView1.ChangeMode(FormViewMode.Insert); } Session["IdUserCaptura"] = user.ProviderUserKey.ToString().ToUpper(); if (Session["IdExp"] != null) { DropDownList ddl = FormView1.FindControl("IdExpedienteDropDownList") as DropDownList; ddl.SelectedValue = Session["IdExp"].ToString(); } }
protected void FormView1_PreRender(object sender, EventArgs e) { DataView dv = (DataView)ObjectDataSource1.Select(); if (dv.Count > 0) { DataRow dr = (DataRow)dv.Table.Rows[0]; FormView fv = sender as FormView; woUsersBLL userLogic = new woUsersBLL(); string ls_usr = userLogic.GetFullNameByID(Convert.ToInt32(User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1))); if (fv.CurrentMode == FormViewMode.Insert) { string usr = User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1); Label LblAuthor = (Label)fv.Row.FindControl("LblAuthor"); LblAuthor.Text = ls_usr; LblAuthor.Enabled = false; Label LblPhase = (Label)fv.Row.FindControl("LblPhase"); LblPhase.Text = "Initial Work Order Request"; LblPhase.Enabled = false; //DropDownList DropDownListPhaseStat = (DropDownList)fv.Row.FindControl("DropDownListPhaseStat"); DataRowView rowView = (DataRowView)(FormView1.DataItem); if ((rowView != null)) { string ls_val = rowView["word_PMorSME"].ToString(); if (((DropDownList)FormView1.FindControl("DropDownList2")).Items.FindByValue(ls_val) != null) { ((DropDownList)FormView1.FindControl("DropDownList2")).SelectedValue = ls_val; } else { ((DropDownList)FormView1.FindControl("DropDownList2")).Items.Add(new ListItem(ls_val, ls_val)); } ls_val = rowView["word_BusnOwner"].ToString(); if (((DropDownList)FormView1.FindControl("DropDownList3")).Items.FindByValue(ls_val) != null) { ((DropDownList)FormView1.FindControl("DropDownList3")).SelectedValue = ls_val; } } } } }
protected void ServerValidationFilled(object source, ServerValidateEventArgs arguments) { //Makes sure that the date range has not already been filled for this time period/position/slot. TextBox txtBriefReason = FormView1.FindControl("txtBriefReason") as TextBox; if (txtBriefReason.Text.Trim() != "") { arguments.IsValid = true; } else { arguments.IsValid = false; } }
protected void FormView1_DataBound(object sender, EventArgs e) { //Doctor how to apply text if user is logged in or user gold membership has expired if (User.Identity.Name == "") { Label myHowToApplyLabel = (Label)FormView1.FindControl("HowToApplyLabel"); myHowToApplyLabel.Text = "*Log in to website to view this How To Apply information"; myHowToApplyLabel.CssClass = "text-danger"; } else if (!User.IsInRole("Gold") && !User.IsInRole("Administrator")) { Label myHowToApplyLabel = (Label)FormView1.FindControl("HowToApplyLabel"); myHowToApplyLabel.Text = "*Gold membership subscription is required to view this How To Apply information. To renew Gold subscription, go to My Profile"; myHowToApplyLabel.CssClass = "text-danger"; } }
protected void FormView1_ItemDeleted(object sender, EventArgs e) { UpdatePanel p = (UpdatePanel)FormView1.FindControl("UpdatePanel_ConfirmDelete"); p.Visible = false; p.Update(); SQL_utils sql = new SQL_utils("backend"); int prev_docversID = sql.IntScalar_from_SQLstring("select max(docversID) from tblDocVers where docID = " + " (select docID from tbl_deleted_from_web_docvers where docversID=" + Request.QueryString["DocVersID"] + ")"); sql.Close(); Response.Redirect(this.Request.Url.ToString().Replace(Request.QueryString["DocVersID"], prev_docversID.ToString())); }
protected void ItemInserting(object sender, FormViewInsertEventArgs e) { //Get data from textbox. (Remarks: Aid is auto increment value.) TextBox textFirstName = (TextBox)FormView1.FindControl("addFirstName"); TextBox textLastName = (TextBox)FormView1.FindControl("addLastName"); TextBox textBirthYear = (TextBox)FormView1.FindControl("addBirthYear"); GridView1.EditIndex = -1; objAuthor.FirstName = textFirstName.Text; objAuthor.LastName = textLastName.Text; objAuthor.BirthYear = textBirthYear.Text; objAuthor.Insert(); Data_Binding(); }
protected void Page_Load(object sender, EventArgs e) { Title = table.DisplayName; DetailsDataSource.Include = table.ForeignKeyColumnsNames; //sprawdzenie czy user id zalogowany = user id przypisany do zadania DynamicHyperLink UserIdZamowienie = (DynamicHyperLink)FormView1.FindControl("UserIdZamowienie"); DynamicHyperLink ShowStatus = (DynamicHyperLink)FormView1.FindControl("ShowStatus"); if (UserIdZamowienie.Text != HttpContext.Current.User.Identity.Name || ShowStatus.Text != "1") { Response.Redirect("../AccessDenied.aspx"); } }
protected void FormView1_DataBound(object sender, EventArgs e) { var ProvinceID = FormView1.FindControl("hdnProvinceID") as HiddenField; var ddlProvince = FormView1.FindControl("ddlProvince") as DropDownList; var DistrictID = FormView1.FindControl("hdnDistrictID") as HiddenField; var ddlDistrict = FormView1.FindControl("ddlDistrict") as DropDownList; if (!string.IsNullOrEmpty(ProvinceID.Value)) { ddlProvince.SelectedValue = ProvinceID.Value; } if (!string.IsNullOrEmpty(DistrictID.Value)) { ddlDistrict.SelectedValue = DistrictID.Value; } }
protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e) { DropDownList UsuarioSel = (DropDownList)FormView1.FindControl("DropDownListUsuario"); DropDownList AreaSel = (DropDownList)FormView1.FindControl("DropDownListArea"); DropDownList ProcesoSel = (DropDownList)FormView1.FindControl("DropDownListProceso"); DropDownList EquipoSel = (DropDownList)FormView1.FindControl("DropDownListEquipo"); DropDownList TurnoSel = (DropDownList)FormView1.FindControl("DropDownListTurno"); DropDownList DiasPermSel = (DropDownList)FormView1.FindControl("DropDownListDiasPerm"); e.Values["Usuario"] = UsuarioSel.SelectedValue.ToString(); e.Values["Area"] = AreaSel.SelectedValue.ToString(); e.Values["Proceso"] = ProcesoSel.SelectedValue.ToString(); e.Values["Equipo"] = EquipoSel.SelectedValue.ToString(); e.Values["Turno"] = TurnoSel.SelectedValue.ToString(); e.Values["DiasAtrasoReg"] = Convert.ToInt16(DiasPermSel.SelectedValue.ToString()); }
protected void FormView1_PreRender(object sender, EventArgs e) { HiddenField ID = FormView1.FindControl("ID") as HiddenField; int id = 0; if (int.TryParse(ID.Value, out id)) { Page.MetaDescription = ((Label)FormView2.FindControl("lblTitle")).Text; Page.Title = ((Label)FormView2.FindControl("lblTitle")).Text; RenderPicture(id); } else // no picture record found { Response.Redirect("default.aspx"); } }
protected void btnAdd_Click(object sender, EventArgs e) { SqlConnection connection = CreateConnection(); using (connection) { SqlCommand myCommand = new SqlCommand("insert_ShopCart", connection); myCommand.CommandType = CommandType.StoredProcedure; myCommand.CommandText = "insert_ShopCart"; SqlParameter parOrderID = new SqlParameter("@OrderID", SqlDbType.NVarChar); parOrderID.Value = "user1"; myCommand.Parameters.Add(parOrderID); SqlParameter parBookID = new SqlParameter("@BookID", SqlDbType.NVarChar); parBookID.Value = ((Label)FormView1.FindControl("BookIDLabel")).Text; myCommand.Parameters.Add(parBookID); SqlParameter parBookTitle = new SqlParameter("@BookTitle", SqlDbType.NVarChar); parBookTitle.Value = ((Label)FormView1.FindControl("BookTitleLabel")).Text; myCommand.Parameters.Add(parBookTitle); SqlParameter parPrice = new SqlParameter("@Price", SqlDbType.Money); parPrice.Value = ((Label)FormView1.FindControl("BookPriceLabel")).Text; myCommand.Parameters.Add(parPrice); SqlParameter parQty = new SqlParameter("@Qty", SqlDbType.Int); parQty.Value = ((TextBox)FormView1.FindControl("txtQty")).Text; myCommand.Parameters.Add(parQty); try { connection.Open(); myCommand.ExecuteNonQuery(); Button btn = (Button)sender; btn.Text = "Книгата/ите бяха добавени успешно! "; btn.Enabled = false; } catch (SqlException se) { //Label1.Text = sender.ToString(); Button btn = (Button)sender; btn.Text = "ГРЕШКА! " + se.Message; btn.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["RPS_Bank_ID"].ToString() == "0") { FormView1.ChangeMode(FormViewMode.Insert); ((Label)FormView1.Row.FindControl("Label_HEAD")).Text = "Customer Setup"; } else { ((Label)FormView1.FindControl("Label_HEAD")).Text = "Customer Setup : " + Session["RPS_Bank_BankCode"].ToString() + " / " + Session["RPS_Bank_BankName"].ToString(); //if (IsPostBack == false) //{ // ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[0].Disabled = false; // ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[2].Disabled = false; // ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[4].Disabled = false; //} if (IsPostBack == false) { string RGS_SUPPORT; RGS_SUPPORT = Session["RGS"].ToString(); /* * ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[0].Disabled = false; * ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[2].Disabled = false; * ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[4].Disabled = false; */ if (RGS_SUPPORT.Substring(2, 1) == "0") { ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[0].Disabled = true; /*Edit*/ } else if (RGS_SUPPORT.Substring(2, 1) == "1") { ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[0].Disabled = false; /*Edit*/ } if (RGS_SUPPORT.Substring(4, 1) == "0") { ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[4].Disabled = true; /*Authorize / Unauthorize*/ ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[2].Disabled = false; } else if (RGS_SUPPORT.Substring(4, 1) == "1") { ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[4].Disabled = false; /*Authorize / Unauthorize*/ ((EO.Web.ToolBar)FormView1.FindControl("DisplayToolBar")).Items[2].Disabled = false; } } } }
protected void Insert_fields(object sender, EntityDataSourceChangingEventArgs e) { YASA_PL.User c = (YASA_PL.User)e.Entity; if (c != null) { CheckBox ChkBox = (CheckBox)FormView1.FindControl("CheckBox1"); if (ChkBox.Checked == true) { string password = System.Web.Security.Membership.GeneratePassword(10, 2); c.Password = password; try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(c.Email); mail.Subject = "YASA Technology Team - System Zarządzania Dokumentacją"; mail.Body = "Witamy w YASA Technology Team - System Zarządzania Dokumentacją. \n \n"; mail.Body += "Ten email został wysłany automatycznie w celu potwierdzenia rejestracji w systemie YASA PDM \n"; mail.Body += "\n"; mail.Body += "Twoje hasło dostępu do systemu to: " + c.Password + "\n"; mail.Body += "\n"; mail.Body += "po pierwszym zalogowaniu się do YASA PDM zaleca się zmianę hasła."; mail.Body += "\n"; mail.Body += "Życzymy przejemnego korzystania z serwisu."; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Karolek1983"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); //MessageBox.Show("mail Send"); } catch (Exception ex) { //ScriptManager.RegisterStartupScript(this, this.GetType(), "Messagebox", "alert('Nie udało się wysłać wiadomości z hasłem uzytkownika');", true); } } c.Date_created_modified = DateTime.Now; if (HttpContext.Current.User.Identity.Name != "") { c.UserId = Convert.ToInt32(HttpContext.Current.User.Identity.Name); } } }
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { e.Cancel = true; string bgqq = ((TextBox)FormView1.FindControl("stdBgqqTextBox")).Text; string stdXh = Session["stdXh"].ToString(); string sql = "update stdInfo set stdBgqq=@bgqq where stdXh=@stdXh"; SqlParameter[] param = { new SqlParameter("@bgqq", SqlDbType.Text), new SqlParameter("@stdXh", SqlDbType.Char) }; param[0].Value = bgqq; param[1].Value = stdXh; sqlHelp.ExecuteNonQuery(sqlHelp.ConnectionStringLocalTransaction, CommandType.Text, sql, param); Response.Redirect("ModifyInfo.aspx?stdXh=" + stdXh); }
protected void btnBlue_Click(object sender, ImageClickEventArgs e) { MultiView1.ActiveViewIndex = 1; //Zoek de textboxen eerst op, want ze staan op een FormView TextBox txtRed = (TextBox)FormView1.FindControl("txtRed"); TextBox txtBlue = (TextBox)FormView1.FindControl("txtBlue"); txtRed.Text = ""; txtRed.Visible = false; txtBlue.Text = "Actief"; txtBlue.Visible = true; //FormView1.DataBind(); //refresh het form MultiView1.DataBind(); GridView2.DataBind(); }
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) { FileUpload fileUp = FormView1.FindControl("f") as FileUpload; if (fileUp.HasFile) { string ext = Path.GetExtension(e.NewValues["ImageFileName"].ToString()); e.NewValues["ImageFileName"] = DateTime.Now.ToString("yyMMdd_HHmmss_ffff") + ext; string str = System.Web.HttpContext.Current.Server.MapPath("img/" + e.NewValues["ImageFileName"]); fileUp.SaveAs(str); } else { e.NewValues["ImageFileName"] = ""; } }
public void Get_CompanyBal() { if (ViewState["COMPANYDATATABLE"].ToString() != "") { DropDownList ddl = ((DropDownList)FormView1.FindControl("ddlCompanyCode")); DataTable dtCom = new DataTable(); dtCom = (DataTable)ViewState["COMPANYDATATABLE"]; dtCom.DefaultView.RowFilter = "COMPANY_CODE='" + ddl.SelectedValue + "'"; dtCom = dtCom.DefaultView.ToTable(); string amount = dtCom.Rows[0]["BALANCE_AMOUNT"].ToString(); ((TextBox)FormView1.FindControl("TXT_Current_Bal_Amt_Insert")).Text = (amount == " ") ? "0" : (amount == "") ? "0" : amount; } else { ((Label)FormView1.FindControl("lblDuplicate_INSERT")).Text = "Company not found."; } }