Пример #1
0
 protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     if (e.Exception == null || e.ExceptionHandled)
     {
         Response.Redirect(table.ListActionPath);
     }
 }
Пример #2
0
        protected void societaUpdate(object sender, DetailsViewUpdatedEventArgs e)
        {
            try
            {
                //quando faccio update per la societa sistemo l'username per l'utente
                string username = e.NewValues["email"].ToString();
                SqlCommand qUp = new SqlCommand();
                qUp.Connection = conn;

                conn.Open();

                qUp.CommandType = CommandType.StoredProcedure;
                qUp.CommandText = "updateUsername";
                qUp.Parameters.Add(new SqlParameter("idSocieta", idSocieta));
                qUp.Parameters.Add(new SqlParameter("username", username));

                qUp.ExecuteNonQuery();

                result.Text = "Società aggiornata correttamente";
                dettaglioUtente.DataBind();
            }
            catch (Exception ex)
            {
                result.Text = "Si è verificato un errore durante la query: " + ex.Message;
            }
        }
 protected void dlStudentTravelEvents_ItemUpdated(object sender, System.Web.UI.WebControls.DetailsViewUpdatedEventArgs e)
 {
     StrssMessage = "Item Updated Successfully";
     StrssCSS     = "alert-success";
     //Asignar valor a las parametros del metodo WriteLogProc
     strEvento = "ItemUpdated";
     WriteLognRedirect();
 }
Пример #4
0
        protected void DetailsViewEditItem_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            if (e.Exception == null)
            {

            }
            else
            {
                ShowError(e.Exception);
                e.ExceptionHandled = true;
            }
        }
Пример #5
0
        /// <summary>
        /// Event fired after update of Wine Details View
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void dvwWine_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            CheckBoxList cblAttributes = (CheckBoxList)dvwWine.FindControl("cblAttributes");
            if (cblAttributes != null)
            {
                ClearAttributeAssignments(Convert.ToInt32(e.Keys[0]));
                SetAttributeAssignments(cblAttributes, Convert.ToInt32(e.Keys[0]));
            }

            //redirect to the manage wines screen
            Response.Redirect("/GUI/WineDatabase/ManageWines.aspx");
        }
Пример #6
0
        protected void BankAccountDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            UserBL userBL = new UserBL();

            string accountname = userBL.GetBankAccountName();

            if (accountname != null)
            {
                TextBox pe = (TextBox)CompanyDetailsView.FindControl("BankAccountTextBox");
                pe.Text = accountname;

            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModal('BodyContent_ModalPanel1');", true);
        }
 protected void dvCustomerSelect_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     if (e.Exception != null)
     {
         lblDbError.Visible = true;
         lblDbError.Text = "A database error occured. Message: " + e.Exception.Message;
         e.ExceptionHandled = true;
         e.KeepInEditMode = true;
     }
     else if (e.AffectedRows == 0)
     {
         lblDbError.Visible = true;
         lblDbError.Text = "Another user may have updated this entry already";
     }
 }
        protected void CompanyDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            long id = 0;
            string value = Convert.ToString(Session["NewCompany"]);
            if (value != "")
                id = int.Parse(value);

            if (id > 0)
            {
                Label1.Text = "Success !</br> <p>Company information has been updated successfully</p>";
                UpdatePanel1.Update();
            }
            else
            {
                Label1.Text = "Error !</br> <p>Company information did not save.</p>";
                UpdatePanel1.Update();
            }
        }
 /// <summary>
 /// Handles the ItemUpdated event of the dvCustomers control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.DetailsViewUpdatedEventArgs"/> instance containing the event data.</param>
 protected void dvCustomers_ItemUpdated(object sender, System.Web.UI.WebControls.DetailsViewUpdatedEventArgs e)
 {
     if (e.Exception != null)
     {
         this.lblError.Text = "A database error has occurred. "
                              + "Message: " + e.Exception.Message;
         e.ExceptionHandled = true;
         e.KeepInEditMode   = true;
     }
     else if (e.AffectedRows == 0)
     {
         this.lblError.Text = "Another user may have updated that customer. " + "Please try again";
     }
     else
     {
         this.gvCustomers.DataBind();
     }
 }
        protected String DataValidation(DetailsViewUpdatedEventArgs e)
        {
            decimal testfield = 0m;
            if (!(Decimal.TryParse(e.NewValues["UnitPrice"].ToString(), out testfield)))
            {
                lblError.ForeColor = System.Drawing.Color.Red;
                lblError.Text = "Unit Price must be numeric ";
            }

            if (!(Decimal.TryParse(e.NewValues["OnHand"].ToString(), out testfield)))
            {
                lblError.ForeColor = System.Drawing.Color.Red;
                lblError.Text = "Inventory On Hand must be numeric ";
            }

            int number;
            if (!(Int32.TryParse(e.NewValues["OnHand"].ToString(), out number)))
            {
                lblError.ForeColor = System.Drawing.Color.Red;
                lblError.Text = "On Hand field must be an Integer ";
            }

            return lblError.Text;
        }
