protected void grdDiscos_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            foreach (DataControlFieldCell cell in grdDiscos.Rows[e.RowIndex].Cells)
            {
                for (int w = 0; w < USel.Rows.Count; w++)
                {
                    if (USel.Rows[w][0].ToString() == cell.Text)
                    {
                        BLSoftware sw     = new BLSoftware();
                        int        Srv_Id = 0;

                        int.TryParse(ddlServidor.SelectedItem.Value, out Srv_Id);

                        if (Srv_Id > 0)
                        {
                            USel.Rows[w].Delete();
                            USel.AcceptChanges();

                            ddlUnidad.DataSource = MinusDT(LetrasUnidad(), "SrvD_Unidad", USel, "SrvD_Unidad");
                            ddlUnidad.DataBind();

                            sw.BorrarDiscosServidorApp(Srv_Id, cell.Text);
                            //CargaDiscos(Srv_Id);
                            Response.Redirect("ModificarDiscos.aspx?Srv=" + Srv_Id.ToString());
                        }
                        break;
                    }
                }
            }
        }
Example #2
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string bvin = (string)GridView1.DataKeys[e.RowIndex].Value;

            MTApp.OrderServices.ShippingMethods.Delete(bvin);
            LoadMethods();
        }
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string u = Session["username"].ToString();
            string p = Session["password"].ToString();

            var = new DataTable();
            SqlDataAdapter vAR = new SqlDataAdapter("select Name from scrum_master1  where Username = '******' and Password = '******' ", con);

            vAR.Fill(var);
            if (var.Rows.Count == 0)
            {
                Response.Write("<script>alert('You are not allowed to delete')</script>");
                con.Close();
            }

            else
            {
                con.Open();
                Label      idd1 = GridView1.Rows[e.RowIndex].FindControl("idd") as Label;
                SqlCommand cmd4 = new SqlCommand(@"delete from sprints where id = '" + Convert.ToInt32(idd1.Text) + "'", con);
                cmd4.ExecuteNonQuery();

                con.Close();
                ShowData();
            }
        }
Example #4
0
        protected void dgvSliders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SliderBL sliderBL = new SliderBL();
            int status = sliderBL.DeleteSlider(int.Parse(dgvSliders.DataKeys[e.RowIndex].Values[0].ToString()));

            Response.Redirect("/administrator/sliders.aspx");
        }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int id = (int)GridView1.DataKeys[e.RowIndex].Value;
     workStation = dataWorkStation.readWorkStationEDIT(id);
     dataWorkStation.deleteWorkStation(id, workStation.IdLab);
     Response.Redirect("/CRUDWorkStation.aspx");
 }
Example #6
0
        protected void InventoryTable_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            Debug.WriteLine("InventoryTable_RowDeleting");

            if (e.Keys.Contains("IdI"))
            {
                var selectedInventoryId = (int)e.Keys["IdI"];
                Debug.WriteLine($"selectedInventoryId = {selectedInventoryId}");

                using (var db = new AGRODataContext(Server.MapPath("\\")))
                {
                    var deletingEntity = db.Inventory.FirstOrDefault(i => i.IdI == selectedInventoryId);

                    if (deletingEntity != null)
                    {
                        db.Inventory.DeleteOnSubmit(deletingEntity);
                        try
                        {
                            db.SubmitChanges();
                            BindGrid();
                        }
                        catch (Exception exception)
                        {
                            Debug.WriteLine($"Somethig wrong: {exception.Message}");
                        }
                    }
                }
            }
        }
 protected void ProductsGridView_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     string key = (string)ProductsGridView.DataKeys[e.RowIndex].Value;
     ProductFile file = MTApp.CatalogServices.ProductFiles.Find((string)ViewState["id"]);
     MTApp.CatalogServices.ProductFiles.RemoveAssociatedProduct(file.Bvin, key);
     BindProductsGrid();
 }
Example #8
0
        protected void grdGameLists_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string text = this.grdGameLists.DataKeys[e.RowIndex].Value.ToString();

            if (!string.IsNullOrEmpty(text))
            {
                try
                {
                    bool flag = GameHelper.Delete(new int[]
                    {
                        int.Parse(text)
                    });
                    if (!flag)
                    {
                        throw new System.Exception("操作失败!");
                    }
                    this.ShowMsg("操作成功!", true);
                    this.BindData();
                }
                catch (System.Exception ex)
                {
                    this.ShowMsg(ex.Message, false);
                }
            }
        }
