public ActionResult GetCustomerList() { vw_HG_UsersDetails Objuser = new vw_HG_UsersDetails(); List <vw_HG_UsersDetails> listUser = Objuser.GetAll(Type: "CUST"); return(View(listUser)); }
public ActionResult CreateEdit(vw_HG_UsersDetails Objuser) { if (Objuser.EMail == null) { Objuser.EMail = ""; } if (Objuser.UserType != "A" && Objuser.UserType != "SA") { if (Objuser.OrgID <= 0) { return(Json(new { msg = "Please Select Organization First" })); } } vw_HG_UsersDetails ObjUserAlreadyExist = new vw_HG_UsersDetails().MobileAlreadyExist(Objuser.UserId); if (ObjUserAlreadyExist.UserCode > 0 && ObjUserAlreadyExist.UserCode != Objuser.UserCode) { return(Json(new { msg = "User Id Already Taken" })); } HG_UserTypes objUserType = new HG_UserTypes().GetOne(0, Objuser.UserType); int i = Objuser.save(); Objuser.UserType = objUserType.UserTypeName; if (i > 0) { return(Json(new { data = Objuser }, JsonRequestBehavior.AllowGet)); } return(RedirectToAction("Error")); }
public JObject GetNameByMobileNo(string MobileNo) { JObject result = new JObject(); vw_HG_UsersDetails ObjUser = new vw_HG_UsersDetails().MobileAlreadyExist(MobileNo); if (ObjUser != null && ObjUser.UserCode > 0) { result.Add("Status", 200); result.Add("CName", ObjUser.UserName); return(result); } else { LocalContacts localContacts = LocalContacts.GetOne(Mobile: MobileNo); if (localContacts != null && localContacts.ContctID > 0) { result.Add("Status", 200); result.Add("CName", localContacts.Cust_Name); return(result); } else { result.Add("Status", 400); return(result); } } }
public ActionResult CreateEdit(int ID) { vw_HG_UsersDetails Objuser = new vw_HG_UsersDetails(); if (ID > 0) { Objuser = Objuser.GetSingleByUserId(ID); } return(View(Objuser)); }
public JObject RatingApplied(int CID) { JObject result = new JObject(); vw_HG_UsersDetails ObjUser = new vw_HG_UsersDetails().GetSingleByUserId(CID); if (ObjUser.UserCode > 0) { ObjUser.RateNow = 1; ObjUser.save(); result.Add("Status", 200); } else { result.Add("Status", 400); } return(result); }
public ActionResult LoginPost(vw_HG_UsersDetails Obj) { Obj = Obj.Checkvw_HG_UsersDetails(); if (Obj != null && Obj.UserType != "CUST" && Obj.UserType != "CA" && Obj.UserType != "CH") { HttpCookie cookie = new HttpCookie("UserInfo"); cookie.Values.Add("UserCode", Obj.UserCode.ToString()); cookie.Values.Add("UserName", Obj.UserName); cookie.Values.Add("UserType", Obj.UserType); cookie.Values.Add("OrgId", Obj.OrgID.ToString()); Response.Cookies.Add(cookie); // return RedirectToAction("Admin"); return(Json(new { url = "/vw_HG_UsersDetails/Admin" })); } else { return(Json(new { msg = "Invalid Credential" })); } }
// GET: AdminApi public JObject GetSeating(int OrgId = 0) { List <HG_Items> ListItems = new List <HG_Items>(); List <HG_Category> MenuList = new List <HG_Category>(); if (OrgId <= 0) { OrgId = OrderType.CurrOrgId(); } if (OrgId > 0) { ListItems = new HG_Items().GetAll(OrgId); ListItems = ListItems.FindAll(x => x.ItemAvaibility == 0);// only available items MenuList = new HG_Category().GetAll(OrgId: OrgId); } JObject ProcedureParm = new JObject(); var CurrDate = DateTime.Now; var Todate = new DateTime(CurrDate.Year, CurrDate.Month, CurrDate.Day, 23, 59, 00); ProcedureParm.Add("FromDate", CurrDate.ToString("MM/dd/yyyy")); ProcedureParm.Add("Todate", Todate.ToString("MM/dd/yyyy HH:mm:ss")); ProcedureParm.Add("Orgid", OrgId); List <TblData> RunningOrds = TblData.GetAll("GetRunningOrder", ProcedureParm); HG_OrganizationDetails ObjOrg = new HG_OrganizationDetails().GetOne(OrgId); List <Seating> Listseating = Seating.GetSeating(OrgId); JObject JobjResonse = new JObject(); JArray SeatingArray = new JArray(); JArray TakeAwayItem = new JArray(); List <HG_Floor_or_ScreenMaster> FlrScr = new HG_Floor_or_ScreenMaster().GetAll(int.Parse(ObjOrg.OrgTypes), OrgId); foreach (var ObjSeating in Listseating) { JObject jObject = new JObject(); jObject.Add("Table_or_SheetName", ObjSeating.Seatting); jObject.Add("Table_or_RowID", ObjSeating.SeatId); jObject.Add("Otp", ObjSeating.Otp); jObject.Add("SeatName", ObjSeating.SeatName); jObject.Add("ScrnFlr", ObjSeating.FSName); jObject.Add("RowSide", ObjSeating.RowSideName); jObject.Add("Floor_or_ScreenId", ObjSeating.FSIS); JArray MenuJarray = new JArray(); var order = RunningOrds.Find(x => x.getVal <Int64>("Table_or_SheatId") == ObjSeating.SeatId && x.getVal <int>("TableOtp") == ObjSeating.Otp); if (order != null && order.getVal <Int64>("OID") > 0) { jObject.Add("CurrOID", order.getVal <Int64>("OID")); jObject.Add("Status", 3);//table is booked } else { jObject.Add("CurrOID", 0); jObject.Add("Status", 1);//table is free; } double CurrentTableAmt = 0.00; string Cmobile = ""; string Cname = ""; int ContactId = 0; if (order != null) { if (order.getVal <int>("ContactId") > 0) { LocalContacts localContacts = LocalContacts.GetOne(order.getVal <int>("ContactId")); Cmobile = localContacts.MobileNo; Cname = localContacts.Cust_Name; ContactId = localContacts.ContctID; } else { vw_HG_UsersDetails ObjUser = new vw_HG_UsersDetails().GetSingleByUserId((int)order.getVal <Int64>("CID")); if (ObjUser != null && ObjUser.UserCode > 0 && ObjUser.UserType == "CUST") { Cmobile = ObjUser.UserId; Cname = ObjUser.UserName; ContactId = -1;// minus show dont edit this. Order Palced By Customer } } if (order.getVal <int>("PaymentStatus") == 0) { CurrentTableAmt += order.getVal <double>("OrdAmt"); } } if (ObjSeating.FSIS > 0) // not takeaway { jObject.Add("Type", 1); //Seat and table; List <OrderMenuCategory> ListCategry = OrderMenuCategory.GetAll(ObjSeating.OMID); List <OrdMenuCtgItems> ListMenuItems = OrdMenuCtgItems.GetAll(ObjSeating.OMID); ListCategry = ListCategry.FindAll(x => x.Status == true); ListCategry = ListCategry.OrderBy(x => x.OrderNo).ToList(); ListMenuItems = ListMenuItems.FindAll(x => x.Status == true); HashSet <int> ItemIdHash = new HashSet <int>(ListItems.Select(x => x.ItemID).ToArray()); ListMenuItems = ListMenuItems.FindAll(x => ItemIdHash.Contains((int)x.ItemId)); int count = 0; foreach (var OrderMenuObj in ListCategry) { double MenuItemPrice = 0.00; var OrderMenuItems = ListMenuItems.FindAll(x => x.OrdMenuCatId == OrderMenuObj.id); if (OrderMenuItems.Count > 0) { JObject JobjMenu = new JObject(); JArray jarrayItem = new JArray(); JobjMenu.Add("MenuId", OrderMenuObj.CategoryId); JobjMenu.Add("Name", OrderMenuObj.DisplayName); JobjMenu.Add("MenuIndex", count++); int ItemiIndex = 0; OrderMenuItems = OrderMenuItems.OrderBy(x => x.OrderNo).ToList(); foreach (var MenuItmObj in OrderMenuItems) { var Items = ListItems.Find(x => x.ItemID == MenuItmObj.ItemId); int CurrCount = 0; JObject objItem = new JObject(); objItem.Add("IID", Items.ItemID); objItem.Add("ItemName", Items.Items); objItem.Add("ItemPrice", Items.Price); objItem.Add("ItemQuntity", Items.Qty); objItem.Add("ItemImage", Items.Image); objItem.Add("ItemCartValue", CurrCount); objItem.Add("MenuId", Items.CategoryID); objItem.Add("ItemIndex", ItemiIndex++); objItem.Add("ItemMode", Items.ItemMode); objItem.Add("CostPrice", Items.CostPrice);// without gst objItem.Add("Tax", Items.Tax); objItem.Add("Info", Items.ItemDiscription); //check addon or Serving Size or Both apply in current item List <AddOnn> Addons = AddOns.GetAddonsAndMultiSSize(Items); if (Addons.Count > 0) { objItem.Add("Addons", JArray.FromObject(Addons)); } jarrayItem.Add(objItem); MenuItemPrice += Items.Price * CurrCount; } JobjMenu.Add("MenuItemCount", OrderMenuItems.Count); JobjMenu.Add("MenuItems", jarrayItem); // JobjMenu.Add("MenuItmPrice", MenuItemPrice); //JobjMenu.Add("TableAmt", CurrentTableAmt); JobjMenu.Add("ContactId", ContactId); JobjMenu.Add("Mobile", Cmobile); JobjMenu.Add("CName", Cname); MenuJarray.Add(JobjMenu); } } } else { jObject.Add("Type", 3);//take away if (TakeAwayItem.Count == 0) { int count = 0; foreach (HG_Category menu in MenuList) { double MenuItemPrice = 0.00; List <HG_Items> ItemListByMenu = ListItems.FindAll(x => x.CategoryID == menu.CategoryID); if (ItemListByMenu.Count > 0) { JObject JobjMenu = new JObject(); JArray jarrayItem = new JArray(); JobjMenu.Add("MenuId", menu.CategoryID); JobjMenu.Add("Name", menu.Category); JobjMenu.Add("MenuIndex", count++); int ItemiIndex = 0; foreach (var Items in ItemListByMenu) { int CurrCount = 0; JObject objItem = new JObject(); objItem.Add("IID", Items.ItemID); objItem.Add("ItemName", Items.Items); objItem.Add("ItemPrice", Items.Price); objItem.Add("ItemQuntity", Items.Qty); objItem.Add("ItemImage", Items.Image); objItem.Add("ItemCartValue", CurrCount); objItem.Add("MenuId", Items.CategoryID); objItem.Add("ItemIndex", ItemiIndex++); objItem.Add("CostPrice", Items.CostPrice);// without gst objItem.Add("Tax", Items.Tax); objItem.Add("ItemMode", Items.ItemMode); objItem.Add("Info", Items.ItemDiscription); //check addon or Serving Size or Both apply in current item List <AddOnn> Addons = AddOns.GetAddonsAndMultiSSize(Items); if (Addons.Count > 0) { objItem.Add("Addons", JArray.FromObject(Addons)); } jarrayItem.Add(objItem); MenuItemPrice += Items.Price * CurrCount; } JobjMenu.Add("MenuItemCount", ItemListByMenu.Count); JobjMenu.Add("MenuItems", jarrayItem); //JobjMenu.Add("MenuItmPrice", MenuItemPrice); //JobjMenu.Add("TableAmt", CurrentTableAmt); JobjMenu.Add("ContactId", ContactId); JobjMenu.Add("Mobile", Cmobile); JobjMenu.Add("CName", Cname); TakeAwayItem.Add(JobjMenu); } } } MenuJarray = TakeAwayItem; } jObject.Add("MenuItems", MenuJarray); jObject.Add("SeatingAmt", CurrentTableAmt); SeatingArray.Add(jObject); } JobjResonse.Add("Seating", SeatingArray); JobjResonse.Add("FlrScrList", JArray.FromObject(FlrScr)); JobjResonse.Add("UserCode", OrderType.UserCode()); JobjResonse.Add("OrgType", ObjOrg.OrgTypes);// restuarant / theataer JobjResonse.Add("OrgId", OrgId); return(JobjResonse); }
public static void AddToWallet(HG_Orders ObjOrder, int AppType = 0) { if (ObjOrder.Status != "3") { return; } if (AppType == 1) { } else if (ObjOrder.Status == "3") { vw_HG_UsersDetails ObjUser = new vw_HG_UsersDetails().GetSingleByUserId((int)ObjOrder.CID); if (ObjUser.UserType != "CUST") { return; } } Cashback cashbk = Cashback.GetAppliedCashBk(ObjOrder.OrgId, ObjOrder.Table_or_SheatId, 1); if (cashbk != null) { double cashBkAmt = 0.00; if (cashbk.Percentage > 0 && cashbk.RaiseDynamic) { double OrdAmt = HG_Orders.OrderAmt(ObjOrder.OID, ObjOrder.DeliveryCharge); var AggStudy = GetOrder.GetTotalAmt(ObjOrder.OrgId); double DynamicValue = AggStudy + (AggStudy - cashbk.BilAmt) * (cashbk.Percentage * 2 / 100); if (DynamicValue > cashbk.BilAmt && OrdAmt > DynamicValue) { cashBkAmt = OrdAmt * cashbk.Percentage / 100; } else if (OrdAmt > cashbk.BilAmt) { cashBkAmt = OrdAmt * cashbk.Percentage / 100; } } else if (cashbk.Percentage > 0 && cashbk.RaiseDynamic == false) { double OrdAmt = HG_Orders.OrderAmt(ObjOrder.OID, ObjOrder.DeliveryCharge); // cashBkAmt = OrdAmt * cashbk.Percentage / 100; if (OrdAmt > cashbk.BilAmt && cashbk.MaxCBLimit == 0)//unlimited; { cashBkAmt = OrdAmt * cashbk.Percentage / 100; } else if (OrdAmt > cashbk.BilAmt && cashbk.MaxCBLimit == 1)// limited { cashBkAmt = OrdAmt * cashbk.Percentage / 100; if (cashBkAmt > cashbk.MaxAmt) { cashBkAmt = cashbk.MaxAmt; } } } if (cashBkAmt > 0) { Wallet wallet = new Wallet(); wallet.AmtActiveOn = DateTime.Now.AddDays(1); wallet.CID = (int)ObjOrder.CID; wallet.OID = ObjOrder.OID; wallet.OrgId = ObjOrder.OrgId; wallet.DeductedAmt = 0; wallet.CashBkAmt = cashBkAmt; wallet.CashBkId = cashbk.CashBkId; wallet.Save(); string[] topics = { ObjOrder.CID.ToString() }; string Title = "foodDo"; string Msg = "You Got " + cashBkAmt.ToString("0.00") + " Rs/- Cashback "; PushNotification.SendNotification(topics, Msg, Title, OID: ObjOrder.OID, UserRating: 400);//user-Rating 400 for cashbk notification } } }