Пример #11
0
 // now we have added the Partial class to Linq generate class,
 // let's try to handle that gracefully
 protected void detailsEmployee_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     if (e.Exception != null)
     {
         // Has to enable EnableUpdate in DetailsView, otherwise, it goes to linqException branch.
         LinqDataSourceValidationException linqException = e.Exception as LinqDataSourceValidationException;
         if (linqException == null)
         {
             lblError.Text = "Data Error";
         }
         else
         {
             // to display all the validation error
             lblError.Text = "";
             foreach (Exception err in linqException.InnerExceptions.Values)
                 lblError.Text += err.Message + "<br />";
         }
         e.ExceptionHandled = true;
     }
     else
     {
         gridEmployees.DataBind();
     }
 }
Пример #12
0
        protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            //Update Available days for the Booking Object
                                    //Get parameters

                                    int BookingObjectId = Convert.ToInt32(DetailsView1.DataKey.Value);

                                    //Delete current information
                                    SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ABSConnectionString"].ToString());
                                    SqlCommand cmd = new SqlCommand("DELETE FROM BookingObjectWorkingDay WHERE BookingObjectId = @BookingObjectId", conn);
                                    cmd.Parameters.AddWithValue("@BookingObjectId", BookingObjectId);

                                    conn.Open();
                                    cmd.ExecuteNonQuery();

                                    GridView AvailableDays = DetailsView1.FindControl("GridView2") as GridView;

                                    //Check Availability for each of the days and add to database
                                    foreach (GridViewRow row in AvailableDays.Rows)
                                    {
                                                if (row.RowType == DataControlRowType.DataRow)
                                                {
                                                            int WorkingDayId = row.RowIndex + 1; //Set Day
                                                            if (((CheckBox)row.FindControl("AvailabilityCheck")).Checked == true)
                                                            {
                                                                        SqlCommand insertCmd = new SqlCommand("INSERT INTO BookingObjectWorkingDay  (BookingObjectId, WorkingDayId) VALUES (@BookingObjectId, @WorkingDayId)", conn);
                                                                        insertCmd.Parameters.AddWithValue("@BookingObjectId", BookingObjectId);
                                                                        insertCmd.Parameters.AddWithValue("@WorkingDayId", WorkingDayId);
                                                                        insertCmd.ExecuteNonQuery();
                                                            }
                                                }
                                    }

                                    conn.Close();
                                    Server.Transfer("Manage_Rooms.aspx");
        }
 protected void dv_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     this.gv.SelectedIndex = -1;
     this.gv.DataBind();
 }
