Ejemplo n.º 1
0
 public ActionResult SaveDiscntCharge(OrdDiscntChrge discntCharge)
 {
     if (discntCharge.Remark == null)
     {
         discntCharge.Remark = "";
     }
     if (discntCharge.Title == null || discntCharge.Title.Replace(" ", "") == "")
     {
         return(Json(new { msg = "Title required" }, JsonRequestBehavior.AllowGet));
     }
     if (discntCharge.Amt > 0 && discntCharge.Tax > 0)
     {
         return(Json(new { msg = "fill  Single Option" }, JsonRequestBehavior.AllowGet));
     }
     if (discntCharge.Amt <= 0 && discntCharge.Tax <= 0)
     {
         return(Json(new { msg = "value cannot be zero" }, JsonRequestBehavior.AllowGet));
     }
     if (discntCharge.ID > 0)// modify discnt charges
     {
         discntCharge.Save();
     }
     else if (discntCharge.OID > 0 && discntCharge.SeatingId == 0)//edit Order
     {
         discntCharge.Save();
         HG_Orders hG_Orders = new HG_Orders().GetOne(discntCharge.OID);
         if (hG_Orders.OID > 0)
         {
             if (hG_Orders.DisntChargeIDs != "" && hG_Orders.DisntChargeIDs != "0")
             {
                 hG_Orders.DisntChargeIDs = hG_Orders.DisntChargeIDs + "," + discntCharge.ID;
             }
             else
             {
                 hG_Orders.DisntChargeIDs = discntCharge.ID.ToString();
             }
             hG_Orders.Save();
         }
     }
     else if (discntCharge.OID > 0 && discntCharge.SeatingId > 0)
     {
         DiscntCharge.ListDiscntChrge.Add(discntCharge);
         OrdDiscntChrge.RemoveDiscntCharge(discntCharge.SeatingId, discntCharge.SeatingOtp, discntCharge.OID);
     }
     else
     {
         DiscntCharge.ListDiscntChrge.Add(discntCharge);
     }
     return(Json(new { data = discntCharge }, JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 2
0
        public JsonResult SaveEditOrder(Int64 OID, int PMode)
        {
            var       UserInfo = Request.Cookies["UserInfo"];
            var       UserType = UserInfo["UserType"];
            HG_Orders ObjOrder = new HG_Orders().GetOne(OID);


            if (UserType != "SA")
            {
                if (ObjOrder.Create_Date < DateTime.Now.AddDays(-2).Date)
                {
                    return(Json(new { msg = "Can't Modify Order After 2 days" }));
                }
                if (ObjOrder.PaymentStatus == 3 && PMode != ObjOrder.PaymentStatus)
                {
                    return(Json(new { msg = "Can't change Payment mode" }));
                }
                if (ObjOrder.PaymentStatus != 3 && PMode == 3)
                {
                    return(Json(new { msg = "Can't change Payment To foodDo" }));
                }
            }
            ObjOrder.PaymentStatus = PMode;
            var OrderItems             = new HG_OrderItem().GetAll(OID);
            var OrderItemsWithouTicket = OrderItems.FindAll(x => x.TickedNo == 0);

            if (OrderItemsWithouTicket.Count > 0)
            {
                List <HG_Ticket> list      = new HG_Ticket().GetAll(ObjOrder.OrgId, onDate: ObjOrder.Create_Date);
                HG_Ticket        objticket = new HG_Ticket()
                {
                    OrgId = ObjOrder.OrgId, OID = ObjOrder.OID, TicketNo = list.Count + 1, DeliveryCharge = 0, CreationDate = ObjOrder.Create_Date
                };
                int Ticketno = objticket.save();
                foreach (var OrdItem in OrderItemsWithouTicket)
                {
                    OrdItem.TickedNo = Ticketno;
                    OrdItem.Save();
                }
            }
            var CompletedCancelItems = OrderItems.FindAll(x => x.Status == 3 || x.Status == 4);

            if (ObjOrder.PaymentStatus > 0 && OrderItems.Count == CompletedCancelItems.Count)
            {
                ObjOrder.Status = "3";// mark completed
            }
            ObjOrder.Save();
            return(Json(new { data = OID }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JObject ApplyWallet(string Jobj)
        {
            JObject obj    = JObject.Parse(Jobj);
            Wallet  wallet = new Wallet();

            wallet.WalletId    = 0;
            wallet.CID         = int.Parse(obj["CID"].ToString());
            wallet.OID         = int.Parse(obj["OID"].ToString());
            wallet.CashBkId    = 0;
            wallet.CashBkAmt   = 0;
            wallet.DeductedAmt = double.Parse(obj["DeductedAmt"].ToString());;
            wallet.AmtActiveOn = DateTime.Now;
            wallet.OrgId       = int.Parse(obj["OrgId"].ToString());
            wallet.Save();
            JObject result = new JObject();


            if (wallet.WalletId > 0)
            {
                OrdDiscntChrge ordDiscntChrge = new OrdDiscntChrge();
                ordDiscntChrge.ID     = 0;
                ordDiscntChrge.Title  = "CashBack";
                ordDiscntChrge.OID    = wallet.OID;
                ordDiscntChrge.Type   = 1;
                ordDiscntChrge.Amt    = wallet.DeductedAmt;
                ordDiscntChrge.Tax    = 0;
                ordDiscntChrge.Remark = "CashBack Amount";
                ordDiscntChrge.Save();
                HG_Orders hG_Orders = new HG_Orders().GetOne(wallet.OID);
                if (hG_Orders.OID > 0)
                {
                    if (hG_Orders.DisntChargeIDs != "" && hG_Orders.DisntChargeIDs != "0")
                    {
                        hG_Orders.DisntChargeIDs = hG_Orders.DisntChargeIDs + "," + ordDiscntChrge.ID;
                    }
                    else
                    {
                        hG_Orders.DisntChargeIDs = ordDiscntChrge.ID.ToString();
                    }
                    hG_Orders.Save();
                }
                result.Add("Status", 200);
            }
            else
            {
                result.Add("Status", 400);
            }
            return(result);
        }