Example #9
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            con.Open();
            Label          Id        = GridView1.Rows[e.RowIndex].FindControl("idd") as Label;
            SqlCommand     retrieve  = new SqlCommand("select Name from auth1 where id = '" + Convert.ToInt32(Id.Text) + "'", con);
            SqlDataAdapter dta       = new SqlDataAdapter();
            DataTable      dtretrive = new DataTable();

            dta.SelectCommand            = retrieve;
            dta.SelectCommand.Connection = con;
            dta.Fill(dtretrive);
            if (dtretrive.Rows.Count > 0)
            {
                string     del  = dtretrive.Rows[0][0].ToString();
                SqlCommand cmdx = new SqlCommand("delete from scrum_master1 where Name = '" + del + "'", con);
                cmdx.ExecuteNonQuery();
            }



            SqlCommand cmd4 = new SqlCommand(@"delete from auth1 where id = '" + Convert.ToInt32(Id.Text) + "'", con);

            cmd4.ExecuteNonQuery();
            con.Close();
            ShowData();
        }
Example #10
0
 private void grdProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (!this.order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
     {
         this.ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
     }
     else
     {
         if (this.order.LineItems.Values.Count <= 1)
         {
             this.ShowMsg("订单的最后一件商品不允许删除", false);
         }
         else
         {
             if (OrderHelper.DeleteLineItem(this.grdProducts.DataKeys[e.RowIndex].Value.ToString(), this.order))
             {
                 this.order = OrderHelper.GetOrderInfo(this.orderId);
                 this.BindProductList(this.order);
                 this.BindTatolAmount(this.order);
                 this.ShowMsg("成功删除了一件商品", true);
             }
             else
             {
                 this.ShowMsg("删除商品失败", false);
             }
         }
     }
 }
Example #11
0
 private void grdSuggestProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (ProductHelper.RemoveSuggestProduct((int)this.grdSuggestProducts.DataKeys[e.RowIndex].Value, ClientType.PC))
     {
         base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
     }
 }
        protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                //int id = e.RowIndex;
                //m_grid.EditIndex = id;

                //Guid delId = new Guid(m_grid.DataKeys[e.RowIndex].Value.ToString());
                //if (m_grid.DataKeys[e.RowIndex].Value.ToString() != "")
                //{
                //    clsKho objKho = new clsKho();
                //    objKho.Kho_Id = m_grid.DataKeys[e.RowIndex].Value.ToString();
                //    int status_Delete = objKho.Delete();
                //    if (status_Delete == 1)
                //    {

                //    }
                //    if (status_Delete <= 0)
                //    {

                //    }
                //}
            }
            catch (Exception ex)
            {

            }
            bindData(-1);
        }
        protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                int id = e.RowIndex;
                m_grid.EditIndex = id;

                Guid delId = new Guid(m_grid.DataKeys[e.RowIndex].Value.ToString());
                if (m_grid.DataKeys[e.RowIndex].Value.ToString() != "")
                {
                    clsThanhPhamChiTiet objThanhPhamChiTiet = new clsThanhPhamChiTiet();
                    objThanhPhamChiTiet.ThanhPhamChiTiet_Id = m_grid.DataKeys[e.RowIndex].Value.ToString();
                    int status_Delete = objThanhPhamChiTiet.Delete();
                    if (status_Delete == 1)
                    {
                        ltlAnnouncement.Text = "Xóa thành công thành phẩm chi tiết!";
                    }
                    if (status_Delete <= 0)
                    {
                        ltlAnnouncement.Text = "Không xóa được thành phẩm chi tiết đã chọn.";
                    }
                }
            }
            catch (Exception ex)
            {
                ltlAnnouncement.Text = "Lỗi trong quá trình xóa nhóm người dùng: " + ex.ToString();
            }
            bindData(-1);
        }
 protected void grDS_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int madv = int.Parse(grDS.DataKeys[e.RowIndex].Value.ToString());
     dv.XoaDonVi(madv);
     int ma = int.Parse(drNBH.SelectedValue);
     loadDS(ma);
 }