Пример #14
0
        protected void MeetingDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            if (e.Exception != null)
            {
                var customValidator = new CustomValidator();
                customValidator.IsValid = false;
                customValidator.ErrorMessage = "Save failed: " + e.Exception.InnerException.Message;
                customValidator.ValidationGroup = "sum";
                Page.Validators.Add(customValidator);
                e.ExceptionHandled = true;
            }
            else
            {
                string meetingSubject = e.NewValues["Subject"].ToString();
                int rowcount = e.AffectedRows;
                if (rowcount == -1)
                {
                    string mailresult = String.Empty;

                    if (Session["toUser"] != null)
                    {
                        string usertname = String.Empty;
                        long recentmeetingID = Convert.ToInt64(Session["NewMeeting"]);
                        ListDictionary templateValues = new ListDictionary();
                        string subject = e.NewValues["Subject"].ToString();
                        string startDate = e.NewValues["StartDate"].ToString();
                        string endDate = e.NewValues["EndDate"].ToString();
                        string location = e.NewValues["Location"].ToString();

                        long uid = Convert.ToInt64(e.NewValues["ModifiedBy"]);
                        IEnumerable<User> userdetails = userBL.GetUsersByID(uid);

                        foreach (var name in userdetails)
                        {
                            usertname = name.FirstName;
                        }
                        templateValues.Add("<%=CreatedBy%>", usertname);
                        templateValues.Add("<%=Subject%>", subject);
                        templateValues.Add("<%=StartDate%>", startDate);
                        templateValues.Add("<%=EndDate%>", endDate);
                        templateValues.Add("<%=Location%>", location);

                        string emailAdd = Session["toUser"].ToString();
                        string attendees = emailAdd.TrimEnd(';');

                        if (attendees.Contains(';'))
                        {
                            string[] emails = attendees.Split(';');
                            foreach (string email in emails)
                            {
                                string receiver = email;
                                C3App.App_Code.Notification.Notify("Meeting", recentmeetingID, 1, receiver, 4, templateValues);
                                mailresult = "and mail successfully sent";
                            }
                        }
                        else
                        {
                            if (attendees != string.Empty)
                            {
                                C3App.App_Code.Notification.Notify("Meeting", recentmeetingID, 1, attendees, 4, templateValues);
                                mailresult = "and mail successfully sent";
                            }
                        }
                        long meetingID = Convert.ToInt64(Session["NewMeeting"]);
                        const string inviteeType = "Contacts";
                        string allInvitee = Session["targetID"].ToString().TrimEnd(';');
                        string[] invitees = allInvitee.Split(';');
                        foreach (string invitee in invitees)
                        {
                            long inviteeID = Convert.ToInt64(invitee);
                            meetingBL.SaveMeetingInvitees(meetingID, inviteeID, inviteeType);
                        }
                        Session["toUser"] = "";
                        Session["targetID"] = 0;

                    }
                    else
                    {
                        mailresult = "but not selecected any meeting invitee";
                    }

                    MessageLiteral.Text = "Success <br /><p> Meeting on " + meetingSubject + " has been updated " + mailresult + " </p>";
                    ViewMeetingsGridView.DataBind();
                    WeeklyMeetingGridView.DataBind();
                    MiniDetailsUpdatePanel.Update();
                    Session["NewMeeting"] = 0;

                }
                else
                {
                    MessageLiteral.Text = "Sorry, update failed <br /> <p> Please try again</p>";
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "ShowAlertModal();", true);

                this.MeetingDetailsView.DataBind();
                this.ContactGridView.DataBind();
                this.ViewMeetingsGridView.DataBind();
                this.WeeklyMeetingGridView.DataBind();

                MeetingDetailsView.ChangeMode(DetailsViewMode.Insert);

                MeetingTargetListUpdatePanel.Update();
                MiniDetailsUpdatePanel.Update();

            }
        }
        protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
        {
            if (e.Exception != null)
            {
                lblError.Text = "A database error has occurred. " +
                    "Message: " + e.Exception.Message;
                e.ExceptionHandled = true;
                e.KeepInEditMode = true;
                lblError.Text = DataValidation(e);

                //decimal testfield = 0m;
                //if (!(Decimal.TryParse(e.NewValues["UnitPrice"].ToString(), out testfield)))
                //    lblError.Text = "Unit Price not numeric ";

            }
            else if (e.AffectedRows == 0)
                lblError.Text = "Another user may have updated that product. " +
                    "Please try again. ";
            else
            {
                lblError.Text = "Record was successfully updated. ";
                GridView1.DataBind();
            }
        }
Пример #16
0
 protected void dvCurrComment_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     gvAllComments.SelectedIndex = -1;
     gvAllComments.DataBind();
 }
 protected void dvwComment_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     CancelCurrentEdit();
 }
 protected void dvwOrderStatus_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     gvwOrderStatuses.SelectedIndex = -1;
      gvwOrderStatuses.DataBind();
 }
