Пример #1
0
        public void Create(PloatBooking oPloatBooking)
        {
            using (var scope = new TransactionScope())
            {
                try
                {
                    using (var ctx = new BHGroupEntities())
                    {
                        oPloatBooking.StartDate = DateTime.Now;
                        oPloatBooking.EndDate = DateTime.Now.AddMonths(75);

                        if (oPloatBooking.PloatType == En_PloatType.WeekendHome.ToString())
                        {
                            oPloatBooking.Amt = 600000;
                            oPloatBooking.PlotDesc = "100 sq. yard Net (140 sq. yard Super Build Up)";
                        }
                        else if (oPloatBooking.PloatType == En_PloatType.Villa.ToString())
                        {
                            oPloatBooking.Amt = 600000 * 2;
                            oPloatBooking.PlotDesc = "200 sq. yard Net (280 sq. yard Super Build Up)";
                        }
                        else if (oPloatBooking.PloatType == En_PloatType.FarmHouse.ToString())
                        {
                            oPloatBooking.Amt = 600000 * 3;
                            oPloatBooking.PlotDesc = "400 sq. yard Net (420 sq. yard Super Build Up)";
                        }
                        oPloatBooking.NetAmt = (oPloatBooking.Amt * oPloatBooking.Qty);
                        ctx.PloatBookings.Add(oPloatBooking);

                        int token = 0;
                        if (oPloatBooking.PloatType == En_PloatType.WeekendHome.ToString())
                            token = 1;
                        else if (oPloatBooking.PloatType == En_PloatType.Villa.ToString())
                            token = 2;
                        else if (oPloatBooking.PloatType == En_PloatType.FarmHouse.ToString())
                            token = 3;
                        int count_token = (token * oPloatBooking.Qty);
                        for (int i = 0; i < count_token; i++)
                        {
                            DrowToken oDrow = new DrowToken();
                            oDrow.MemberId = oPloatBooking.MemberId;
                            oDrow.PlotBookingId = oPloatBooking.PloatBookingId;
                            oDrow.Status = En_DrowStatus.Active.ToString();
                            oDrow.Creaton = System.DateTime.Now;
                            oDrow.Modifiedon = System.DateTime.Now;
                            ctx.DrowTokens.Add(oDrow);
                        }
                        ctx.SaveChanges();
                        scope.Complete();
                    }
                }
                catch (Exception ex)
                {
                    scope.Dispose();
                    throw ex;
                }
            }
        }
        public ActionResult Manage(int? id)
        {
            PloatBooking model = new PloatBooking();
            ViewBag.MemberLookUp = new MemberBAL().GetMemberLookUp();
            if (id != 0 && id != null)
            {
                model = new PloatBookingBAL().GetById(id.Value);
            }

            return PartialView(model);
        }
        public JsonResult Save(PloatBooking model)
        {
            try
            {

                bool Add_Flag = new PloatBookingBAL().isNewEntry(model.PloatBookingId);
                if (Add_Flag)
                    new PloatBookingBAL().Create(model);
                else
                    new PloatBookingBAL().Update(model);

                return Json(new { success = true, message = CommonMsg.Success(EntityNames.PloatBooking, (Add_Flag == true ? En_CRUD.Insert : En_CRUD.Update)) });
            }
            catch (Exception ex)
            {
                return Json(new { success = false, message = CommonMsg.Fail(EntityNames.PloatBooking, En_CRUD.Update) });
            }
        }
Пример #4
0
 public void Update(PloatBooking oPloat)
 {
     try
     {
         using (var ctx = new BHGroupEntities())
         {
             ctx.Entry(oPloat).State = EntityState.Modified;
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }