protected void ListView1_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     // Use the Exception property to determine whether there is an exception
     if (e.Exception == null)
     {
         // Use the AffectedRows property to double make sure that
         // the record was actually updated.
         if (e.AffectedRows == 1)
         {
             // Display a confirmation message.
             lblResult.Visible = true;
             lblResult.Text    = "The new record has been inserted successfully!";
         }
         else
         {
             // Display an error message.
             lblResult.Visible = true;
             lblResult.Text    = "An error occurred during the insert operation.";
             // When an error occurs, keep the FormView control in edit mode.
             e.KeepInInsertMode = true;
         }
     }
     else
     {
         // Display the error message
         lblResult.Visible = true;
         lblResult.Text    = e.Exception.Message;
         // Indicate that the exception has already been handled.
         e.ExceptionHandled = true;
         e.KeepInInsertMode = true;
     }
 }
Пример #2
0
        protected void lvTambahBuku_ItemInserted(object sender, ListViewInsertedEventArgs e)
        {
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;
                ltKeterangan.Text  = "<span class='alert alert-danger'>" + e.Exception.Message + "</span>";
            }
            else
            {
                //upload pic
                try
                {
                    FileUpload fpUpload  = (FileUpload)lvTambahBuku.InsertItem.FindControl("fpCoverPic");
                    string     strRandom = Guid.NewGuid().ToString() +
                                           Path.GetExtension(fpUpload.FileName);
                    string strUpload = Path.Combine("~/Images", strRandom);
                    strUpload = MapPath(strUpload);
                    fpUpload.SaveAs(strUpload);

                    //update ke table Buku ubah nama CoverPic sesuai nama random yang dimasukan
                    TextBox txtKodeBuku = (TextBox)lvTambahBuku.InsertItem.FindControl("txtKodeBuku");
                    sdsBuku.UpdateParameters[0].DefaultValue = strRandom;
                    sdsBuku.UpdateParameters[1].DefaultValue = txtKodeBuku.Text;
                    sdsBuku.Update();
                    ltKeterangan.Text = "<span class='alert alert-success'>Data buku berhasil ditambah </span>";
                }
                catch (Exception ex)
                {
                    ltKeterangan.Text = "<span class='alert alert-danger'>" + ex.Message + "</span>";
                }
            }
        }
Пример #3
0
 protected void membersList_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     if (e.Exception == null)
     {
         membersList.InsertItemPosition = InsertItemPosition.None;
     }
 }
Пример #4
0
 protected void lvScreen_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     if (e.Exception != null)
     {
         lblError.Text      = "A database error has occurred. " + e.Exception.Message;
         e.ExceptionHandled = true;
     }
 }
 protected void ListView1_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     if (e.Exception != null)
     {
         e.ExceptionHandled = true;
         Response.Write("<script type='text/javascript'> alert('" + e.Exception.Message + "')) </script>");
     }
 }
Пример #6
0
    protected void Roles_ListView_ItemInserted(object sender, ListViewInsertedEventArgs e)
    {
        if (!(e.Exception == null))
        {
            ErrMessage_Span.InnerHtml        = "Ha ocurrido un error al intentar actualizar la información (<b>nota</b>: es probable que la información que Ud. está indicando ya exista).<br />El mensaje específico de error es: <br /><br />" + e.Exception.InnerException.Message;
            ErrMessage_Span.Style["display"] = "block";

            e.ExceptionHandled = true;
            e.KeepInInsertMode = true;
        }
    }
Пример #7
0
    protected void PeriodosVencimiento_ListView_ItemInserted(object sender, ListViewInsertedEventArgs e)
    {
        if  (e.Exception != null)
            {
                ErrorMessage_Span.InnerHtml = "Ha ocurrido un error al intentar agregar un registro. <br />Lo más probable es que el registro que se intenta agregar ya exite.";
                ErrorMessage_Span.Style["display"] = "block";

                e.ExceptionHandled = true;
                e.KeepInInsertMode = true;

                return;
            }
    }