Пример #19
0
 protected void DetailsView_ItemUpdated(Object sender, DetailsViewUpdatedEventArgs e)
 {
     //        DeviceGridView.DataBind();
 }
Пример #20
0
 protected void UpdateSparse_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     //      SparesGridView.DataBind();
 }
Пример #21
0
 protected void _DetailsView_ItemUpdated(Object sender, DetailsViewUpdatedEventArgs e)
 {
     OpertsGridView.DataBind();
 }
 protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
 }
Пример #23
0
        protected void dvSelectedBook_ItemUpdated( object sender, DetailsViewUpdatedEventArgs e )
        {
            int bookId = (int) dvSelectedBook.DataKey.Value;

            CheckBoxList cbl = dvSelectedBook.FindControl( "cblDVBookThemes" ) as CheckBoxList;
            if( cbl != null )
            {
                List<int> themeIDs = new List<int>();
                foreach( ListItem item in cbl.Items )
                {
                    if( item.Selected )
                        themeIDs.Add( Convert.ToInt32( item.Value ) );
                }

                Book.SetThemes( bookId, themeIDs.ToArray() );
            }

            gvBooks.SelectedIndex = -1;
            gvBooks.DataBind();
        }
		void dv_ItemUpdated (object sender, DetailsViewUpdatedEventArgs e)
		{
			itemUpdated = true;
		}
		static void d_ItemUpdated (object sender, DetailsViewUpdatedEventArgs e)
		{
			if (WebTest.CurrentTest.UserData == null) {
				ArrayList list = new ArrayList ();
				list.Add ("ItemUpdated");
				WebTest.CurrentTest.UserData = list;
			}
			else {
				ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
				if (list == null)
					throw new NullReferenceException ();
				list.Add ("ItemUpdated");
				WebTest.CurrentTest.UserData = list;
			}
		}
Пример #26
0
 protected void dvArticle_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     lblStatus.Text = "Статья успешно обновлена.";
     lblStatus.Visible = true;
 }
 protected void UserProfile_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     SettingsUpdatedMessage.Visible = true;
 }
Пример #28
0
        private bool HandleUpdateCallback(int affectedRows, Exception ex) {
            DetailsViewUpdatedEventArgs dea = new DetailsViewUpdatedEventArgs(affectedRows, ex);
            dea.SetOldValues(_updateOldValues);
            dea.SetNewValues(_updateNewValues);
            dea.SetKeys(_updateKeys);

            OnItemUpdated(dea);

            _updateKeys = null;
            _updateOldValues = null;
            _updateNewValues = null;

            if (ex != null && !dea.ExceptionHandled) {
                // If there is no validator in the validation group that could make sense
                // of the error, return false to proceed with standard exception handling.
                // But if there is one, we want to let it display its error instead of throwing.
                if (PageIsValidAfterModelException()) {
                    return false;
                }
                dea.KeepInEditMode = true;
            }

            if (IsUsingModelBinders && !Page.ModelState.IsValid) {
                dea.KeepInEditMode = true;
            }

            if (!dea.KeepInEditMode) {
                DetailsViewModeEventArgs eMode = new DetailsViewModeEventArgs(DefaultMode, false);
                OnModeChanging(eMode);
                if (!eMode.Cancel) {
                    Mode = eMode.NewMode;
                    OnModeChanged(EventArgs.Empty);
                    RequiresDataBinding = true;
                }
            }
            return true;
        }
Пример #29
0
 /// <devdoc>
 /// <para>Raises the <see langword='ItemUpdated '/>event.</para>
 /// </devdoc>
 protected virtual void OnItemUpdated(DetailsViewUpdatedEventArgs e) {
     DetailsViewUpdatedEventHandler handler = (DetailsViewUpdatedEventHandler)Events[EventItemUpdated];
     if (handler != null) handler(this, e);
 }
			public void DoOnItemUpdated (DetailsViewUpdatedEventArgs  e)
			{
				OnItemUpdated(e);
			}
 protected void OnDetailsViewItemUpdated(object sender, DetailsViewUpdatedEventArgs e) {
     ChildrenGridView.DataBind();
 }
 protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
 {
     GridView1.DataBind();
 }
 protected virtual new void OnItemUpdated(DetailsViewUpdatedEventArgs e)
 {
 }