Example #15
0
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                //Store which row was clicked
                Int32 selectedRow = e.RowIndex;

                //get the selected sudent ID using the grids data key collection
                Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[selectedRow].Values["StudentID"]);

                //use entity to find the object and remove it
                using (GetWreckedEntities db = new GetWreckedEntities())
                {
                    Student s = (from objs in db.Students where objs.StudentID == StudentID select objs).FirstOrDefault();

                    //now we need to do the delete
                    db.Students.Remove(s);
                    db.SaveChanges();
                }
                //refresh the grid
                getStudents();
            }
            catch (System.Exception)
            {
                Response.Redirect("/Error.aspx");
            }
        }
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //store which row was clicked
            Int32 selectedRow = e.RowIndex;

            //get the selected StudentID using the grid's Data Key collection
            Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[selectedRow].Values["StudentID"]);

            //use EF to remove the selected student from the db
            try
            {
                using (comp2007Entities db = new comp2007Entities())
                {

                    Student s = (from objS in db.Students
                                 where objS.StudentID == StudentID
                                 select objS).FirstOrDefault();

                    //do the delete
                    db.Students.Remove(s);
                    db.SaveChanges();
                }

                //refresh the grid
                GetStudents();
            }
            catch(Exception ep)
            {
                Response.Redirect("~/ErrorPage.aspx?handler=Application_Error%20-%20Global.asax");
            }
        }
Example #17
0
        protected void grdOrders_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                //connect
                using (sales db = new sales())
                {
                    //get order id from grid
                    Int32 orderID = Convert.ToInt32(grdOrders.DataKeys[e.RowIndex].Values["orderID"]);
                    //find order
                    var order = (from o in db.Orders
                                 where o.orderID == orderID
                                 select o).FirstOrDefault();

                    //delete it
                    db.Orders.Remove(order);
                    db.SaveChanges();

                    //reload
                    getOrders();
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("/error.aspx");
            }
        }
Example #18
0
        protected void gvReviews_RowDeleting(Object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)

        {
            //get clicked row index from gridview
            int rowIndex = e.RowIndex;
            //get the review id of row clicked
            string reviewID       = gvReviews.Rows[rowIndex].Cells[ID_COL].Text;
            string restaurantName = gvReviews.Rows[rowIndex].Cells[RESTAURANT_NAME_COL].Text;

            //perform delete from database
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandType = CommandType.StoredProcedure;
            objCommand.CommandText = "DeleteReview";
            objCommand.Parameters.AddWithValue("@reviewID", Int32.Parse(reviewID));

            if (objDB.DoUpdateUsingCmdObj(objCommand) != -1)
            {
                lblDisplay.Text = "Successfully Deleted Review";
            }

            updateAverageRatings(restaurantName);
            //show new gridview with changes
            populateReviews();
        }
Example #19
0
        protected void gvAssurance_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            setAssurancedelete = e.Keys[0].ToString();
            mdlpopupmsg.Show();


        }
Example #20
0
        private void grdConfigedItems_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string openIdType = this.grdConfigedItems.DataKeys[e.RowIndex]["FullName"].ToString();

            SubSiteOpenIdHelper.DeleteSettings(openIdType);
            this.BindData();
        }
