Beispiel #1
0
 protected void ShowShoppingbag_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteMedicineFromShoppingBag")
     {
         ShoppingBag       sb        = (ShoppingBag)Session["myShoppingBag"];
         int               rowNumber = Convert.ToInt32(e.CommandArgument);
         MedicineInBag     MIB       = new MedicineInBag();
         Pharmcy.PharmcyWS webser    = new Pharmcy.PharmcyWS();
         MIB.CMedicineId = ShowShoppingbag.Rows[rowNumber].Cells[0].Text;
         MIB.CMedicineNeedPrescription = webser.GetMedicineNeedPres(Convert.ToInt32(MIB.CMedicineId));
         if (MIB.CMedicineNeedPrescription)
         {
             List <DataSet> presList = (List <DataSet>)Session["presList"];
             foreach (DataSet d in presList)
             {
                 if (d.Tables[0].Rows[0]["PrescriptionMedicineId"].ToString() == MIB.CMedicineId)
                 {
                     presList.Remove(d);
                     Session["presList"] = presList;
                     break;
                 }
             }
         }
         sb.DeleteMedicineFromList(MIB);
         Session["myShoppingBag"] = sb;
         Response.Write("<script>alert('המוצר נמחק בהצלחה')</script>");
         showShoppingBag(sb);
     }
 }