public int UpdateCardNumber(CardRegistration cardRegistration) { try { Query = @"UPDATE CardReg SET [Number] = @Number WHERE Id = '" + cardRegistration.Id + "'"; Command.CommandText = Query; Command.Connection = Connection; Command.Parameters.Clear(); Command.Parameters.Add("Number", SqlDbType.VarChar); Command.Parameters["Number"].Value = cardRegistration.Number; Connection.Open(); int rowsAffected = Command.ExecuteNonQuery(); return(rowsAffected); } catch (Exception exception) { return(0); } finally { Connection.Close(); } }
public async Task AddCardNext(SocketGuildUser target, [Remainder] string str) { ContextIds idList = new ContextIds(Context); var user = UserHandler.GetUser(target.Id); idList.UserId = user.UserId; //Tests each case to make sure all circumstances for the execution of this command are valid (character exists, in correct location) try { await UserHandler.UserInCombat(idList); } catch (InvalidUserStateException) { return; } var card = CardRegistration.RegisterCard(str); var nick = Context.Guild.GetUser(user.UserId).Nickname; if (nick == null) { card.Signature = Context.Guild.GetUser(user.UserId).Username; } else { card.Signature = nick; } card.Owner = user.UserId; user.ActiveCards.Add(card); await MessageHandler.SendMessage(idList, $"Added card {user.ActiveCards[user.ActiveCards.Count-1].Name} to registration."); }
public int Save(CardRegistration cardRegistration) { try { Query = "INSERT INTO CardReg(Number, Status) VALUES(@Number, @Status)"; Command.CommandText = Query; Command.Connection = Connection; Command.Parameters.Clear(); Command.Parameters.Add("Number", SqlDbType.VarChar); Command.Parameters["Number"].Value = cardRegistration.Number; Command.Parameters.Add("Status", SqlDbType.VarChar); Command.Parameters["Status"].Value = cardRegistration.Status; Connection.Open(); int rowsAffected = Command.ExecuteNonQuery(); return(rowsAffected); } catch (Exception exception) { return(0); } finally { Connection.Close(); } }
public CardRegistration GetCardNumberById(int?id) { try { Query = "SELECT * FROM CardReg Where Id = " + id + ""; Command.CommandText = Query; Command.Connection = Connection; Connection.Open(); Reader = Command.ExecuteReader(); CardRegistration cardRegistrations = new CardRegistration(); if (Reader.HasRows) { while (Reader.Read()) { CardRegistration cardRegistration = new CardRegistration(); cardRegistration.Id = Convert.ToInt32(Reader["Id"]); cardRegistration.Number = Reader["Number"].ToString(); cardRegistrations = cardRegistration; } Reader.Close(); } return(cardRegistrations); } catch (Exception exception) { return(null); } finally { Connection.Close(); } }
public ActionResult UpdateProfile(CardRegistration card) { bool success = false; string Message = ""; try { card.CardNumber = Session["User"].ToString(); if (card.updateProfile()) { success = true; Message = "Profile Updated Successfully"; } else { success = false; Message = "Profile Updation Failed"; } } catch { success = false; Message = "Something Unexpected Happened"; } return(Json(new { success = success, Message = Message })); }
public ActionResult GetCards(string policyNumber) { CardRegistration card = new CardRegistration(); return(Json( card.getPolicyCards(policyNumber), JsonRequestBehavior.AllowGet)); }
public ActionResult UpdatePin(string pin) { bool success = false; string Message = ""; try { CardRegistration card = new CardRegistration(); card = card.getCardInfo(Session["User"].ToString()); if (card.PIN == pin) { if (card.updatePin(pin, Session["User"].ToString())) { success = true; Message = "Pin Updated Successfully"; } else { success = false; Message = "Pin Updation Failed"; } } else { success = false; Message = "Invalid Old PIN"; } } catch { success = false; Message = "Something Unexpected Happened"; } return(Json(new { success = success, Message = Message })); }
public ActionResult Save(CardRegistration card) { bool Success = false; string Message = ""; try { card.userType = "Corporate"; if (card.Save()) { Success = true; Message = "User Registered Successfully"; } else { Success = false; Message = "User Registeration Failed"; } } catch { Success = false; Message = "Something Unexpected Happened"; } return(Json(new { Success = Success, Message = Message })); }
public List <CardRegistration> GetAllCardRegistrations() { try { Query = "SELECT*FROM CardReg Where Status = '" + "Inactive" + "'"; Command.CommandText = Query; Command.Connection = Connection; Connection.Open(); Reader = Command.ExecuteReader(); List <CardRegistration> cardRegistrations = new List <CardRegistration>(); if (Reader.HasRows) { while (Reader.Read()) { CardRegistration cardRegistration = new CardRegistration(); cardRegistration.Id = Convert.ToInt32(Reader["Id"].ToString()); cardRegistration.Number = Reader["Number"].ToString(); cardRegistrations.Add(cardRegistration); } Reader.Close(); } return(cardRegistrations); } catch (Exception exception) { return(null); } finally { Connection.Close(); } }
public ActionResult Recharge(Recharge r) { bool success = false; string message = ""; r.RechargeDate = DateTime.Now; r.RechargeTime = DateTime.Now.ToShortTimeString(); CardRegistration c = new CardRegistration(); c = c.getCardInfo(Session["User"].ToString()); r.CardNumber = c.CardNumber; r.RechargedBy = "User"; r.CardType = c.CardType; r.mop = "Online"; if (r.makeRecharge() && c.UpdateBalanceCredit(r.Amount)) { success = true; message = "Recharge Done"; } else { success = false; message = "Recharge Failed"; } return(Json(new { success = success, message = message })); }
public ActionResult GreetUser() { CardRegistration card = new CardRegistration(); card = card.getCardInfo(Session["User"].ToString()); return(Content("Welcome " + card.Name.Split(' ')[0])); }
public async Task RegisterCard([Remainder] string str) { ContextIds idList = new ContextIds(Context); var user = UserHandler.GetUser(idList.UserId); //Tests each case to make sure all circumstances for the execution of this command are valid (character exists, in correct location) try { await UserHandler.UserInCombat(idList); } catch (InvalidUserStateException) { return; } var card = CardRegistration.RegisterCard(str); if (card.RequiresCelestial && !user.Celestial && !card.Hidden) { await MessageHandler.SendMessage(idList, "That card requires Celestial rank."); return; } else if (card.Hidden && !user.Celestial) { card = CardRegistration.RegisterCard("default"); } if (card.Disabled) { await MessageHandler.SendMessage(idList, "That card has been temporarily disabled."); return; } var nick = Context.Guild.GetUser(Context.User.Id).Nickname; if (nick == null) { card.Signature = Context.User.Username; } else { card.Signature = nick; } card.Owner = user.UserId; if (user.ActiveCards.Count == 0) { user.ActiveCards.Add(card); } else { user.ActiveCards[0] = card; } await MessageHandler.SendMessage(idList, $"Registered as {user.ActiveCards[0].Name}."); }
public ActionResult Index() { CardType ct = new CardType(); CardRegistration c = new CardRegistration(); c.CardTypes = ct.getCardTypes(); return(View(c)); }
public bool checkBalance(BillingViewModel bvm) { CardRegistration card = new CardRegistration(); Dictionary <string, decimal> result = bvm.caluclations(card.getCardInfo(bvm.cardNumber)); return(( result["totalAfterDiscount"] + result["taxVal"]) < (result["cardBalance"] - result["minBal"])); }
public bool Save(CardRegistration cardRegistration) { if (IsNumberExists(cardRegistration.Number)) { throw new Exception("Sorry!!!Card Number Already Exists"); } return(cardRegistrationGateway.Save(cardRegistration) > 0); }
public ActionResult validateCard(string id) { CardRegistration card = new CardRegistration(); if (card.check(id)) { card = card.getCardInfo(id); } return(Json(new { isValid = card.check(id), data = card }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetPackages(string Type = "Basic") { CardRegistration user = new CardRegistration(); user = user.getCardInfo(Session["User"].ToString()); Package p = new Package(); return(Json(p.getPackages_cardType(user.CardType) .Where(x => x.Type == Type).ToList(), JsonRequestBehavior.AllowGet)); }
public bool GenerateBill(ref string invNumber, Shop shop) { CardRegistration card = new CardRegistration(); card = card.getCardInfo(this.cardNumber); Dictionary <string, decimal> calResults = caluclations(card); BillingChild billChild = new BillingChild(); BillingMain billMain = new BillingMain(); int billcount = billMain.getBillCount(shop.ShopNumber); int todaysBillCount = billMain.getTodaysBillCount(shop.ShopNumber); invNumber = "YON" + DateTime.Now.Year + "-" + (billcount + 1); billMain.invoiceNumber = invNumber; billMain.billedDate = DateTime.Now; billMain.time = DateTime.Now.ToShortTimeString(); billMain.shopNumber = shop.ShopNumber; billMain.GST_amt = calResults["taxVal"]; billMain.totalAmount = calResults["totalWithoutTax"]; billMain.discount = card.Discount; billMain.CGST_amt = calResults["taxVal"] / 2; billMain.SGST_amt = calResults["taxVal"] / 2; billMain.cardNumber = card.CardNumber; billMain.name = card.Name; billMain.phoneNumber = card.PhoneNumber; billMain.netAmount = calResults["totalAfterDiscount"] + calResults["taxVal"]; billMain.order_number = todaysBillCount + 1; billMain.billedBy = shop.Owner; List <bool> results = new List <bool>(); results.Add(billMain.newBill()); string financialYear = billMain.getLastFinancialYear(shop.ShopNumber); foreach (var bi in this.billItems) { billChild.financialYear = financialYear; billChild.invoiceNumber = invNumber; billChild.BilledDate = DateTime.Now; billChild.shopNumber = shop.ShopNumber; billChild.itemName = bi.itemName; billChild.quantity = bi.qty; billChild.price = bi.Price; billChild.total = bi.totalWithoutTax; billChild.totalWithTax = bi.total; billChild.gst = bi.gst; billChild.cgst = bi.gst / 2; billChild.sgst = bi.gst / 2; billChild.gst_amt = bi.totalWithoutTax - bi.total; billChild.cgst_amt = (bi.total - bi.totalWithoutTax) / 2; billChild.sgst_amt = (bi.total - bi.totalWithoutTax) / 2; billChild.slno = billItems.IndexOf(bi) + 1; results.Add(billChild.addBillItem()); } results.Add(card.UpdateBalanceDebit(calResults["totalAfterDiscount"] + calResults["taxVal"])); return(!results.Contains(false)); }
// GET: User public ActionResult UpdateProfile() { if (Session["User"] == null) { return(RedirectToAction("Index", "Home")); } CardRegistration card = new CardRegistration(); card = card.getCardInfo(Session["User"].ToString()); return(View(card)); }
public async Task CheckCardInfo([Remainder] string str) { ContextIds idList = new ContextIds(Context); var user = UserHandler.GetUser(idList.UserId); var card = CardRegistration.RegisterCard(str); if (card.Hidden && !user.Celestial) { card = CardRegistration.RegisterCard("vrfamily"); } await MessageHandler.SendEmbedMessage(idList, "", OsirisEmbedBuilder.CardList(card)); }
// GET: UserTransaction public ActionResult Index() { if (Session["User"] == null) { return(RedirectToAction("Index", "Home")); } CardRegistration user = new CardRegistration(); user = user.getCardInfo(Session["User"].ToString()); return(View(new UserTransactionViewModel() { User = user } )); }
// GET: CorpCardRegistration public ActionResult Index(string pn) { if (string.IsNullOrEmpty(pn)) { return(RedirectToAction("Index", "Policy")); } CardRegistration card = new CardRegistration(); Policy p = new Policy(); p = p.getPolicyByNumber(pn)[0]; card.PolicyNumber = pn; card.NumberOfCardsIssued = card.getCount(card.PolicyNumber); card.TotalNumberofcards = p.NumberOfCards; return(View(card)); }
public ActionResult Index(string FromDate, string ToDate) { if (Session["User"] == null) { return(RedirectToAction("Index", "Home")); } CardRegistration user = new CardRegistration(); user = user.getCardInfo(Session["User"].ToString()); return(View(new UserTransactionViewModel() { User = user, UserTransactions = new UserTransaction().getUserTransactionsBetweenDates( user.CardNumber, FromDate, ToDate) })); }
public ActionResult AddCard(CardRegistration Card) { bool Success = false; string Message = ""; try { Policy p = new Policy(); p = p.getPolicyByNumber(Card.PolicyNumber)[0]; CardType ct = new CardType(); ct = ct.getCardTypeByName(p.CardType); int cardCount = Card.getCount(Card.PolicyNumber); if (cardCount != p.NumberOfCards) { Card.CardType = p.CardType; Card.Value = ct.value.ToString(); Card.isActive = true; Card.PIN = new Random().Next(1000, 9999).ToString(); if (Card.Register()) { Success = true; Message = cardCount + " Card(s) Issued out of " + p.NumberOfCards + " cards"; } else { Success = false; Message = "Card Registration failed "; } } else { Success = false; Message = "Card Registration Limit Reached"; } } catch { Success = false; Message = "Something unexpected Happened"; } return(Json(new { Success = Success, Message = Message })); }
public ActionResult Register(CardRegistration Card) { bool Success = false; CardType ct = new CardType(); ct = ct.getCardTypeByName(Card.CardType); Card.Value = ct.value.ToString(); Card.PIN = new Random().Next(1000, 9999).ToString(); Card.userType = "Walkin"; Card.regDate = DateTime.Now.ToShortDateString(); Card.Validity = DateTime.Now.AddYears(1).ToShortDateString(); if (Card.RegisterWalkin()) { Success = true; } else { Success = false; } return(Json(new { Success = Success, data = Card }, JsonRequestBehavior.AllowGet)); }
public List <CardRegistration> ShowAllCardNumber() { try { Query = "SELECT*FROM CardReg"; Command.CommandText = Query; Command.Connection = Connection; Connection.Open(); Reader = Command.ExecuteReader(); List <CardRegistration> cardDivisions = new List <CardRegistration>(); int number = 1; if (Reader.HasRows) { while (Reader.Read()) { CardRegistration cardRegistration = new CardRegistration(); cardRegistration.Id = Convert.ToInt32(Reader["Id"].ToString()); cardRegistration.Number = Reader["Number"].ToString(); cardRegistration.Status = Reader["Status"].ToString(); cardRegistration.SNumber = number; cardDivisions.Add(cardRegistration); number++; } Reader.Close(); } return(cardDivisions); } catch (Exception exception) { return(null); } finally { Connection.Close(); } }
public Dictionary <string, decimal> caluclations(CardRegistration card) { decimal minBal = (decimal.Parse(card.Value) * 10) / 100; decimal total = 0; decimal totalWithTax = 0; foreach (var billItem in this.billItems) { total += billItem.totalWithoutTax; totalWithTax += billItem.total; } decimal taxVal = totalWithTax - total; decimal totalAfterDiscount = total - ((total * card.Discount) / 100); Dictionary <string, decimal> dictResult = new Dictionary <string, decimal>(); dictResult.Add("totalAfterDiscount", totalAfterDiscount); dictResult.Add("totalWithoutTax", total); dictResult.Add("taxVal", taxVal); dictResult.Add("cardBalance", card.Balance); dictResult.Add("minBal", minBal); return(dictResult); }
// GET: EmployeeRegistration public ActionResult Index() { CardRegistration card = new CardRegistration(); return(View(card)); }
public CardRegistration PostCard(CardRegistration cardRegistration, string userId = null) { var uri = CreateUri(userId, ""); return(PostAsync(uri, cardRegistration)); }
public ActionResult ActivateAccount(string cardNumber) { CardRegistration card = new CardRegistration(); return(Json(new { success = card.acivateAccount(cardNumber) })); }