Example #21
0
 protected void GrdCamera_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     //int selectedRow = e.RowIndex;
     //Label FacilityID = (Label)grdCamera.Rows[selectedRow].FindControl("cameraID1");
     //string facilityID = FacilityID.Text;
      // BindGridView();
 }
        protected void grdActivities_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                using (DefaultConnectionAL conn = new DefaultConnectionAL())
                {
                    var user = HttpContext.Current.GetOwinContext().Authentication.User.Identity.GetUserId();

                    Int32 ActivityID = Convert.ToInt32(grdActivities.DataKeys[e.RowIndex].Values["id"]);

                    var activityItem = (from a in conn.activities
                             where a.id == ActivityID
                             select a).FirstOrDefault();
                    //save
                    conn.activities.Remove(activityItem);
                    conn.SaveChanges();

                    //redirect to updated departments page
                    GetActivities();
                }
            }
            catch (Exception e2)
            {
                Response.Redirect("~/error.aspx");
            }
        }
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                //connect
                using (DefaultConnectionEF conn = new DefaultConnectionEF())
                {
                    //get the Department Id
                    Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[e.RowIndex].Values["StudentID"]);

                    var s = (from stud in conn.Students
                             where stud.StudentID == StudentID
                             select stud).FirstOrDefault();

                    //process the delete
                    conn.Students.Remove(s);
                    conn.SaveChanges();

                    //update the grid
                    GetStudents();
                }
            }
            catch (System.IO.IOException e2)
            {
                Server.Transfer("/error.aspx", true);
            }
        }
        protected void grdDepartments_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                //connect
                using (DefaultConnectionEF conn = new DefaultConnectionEF())
                {
                    //get the selected DepartmentID
                    Int32 DepartmentID = Convert.ToInt32(grdDepartments.DataKeys[e.RowIndex].Values["DepartmentID"]);

                    var d = (from dep in conn.Departments
                             where dep.DepartmentID == DepartmentID
                             select dep).FirstOrDefault();

                    //process the delete
                    conn.Departments.Remove(d);
                    conn.SaveChanges();

                    //update the grid
                    GetDepartments();
                }
            }
            catch (System.Data.Entity.Core.EntityCommandExecutionException ECEE)
            {
                Server.Transfer("/ErrorPage.aspx", true);
            }
            catch (System.Data.SqlClient.SqlException SqlE)
            {
                Server.Transfer("/ErrorPage.aspx", true);
            }
        }
Example #25
0
        protected void grdDatos_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            ProcesarUSel();

            foreach (DataControlFieldCell cell in grdDatos.Rows[e.RowIndex].Cells)
            {
                for (int w = 0; w < USel.Rows.Count; w++)
                {
                    if (USel.Rows[w][0].ToString() == cell.Text)
                    {
                        BLCatalogos objCatalogo = new BLCatalogos();

                        USel.Rows[w].Delete();
                        USel.AcceptChanges();

                        ddlBD.DataSource = MinusDT(objCatalogo.ListaBDConServerInstanciaRel(), "AppBD_Id", USel, "AppBD_Id");
                        ddlBD.DataBind();

                        grdDatos.DataSource = USel;
                        grdDatos.DataBind();
                        break;
                    }
                }
            }
        }
Example #26
0
 private void grdTopicProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (StoreManagementHelper.RemoveReleatesProductByStore(this.StoreId, (int)this.grdTopicProducts.DataKeys[e.RowIndex].Value))
     {
         base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
     }
 }
Example #27
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            Label lbl_ID = (Label)GridView1.Rows[e.RowIndex].FindControl("lblID");

            con.Open();
            string     cmdstr = "delete from book where id=@Id";
            SqlCommand cmd    = new SqlCommand(cmdstr, con);

            cmd.Parameters.AddWithValue("@Id", lbl_ID.Text);
            int rowsAffected = cmd.ExecuteNonQuery();

            if (rowsAffected == 1)
            {
                //Adding book back to stock
                lblMesage.Visible  = true;
                lblMesage.CssClass = "alert alert-success";
                lblMesage.Text     = "Old Books more than 1 years deleted!";
            }
            else
            {
                //Error notification
                lblMesage.Visible  = true;
                lblMesage.CssClass = "alert alert-danger";
                lblMesage.Text     = "Sorry! Couldn't delete old books";
            }

            con.Close();
            gvbind();
        }
Example #28
0
        protected void gvUnvanlar_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            GridView gridView = sender as GridView;
            var      unvanId  = Convert.ToInt32(gridView.DataKeys[e.RowIndex].Values["UnvanId"]);

            using (SqlConnection dbConnection = new SqlConnection(_connString))
            {
                dbConnection.Open();
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = dbConnection;
                    command.CommandText = "DELETE FROM Unvan WHERE UnvanId = @UnvanId";
                    command.Parameters.AddWithValue("@UnvanId", unvanId);
                    try
                    {
                        command.ExecuteNonQuery();
                        Session.Add("UNVANSILINDI", "Unvan silindi.");
                    }
                    catch (SqlException ex)
                    {
                        if (ex.Message.Contains("FK_"))
                        {
                            string error = "alert('Unvan Personel tablosu tarafından kullanıldığı için silinemez.');";
                            if (!Page.ClientScript.IsStartupScriptRegistered("ErrorUnvan"))
                            {
                                ClientScript.RegisterStartupScript(GetType(), "ErrorUnvan", error, true);
                                return;
                            }
                        }
                    }
                    Response.Redirect("Unvan.aspx");
                }
            }
        }