Пример #8
0
    protected void PresupuestoCodigos_ListView_ItemInserted(object sender, ListViewInsertedEventArgs e)
    {
        if (((e.Exception != null) && !e.ExceptionHandled))
        {
            // idealmente, este error, de dynamic data, debería ser mostrado en un DynamicValidator; sin
            // enbargo, nunca fuimos capaces de lograrlo; por eso lo mostramos así:

            ErrMessage_Span.InnerHtml        = e.Exception.Message;
            ErrMessage_Span.Style["display"] = "block";

            e.ExceptionHandled = true;
            e.KeepInInsertMode = true;
        }
    }
Пример #9
0
        protected void lvStudents_ItemInserted(object sender, ListViewInsertedEventArgs e) //change schema to support fname lname composite key for student
        {
            var li = e.Values.Values;

            String[] vals  = li.OfType <String>().ToArray();
            var      lname = vals[0];
            var      fname = vals[1];

            try
            {
                //update db
                var item = (from s in db.Students
                            where (s.Stu_Fname == fname && s.Stu_Lname == lname)
                            select s).FirstOrDefault();

                item.Stu_Pic = Convert.ToString(Session["FileName"]);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                //lblMessage.Text = ex.Message;
            }
        }
Пример #10
0
    void Posts_ItemInserted(object sender, ListViewInsertedEventArgs e)
    {
        if (!Topic.User.IsLoggedOn)
        {
            //only subscribe once
            if (FudgeUser.IsOptionSet(FudgeDatabase.User.UserOptions.AutomaticallySubscribeToTopicsIReplyTo) &&
                !FudgeUser.IsSubscribedTo(Topic.TopicId))
            {
                //subscribe
                FudgeUser.SubscribeForReplies(Topic.TopicId);
            }

            var subscriptions = from s in db.TopicSubscriptions
                                where s.TopicId == Topic.TopicId && s.UserId != FudgeUser.UserId && s.UserId != Topic.UserId
                                select s;

            foreach (var s in subscriptions)
            {
                Email.NotifyNotMyTopicReply.Send(s.User, FudgeUser.FirstName + " replied to " + Topic.Title,
                                                 FudgeUser.FirstName, Topic.Title, Topic.TopicId);
            }
        }

        if (!Topic.User.IsLoggedOn && Topic.User.IsSubscribedTo(Topic.TopicId))
        {
            //send notification to the topic owner
            Notification.Notify(Notification.TopicReply(Topic.TopicId));

            //send and email
            Email.NotifyTopicReply.Send(Topic.User, FudgeUser.FirstName + " replied to your post!",
                                        FudgeUser.FirstName, Topic.Title, Topic.TopicId);
        }
        //go to the last page
        int lastPage = (postsPager.TotalRowCount / postsPager.PageSize) + 1;

        postsPager.CurrentPage = lastPage;
    }
Пример #11
0
 protected void ListViewCustomers_ItemInserted(object sender,
                                               ListViewInsertedEventArgs e)
 {
     this.ListViewCustomers.InsertItemPosition = InsertItemPosition.None;
 }
Пример #12
0
 protected void RoleListView_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     DataBind();
 }
Пример #13
0
 protected void lsvDatos_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     lsvDatos.InsertItemPosition = InsertItemPosition.None;
 }
        protected void _listviewEquipCtgryCRUD_ItemInserted(object sender, ListViewInsertedEventArgs e)
        {
            string scriptText = "alert('Record Inserted '); window.location='" + Request.ApplicationPath + "EquipmentCategory.aspx'";

            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", scriptText, true);
        }
Пример #15
0
 protected void UnorderedCart_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
 }
Пример #16
0
 protected override void OnItemInserted(ListViewInsertedEventArgs e)
 {
     RecordEvent("Enter");
     base.OnItemInserted(e);
     RecordEvent("Leave");
 }
Пример #17
0
 protected void TodosListView_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     this.TodosListView.InsertItemPosition = InsertItemPosition.None;
 }
