protected void GridCuttingReservation_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow gv               = GridCuttingReservation.SelectedRow;
            int         ReservedID       = Convert.ToInt32(gv.Cells[1].Text.ToString());
            var         ReservedMaterial = db.ReservedCuttingMaterials.Where(x => x.ID == ReservedID).FirstOrDefault();
            decimal     QTY              = Convert.ToDecimal(ReservedMaterial.Quantity);
            string      ReservationNote  = ReservedMaterial.Note;
            decimal     PaidAmount       = Convert.ToDecimal(ReservedMaterial.PaidAmount);
            int         cuttingListID    = Convert.ToInt32(ReservedMaterial.CuttingMaterialID);

            ReservedMaterial.IsDeleted = true;
            var CMaterial = db.CuttingListsMaterials.Where(x => x.ID == cuttingListID).FirstOrDefault();

            CMaterial.ReservedQTY -= QTY;
            CMaterial.IsActive     = true;
            if (PaidAmount != 0)
            {
                CMaterial.Quantity += QTY;
            }

            Logger log = new Logger();

            log.Action     = "Cancel Reservation of CuttingList Material ( " + CMaterial.Material.MaterialName.ToString() + " ) in Store ( " + CMaterial.Store.StoreName.ToString() + " ) with Quantity " + QTY.ToString() + " is cancelled ";
            log.ActionDate = DateTime.Now;
            log.UserName   = User.Identity.Name;
            log.ActionType = "Cancel Reservation";
            db.Loggers.Add(log);
            db.SaveChanges();

            GridCuttingReservation.DataBind();
            GridCuttingReservation.Visible = true;
            GridMaterial.DataBind();
            GridMaterial.Visible = true;
        }
 protected void btnCancelData_Click(object sender, EventArgs e)
 {
     if (canceltype.SelectedIndex == 0)
     {
         cancelMaterialPanel.Visible = true;
         cancelCuttingPanel.Visible  = false;
         GridData.DataBind();
     }
     else if (canceltype.SelectedIndex == 1)
     {
         cancelCuttingPanel.Visible  = true;
         cancelMaterialPanel.Visible = false;
         GridCuttingReservation.DataBind();
     }
 }