Example #29
0
 private void grdPromotionProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (SubsitePromoteHelper.DeletePromotionProducts(this.activityId, new int?((int)this.grdPromotionProducts.DataKeys[e.RowIndex].Value)))
     {
         base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
     }
 }
Example #30
0
        protected void gvCustomFees_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if (this.Request["x"] != null && this.Request["y"] != null)
            {
                gvCustomFees.EditIndex = -1;
                RefreshFeeGrid();
            }
            else
            {

                int customFeeId = (int)gvCustomFees.DataKeys[e.RowIndex].Value;

                var fee = new CustomFee(customFeeId);

                var response = InvoicingService.RemoveCustomFee(fee);
                if (response.IsSuccessful)
                {
                    gvCustomFees.EditIndex = -1;
                    RefreshFeeGrid();

                    UserMessage.SetSuccess("Custom Fee deleted.");
                }
                else
                {
                    UserMessage.SetFailure(response.Message);
                }
            }
        }
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //get the selected studentID using the grid's data key collection
            Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[e.RowIndex].Values["StudentID"]);

            try
            {
                //use Entity Framework to remove the selected student from the db
                using (comp2007Entities db = new comp2007Entities())
                {
                    Student s = (from objS in db.Students
                                 where objS.StudentID == StudentID
                                 select objS).FirstOrDefault();

                    //do the delete
                    db.Students.Remove(s);
                    db.SaveChanges();
                }
            }
            catch (Exception)
            {
                Server.Transfer("/error.aspx");
            }

            //refresh the grid
            GetStudents();
        }
Example #32
0
        private void grdMemberList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int num = (int)this.grdMemberList.DataKeys[e.RowIndex].Value;

            base.Response.Write(num);
            base.Response.End();
            ManagerHelper.CheckPrivilege(Privilege.DeleteMember);
            if (!MemberHelper.Delete(num))
            {
                this.ShowMsg("未知错误", false);
                return;
            }
            try
            {
                this.myNotifier.updateAction  = UpdateAction.MemberUpdate;
                this.myNotifier.actionDesc    = "删除会员";
                this.myNotifier.RecDateUpdate = System.DateTime.Today;
                this.myNotifier.DataUpdated  += new StatisticNotifier.DataUpdatedEventHandler(this.myEvent.Update);
                this.myNotifier.UpdateDB();
            }
            catch (System.Exception)
            {
            }
            this.BindData();
            this.ShowMsg("成功删除了选择的会员", true);
        }
Example #33
0
        protected void grdCourses_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //get selected course ID
            Int32 CourseID = Convert.ToInt32(grdCourses.DataKeys[e.RowIndex].Values["CourseID"]);
            try
            {
                using (comp2007Entities db = new comp2007Entities())
                {
                    //get selected course
                    Course objC = (from c in db.Courses
                                   where c.CourseID == CourseID
                                   select c).FirstOrDefault();

                    //delete
                    db.Courses.Remove(objC);
                    db.SaveChanges();

                    //refresh grid
                    GetCourses();
                }
            }
            catch (Exception q)
            {
                Response.Redirect("~/error.aspx");
            }
        }
Example #34
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            int a = e.RowIndex;
            GridViewRow r = GridView1.Rows[a];
            string  x = r.Cells[1].Text;

            string q = "SELECT UsuarioId FROM Usuarios WHERE UsuarioNombre='"+x+"'";

            SqlDataAdapter adp = new SqlDataAdapter(q, con);
            DataTable tb = new DataTable();
            adp.Fill(tb);

            string id="";
            foreach (DataRow row in tb.Rows)
            {
                id = row[0].ToString();
            }

            q = "DELETE RolesXUsuario WHERE UsuarioId='" + id + "'";

            SqlCommand cmd = new SqlCommand(q, con);
            cmd.ExecuteNonQuery();

            con.Close();
        }