Пример #18
0
 protected void LVPatients_OnItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     //
 }
Пример #19
0
 protected void productList_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
 }
Пример #20
0
    protected void ListView1_ItemInserted(object sender, ListViewInsertedEventArgs e)
    {
        // This function runs AFTER the insertion has completed.

        // This if statement checks if there were any issues when the user tried
        // to insert something. Generally, it will catch if they try to create
        // a blank row.
        if (e.Exception != null)
        {
            if (e.AffectedRows == 0)
            {
                e.KeepInInsertMode = true;
                Message.Text       = "An exception occurred inserting the new Department. " +
                                     "Please verify your values and try again.";
            }
            else
            {
                Message.Text = "An exception occurred inserting the new Department. " +
                               "Please verify the values in the newly inserted item.";
            }

            e.ExceptionHandled = true;
        }
        else
        {
            /*
             * Now that a new department has been created, we need to set the current user (the creator)
             * as an admin for the department. If we do not set the permissions now, then the user will
             * not be able to access the department again.
             *
             * Since the current user is creating this department, it is safe to assume that they will
             * be acting as the admin. Because of that, we set all of this user's permissions to True
             * for this department.
             */

            // Get last inserted item from current user
            string DepartmentID = GetInsertedDepartmentID();

            // Stores the UserID from the session storage.
            string UserID = Session["UserID"].ToString();

            // This creates an insert command for the UserDepartmentPermissions table, which accepts
            // a foreign key from User and a foreign key from Department.
            SqlDataSource2.InsertCommandType = SqlDataSourceCommandType.Text;
            SqlDataSource2.InsertCommand     = "INSERT INTO UserDepartmentPermissions (UserID, DepartmentID, Can_Read, Can_Edit, Can_Schedule, Is_Admin) VALUES (@User_ID, @Department_ID, @Can_Read, @Can_Edit, @Can_Schedule, @Is_Admin)";

            // The symbols with @s in the InsertCommand string are parameters, which we add to the collection here.
            SqlDataSource2.InsertParameters.Add("User_ID", UserID);
            SqlDataSource2.InsertParameters.Add("Department_ID", DepartmentID);
            // Once again, we are setting all of the permissions to True. Permissions are stored
            // as a BIT type in the database, so we use 1 and 0 to represent the booleans.
            SqlDataSource2.InsertParameters.Add("Can_Read", 1.ToString());
            SqlDataSource2.InsertParameters.Add("Can_Edit", 1.ToString());
            SqlDataSource2.InsertParameters.Add("Can_Schedule", 1.ToString());
            SqlDataSource2.InsertParameters.Add("Is_Admin", 1.ToString());

            // This runs the completed insert command.
            SqlDataSource2.Insert();

            // Now that the user has proper permissions, we can display the link to allow them to add members to their
            // new department.
            addLink.Text = "<a class=\"nav-btn yellow\" href=\"AddMembers.aspx?dept=" + DepartmentID + "\">Add Members to Department</a>";
        }
    }
Пример #21
0
        protected void ListViewComments_ItemInserted(object sender, ListViewInsertedEventArgs e)
        {
            ListView listviewCommentsControl = (ListView)this.FormViewPost.FindControl("ListViewComments");

            listviewCommentsControl.InsertItemPosition = InsertItemPosition.None;
        }
Пример #22
0
 protected void ListViewMain_OnItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     this.ListViewMain.DataBind();
 }
Пример #23
0
 protected void ListViewTodoLists_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     this.ListViewTodoLists.InsertItemPosition = InsertItemPosition.None;
     this.ListViewTodoLists.DataBind();
 }
Пример #24
0
 protected void lvCartas_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
 }
Пример #25
0
 protected void CategoriesList_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     this.CategoriesList.InsertItemPosition = InsertItemPosition.None;
 }
Пример #26
0
 protected void lvStage_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
 }
Пример #27
0
 protected void ABR_ItemInserted(object sender, ListViewInsertedEventArgs e)
 {
     Response.Redirect("./#abr");
 }