Example #35
0
 private void grdHomeProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (VShopHelper.RemoveHomeTopic((int)this.grdHomeTopics.DataKeys[e.RowIndex].Value))
     {
         base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
     }
 }
Example #36
0
        private void GvSearchOrder_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            GridViewRow row = gvSearchOrder.Rows[e.RowIndex];

            DtSearchOrder.Rows[row.DataItemIndex].Delete();
            gvSearchOrder.DataBind();
        }
Example #37
0
        private void grdHotKeywords_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int hid = (int)this.grdHotKeywords.DataKeys[e.RowIndex].Value;

            StoreHelper.DeleteHotKeywords(hid);
            this.BindData();
        }
Example #38
0
 protected void RepeaterTests_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     new BLL.TestComponents().DeleteTest(Tests[e.RowIndex]);
     Tests = new BLL.TestComponents().GetTests();
     RepeaterTests.DataSource = Tests;
     DataBind();
 }
 protected void grdContact_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     int id = Convert.ToInt32(commentsGrid.DataKeys[e.RowIndex].Values[0].ToString());
     var comment = new Comment(id);
     comment.Delete();
     FillGrid();
 }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            lblMensaje.Text = String.Empty;

            int intFolioSolicitud = (int)GridView1.DataKeys[e.RowIndex].Values[0];
            GridViewRow Fila = GridView1.Rows[e.RowIndex];

            NegDetalleSolicitud DetalleSolicitud = new NegDetalleSolicitud();

            int EstaTomada = DetalleSolicitud.SolicitudTomada(intFolioSolicitud);

            if (EstaTomada.Equals(0))
            {
               lblMensaje.Text = "La Solicitud con Folio " + intFolioSolicitud  +"  ya se esta ejecutando o se resolvio. No se puede anular";
               return;

            }

            NegSolicitud         NegAnulaSolicitud = new NegSolicitud();
            int existe = NegAnulaSolicitud.EstaAnulado(intFolioSolicitud);

            if (existe.Equals(0))
            {
                int id = NegAnulaSolicitud.AnulaSolicitud(intFolioSolicitud);
                lee_grilla(StrRutAlumno);
            }
            else
            {
                lblMensaje.Text = "La Solicitud con Folio " + intFolioSolicitud  +"  ya se encuentra Anulada";
                return;
            }
        }
Example #41
0
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            // identify the department id to be deleted from the row the user selected
            Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[e.RowIndex].Values["StudentID"]);
            try
            {
             //connect
            using (DefaultConnection db = new DefaultConnection())
            {
                Student stud = (from s in db.Students
                                where s.StudentID == StudentID
                                select s).FirstOrDefault();

                // delete
                db.Students.Remove(stud);
                db.SaveChanges();

                //refresh the grid
                GetStudents();
            }
            }
            catch
            {
                Response.Redirect("~/error.aspx");
            }
        }
        protected void grdCourses_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Int32 CourseID = Convert.ToInt32(grdCourses.DataKeys[e.RowIndex].Values["CourseID"]);

            using (comp2007Entities db = new comp2007Entities())
            {
                // Check for any enrollments in the course to be deleted, and remove them. Otherwise, it'll
                // throw a foreign key exception
                foreach (Enrollment en in db.Enrollments)
                {
                    if (en.CourseID == CourseID)
                    {
                        db.Enrollments.Remove(en);
                    }
                }

                // Find the selected course
                Course c = (from objS in db.Courses
                            where objS.CourseID == CourseID
                            select objS).FirstOrDefault(); // Using First would get an error if no data comes back, FirstOrDefault won't throw an error

                // Do the delete
                db.Courses.Remove(c);
                db.SaveChanges();

                //Refresh the data on the page
                GetDepartment();
            }
        }
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         objdept.ID = Convert.ToInt32(this.GridView1.DataKeys[e.RowIndex].Value);
         DataTable dtDept = dept.SelectDepartmentByID(objdept);
         employee emp = new employee();
         MEmployee objemp = new MEmployee();
         objemp.Dept = dtDept.Rows[0]["name"].ToString();
         DataTable dtEmp = emp.SelectEmployeeByDept(objemp);
         if (dtEmp.Rows.Count > 0)
         {
             string myscript = @"alert('此部门内尚有员工,不能删除!');";
             Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", myscript, true);
         }
         else
         {
             dept.DeleteDepartmentByID(objdept);
         }
         GridView1.DataSource = dept.SelectAllDepartment();
         GridView1.DataBind();
     }
     catch (Exception ex)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + ex.Message + "');</script>");
     }
 }
Example #44
0
 private void grdHomeProducts_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     if (VShopHelper.RemoveHomeTopic((int) this.grdHomeTopics.DataKeys[e.RowIndex].Value))
     {
         base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
     }
 }
Example #45
0
        protected void gvCart_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            List<CartItem> cart = (List<CartItem>)Session["cart"];

            cart.RemoveAt(e.RowIndex);
            ShowCart();
        }
 protected void gvBooks_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     GridViewRow row = gvBooks.Rows[e.RowIndex];
        TextBox txtDelete=(TextBox)row.Cells[0].Controls[0];
       BookOperation.DeleteBook(txtDelete.Text);
     gvBind();
 }
Example #47
0
        protected void grvUser_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(grvUser.DataKeys[e.RowIndex].Value);

            CustormerImpl.Instance.Delete(id);
            BindGrid();
        }
Example #48
0
        protected void grdStudents_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //store which row was clicked
            Int32 selectedRow = e.RowIndex;

            //get the selected StudentID using the grid's Data Key collection
            Int32 StudentID = Convert.ToInt32(grdStudents.DataKeys[selectedRow].Values["StudentID"]);
            try
            {
                //use EF to remove the selected student from the db
                using (DefaultConnectionEF db = new DefaultConnectionEF())
                {

                    Student s = (from objS in db.Students
                                 where objS.StudentID == StudentID
                                 select objS).FirstOrDefault();

                    //do the delete
                    db.Students.Remove(s);
                    db.SaveChanges();
                }
            }
            catch (System.Data.SqlClient.SqlException e1)
            {
                Server.Transfer("/error.aspx", true);
            }
            catch (System.Data.Entity.Core.EntityException e1)
            {
                Server.Transfer("/error.aspx", true);
            }

            //refresh the grid
            GetStudents();
        }
        protected void grdContractors_RowDeleting(object sender, GridViewDeleteEventArgs g)
        {
            try
            {
                //Store which row was clicked
                Int32 selectedRow = g.RowIndex;

                //get the selected sudent ID using the grids data key collection
                Int32 ContractorID = Convert.ToInt32(grdContractors.DataKeys[selectedRow].Values["ContractorID"]);

                //use entity to find the object and remove it
                using (ErmagerdEntities db = new ErmagerdEntities())
                {
                    Contractor j = (from objs in db.Contractors where objs.ContractorID == ContractorID select objs).FirstOrDefault();

                    //now we need to do the delete
                    db.Contractors.Remove(j);
                    db.SaveChanges();
                }
                //refresh the grid
                getContractors();
            }
            catch (FileNotFoundException e)
            {
                Server.Transfer("/ErrorPage.aspx", true);
            }
            catch (System.IO.IOException e)
            {
                Server.Transfer("/ErrorPage.aspx", true);
            }
            catch(Exception e)
            {
                Server.Transfer("/ErrorPage.aspx", true);
            }
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            if ((sender as GridView).Rows.Count > 1)
            {
                int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());

                var delTest = from test in _eJDataContext.Tests.ToList()
                              where test.Id == id
                              select test;
                _eJDataContext.Tests.DeleteOnSubmit(delTest.First());
                try
                {
                    _eJDataContext.SubmitChanges();
                }
                catch
                {
                    _eJDataContext.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges);
                    {
                        try
                        {
                            _eJDataContext.SubmitChanges();
                        }
                        catch (Exception exept)
                        {
                            Console.WriteLine("Error:  " + exept);
                        }
                    }
                }

                FillCustomerInGrid();
            }
        }
Example #51
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            //this.GridView1.Columns[2].Visible = false;
            conn.Open();
            Label l1 = GridView1.Rows[e.RowIndex].FindControl("lbl_ID") as Label;

            SqlCommand cmd = new SqlCommand("delete from tbl_medicines where MedID=@id", conn);

            //  cmd.CommandText = "delete from tbl_Pharmacy where PharmacyID=@id";
            cmd.Parameters.AddWithValue("@id", l1.Text);
            cmd.ExecuteNonQuery();

            SqlCommand cmd1 = new SqlCommand("delete from tbl_MedicinesDetails where MedID=@id", conn);

            //  cmd.CommandText = "delete from tbl_Pharmacy where PharmacyID=@id";
            cmd1.Parameters.AddWithValue("@id", l1.Text);
            cmd1.ExecuteNonQuery();

            SqlCommand cmd2 = new SqlCommand("delete from tbl_MedicinesDate where MedID=@id", conn);

            //  cmd.CommandText = "delete from tbl_Pharmacy where PharmacyID=@id";
            cmd2.Parameters.AddWithValue("@id", l1.Text);
            cmd2.ExecuteNonQuery();
            conn.Close();

            ShowData();
        }
Example #52
0
        protected void grdDepartments_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //identify the DepartmentID to be deleted from the row the user selected
            Int32 DepartmentID = Convert.ToInt32(grdDepartments.DataKeys[e.RowIndex].Values["DepartmentID"]);
            try
            {
                //connect
                using (DefaultConnection db = new DefaultConnection())
                {
                    Department dep = (from d in db.Departments
                                      where d.DepartmentID == DepartmentID
                                      select d).FirstOrDefault();

                    //delete
                    db.Departments.Remove(dep);
                    db.SaveChanges();

                    //refresh grid
                    GetDepartments();

                }
            }
            catch (Exception ex)
            {
                Response.Redirect("error.aspx");

            }
        }
Example #53
0
 private void grdProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     if (ProductHelper.RemoveProduct(this.grdProducts.DataKeys[e.RowIndex].Value.ToString()) > 0)
     {
         this.ShowMsg("删除商品成功", true);
         this.ReloadProductOnSales(false);
     }
 }
Example #54
0
        private void grdProducts_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string productIds = this.grdProducts.DataKeys[e.RowIndex].Value.ToString();

            ProductHelper.DeleteProduct(productIds, true);
            this.ShowMsg("删除商品成功", true);
            this.BindProducts();
        }
Example #55
0
        private void grdExpresscomputors_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string text = (string)this.grdExpresscomputors.DataKeys[e.RowIndex].Value;

            ExpressHelper.DeleteExpress(text);
            this.ShowMsg("删除物流公司" + text + "成功", true);
            this.LoadDataSource();
        }
Example #56
0
 protected void gvwSetObjectives_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
 {
     SPSecurity.RunWithElevatedPrivileges(delegate()
     {
         tblObjectives.Rows.RemoveAt(e.RowIndex);
         Refresh_Objectives_grid();
     });
 }
Example #57
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            this.msg.ClearMessage();
            string bvin = string.Empty;

            bvin = ((GridView)sender).DataKeys[e.RowIndex].Value.ToString();
            MTApp.ContentServices.Policies.DeleteBlock(bvin);
            LoadPolicy();
        }
Example #58
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            string bvin = string.Empty;

            //this.GridView1.UpdateAfterCallBack = true;
            bvin = ((GridView)sender).DataKeys[e.RowIndex].Value.ToString();
            MyPage.MTApp.ContentServices.Columns.DeleteBlock(bvin);
            LoadColumn();
        }
Example #59
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            GridViewRow row      = (GridViewRow)GridView1.Rows[e.RowIndex];
            int         maHoaDon = int.Parse(((Label)row.FindControl("maHoaDon")).Text);
            PhieuHd     del      = PhieuHd_BUS.GetAll().Where(m => m.MaPhieuHd == maHoaDon).FirstOrDefault();

            PhieuHd_BUS.Delete(del);
            this.BindGrid();
        }
Example #60
0
        protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            Label      idd1 = GridView1.Rows[e.RowIndex].FindControl("idd") as Label;
            SqlCommand cmd4 = new SqlCommand(@"delete from sprints where id = '" + Convert.ToInt32(idd1.Text) + "'", con);

            cmd4.ExecuteNonQuery();
            con.Close();
            ShowData();
        }