public ActionResult ConfirmTransferMoney() { if (Session["CurrentUserID"] == null) { Response.Redirect("~/Account/LoginForm"); } //If Balance is Zero or transfered money is greater than Balance, redirect TransferMoney() string WalletToTransfer = Request.Form["WalletToTransfer"]; int MemberID = Convert.ToInt32(Session["CurrentUserID"]); int Balance = db.getIntByQuery("select * from Wallet where MemberID=" + MemberID, "Balance"); int AmountToTransfer = Convert.ToInt32(Request.Form["AmountToTransfer"]); if (!(db.CheckByQuery("select * from Wallet where WalletNumber=N'" + WalletToTransfer + "'"))) { Session["TransferMoneySession"] = "invalidWallet"; return(RedirectToAction("TransferMoney")); } if (Balance == 0 || AmountToTransfer > Balance) { Session["TransferMoneySession"] = "notEnoughBalance"; return(RedirectToAction("TransferMoney")); } ViewBag.WalletToTransfer = WalletToTransfer; ViewBag.AmountToTransfer = AmountToTransfer.ToString(); return(View()); }
public ActionResult ProcessForAddEventOrgAccount() { int TownID = Convert.ToInt32(Request.Form["TownID"]); string EOrgName = Request.Form["EOrgName"]; int ECategoryID = Convert.ToInt32(Request.Form["Category"]); string ExpiredDate = Request.Form["ExpiredDate"]; DateTime EDate = Convert.ToDateTime(ExpiredDate); db.ChangeByQuery("insert into EOrg(Name, ExpiredDate, ECategoryID, TownID) values('" + EOrgName + "','" + ExpiredDate + "'," + ECategoryID + "," + TownID + ")"); int AllID = db.getIntByQuery("select * from EOrg where Name='" + EOrgName + "'", "ID"); db.ChangeByQuery("insert into Login(AllID,AccessLevel) values(" + AllID + "," + 2 + ")"); return(RedirectToAction("setEventOrgAccount", "Owner")); }
public ActionResult AddEventData(HttpPostedFileBase file, HttpPostedFileBase fileMap) { EOrgID = Convert.ToInt32(Session["CurrentUserID"]); string ImageName = ""; String ImageNameMap = ""; if (file.ContentLength > 0) { var fileName = System.IO.Path.GetFileName(file.FileName); ImageName = fileName; var path = System.IO.Path.Combine(Server.MapPath("~/Image/Cover"), fileName); file.SaveAs(path); } if (fileMap.ContentLength > 0) { var fileNameMap = System.IO.Path.GetFileName(fileMap.FileName); ImageNameMap = fileNameMap; var path = System.IO.Path.Combine(Server.MapPath("~/Image/Seat_Map"), fileNameMap); fileMap.SaveAs(path); } string Name = Request.Form["Name"]; string Category = Request.Form["Category"]; string Date = Request.Form["Date"]; string Time = Request.Form["Time"]; string Place = Request.Form["Place"]; string Email = Request.Form["Email"]; string Phone = Request.Form["Phone"]; string IsFree = Request.Form["isFree"]; string IsPublic = Request.Form["isPublic"]; string TownID = Request.Form["Town"]; string Town = d.getStringByQuery("select * from Town where ID=" + TownID, "Name"); int Row = Convert.ToInt16(Request["Row"]); int TotalTicket = 0;//Convert.ToInt32(Request.Form["TotalTicket"]); string Description = Request.Form["Description"]; //Get EOrgID. Set to 1 in unit testing int ECategoryID = Convert.ToInt32(Category); DateTime EDate = Convert.ToDateTime(Date); d.ChangeByQuery("insert into Event(EOrgID,ECategoryID,Name,ImageName,Place,EDate,Email,Phone,TotalTicket,IsFree,Description,Row,SeatMap,Time,Town,IsPublic) values(" + EOrgID + "," + ECategoryID + ",N'" + Name + "','" + ImageName + "','" + Place + "','" + EDate + "','" + Email + "','" + Phone + "','" + TotalTicket + "','" + IsFree + "','" + Description + "'," + Row + ",'" + ImageNameMap + "','" + Time + "','" + Town + "','" + IsPublic + "')"); int EID = d.getIntByQuery("select top 1 * From Event where EOrgID=" + EOrgID + " order by ID desc", "ID"); Row r = new Row(); r.set(EID, Row); //Seat s = new Seat(); //s.setTotalTicket(TotalTicket, 1); //s.setFirstTimeSeat(); return(RedirectToAction("Manage")); }
public ActionResult DeleteMember() { if (Session["CurrentUserID"] == null) { Response.Redirect("~/Account/LoginForm"); } int MemberID = Convert.ToInt32(Request.QueryString["ID"]); db.ChangeByQuery("delete from WithdrawHistory where MemberID=" + MemberID); db.ChangeByQuery("delete from Wallet where MemberID=" + MemberID); //Delete Node int Parent = db.getIntByQuery("select * from Tree where Child=" + MemberID, "Parent"); if (Parent == 0) { Parent = 80; } db.ChangeByQuery("update Tree set Parent= " + Parent + " where Parent=" + MemberID); db.ChangeByQuery("delete from Tree where Parent=" + MemberID); db.ChangeByQuery("delete from Tree where Child=" + MemberID); db.ChangeByQuery("delete from TransferHistory where MemberID=" + MemberID); db.ChangeByQuery("delete from RequestActiveDepositHistory where MemberID=" + MemberID); db.ChangeByQuery("delete from RequestActive where MemberID=" + MemberID); db.ChangeByQuery("delete from Payment where MemberID=" + MemberID); db.ChangeByQuery("delete from MemberCaptchaEmail where MemberID=" + MemberID); db.ChangeByQuery("delete from MemberBank where MemberID=" + MemberID); db.ChangeByQuery("delete from Login where AllID=" + MemberID + " and AccessLevel = 2"); db.ChangeByQuery("delete from Member where ID=" + MemberID); return(RedirectToAction("ViewAllMembers")); }
public ActionResult ProcessCustomerForm() { string Name = Request.Form["Name"]; string Phone = Request.Form["Phone"]; string Address = Request.Form["Address"]; int ShopID = Convert.ToInt32(Session["CurrentUserID"]); db.ChangeByQuery("insert into Customer values(" + ShopID + ",N'" + Name + "',N'" + Phone + "',N'" + Address + "','" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); int CustomerID = db.getIntByQuery("select * from Customer where ShopID=" + ShopID + " and Name=N'" + Name + "' and Phone=N'" + Phone + "'", "ID"); Session["CustomerID"] = CustomerID; return(RedirectToAction("HteNumberForm", "Shop")); }
public ActionResult ProcessNewCustomerForm() { if (Session["CurrentUserID"] == null) { Response.Redirect("~/Login/LoginForm"); } Boolean IsHoleSale = false; Boolean IsTest = true; int HteTypeID = Convert.ToInt32(Request.Form["HteTypeID"]); int Test = Convert.ToInt32(Request.Form["isTest"]); if (HteTypeID == 1) { IsHoleSale = true; } if (Test == 1) { IsTest = false; } string Name = Request.Form["Name"]; string Address = Request.Form["Address"]; string Phone = Request.Form["Phone"]; string Username = Request.Form["Username"]; string Password = Request.Form["Password"]; string ExpiryDate = Request.Form["ExpiryDate"]; int StaffID = Convert.ToInt32(Session["CurrentUserID"]); if (stock.CheckByQuery("select * from Shop where Name=N'" + Name + "' and Phone=N'" + Phone + "'") == false) { if (stock.CheckByQuery("select * from Login where Username=N'" + Username + "'") == false) { stock.ChangeByQuery("insert into Shop values(N'" + Name + "',N'" + Phone + "',N'" + Address + "','" + DateTime.Now.ToString("MM.dd.yyyy") + "',null,'" + IsHoleSale + "','" + IsTest + "')"); int AllID = stock.getIntByQuery("select * from Shop where Name=N'" + Name + "' and Phone=N'" + Phone + "'", "ID"); stock.ChangeByQuery("insert into Login values(" + AllID + ",N'" + Username + "',N'" + Password + "',2,'True','" + ExpiryDate + "')"); stock.ChangeByQuery("insert into StaffShop values(" + StaffID + "," + AllID + ",'" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); stock.ChangeByQuery("insert into HteAttribute values(" + AllID + ",2,950,1000,500,'" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); if (IsHoleSale == true) { stock.ChangeByQuery("insert into HteAttribute values(" + AllID + ",1,900,940,500,'" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); } } } return(RedirectToAction("AddNewCustomerForm", "Staff")); }
public ActionResult AcceptWithdrawRequest() { if (Session["CurrentUserID"] == null) { Response.Redirect("~/Account/LoginForm"); } int WithdrawHistoryID = Convert.ToInt32(Request.QueryString["ID"]); int MemberID = Convert.ToInt32(Request.QueryString["MemberID"]); int MemberBankID = db.getIntByQuery("select * from WithdrawHistory where ID=" + WithdrawHistoryID, "MemberBankID"); int BankID = db.getIntByQuery("select * from MemberBank where ID=" + MemberBankID, "BankID"); string Email = db.getStringByQuery("select * from Member where ID=" + MemberID, "Email"); int WithdrawedAmount = db.getIntByQuery("select * from WithdrawHistory where ID=" + WithdrawHistoryID, "WithdrawedAmount"); db.ChangeByQuery("update Wallet set Balance=Balance-" + WithdrawedAmount + " where MemberID=" + MemberID); db.ChangeByQuery("update WithdrawHistory set Proof='True' where ID=" + WithdrawHistoryID + " and MemberID=" + MemberID); string MailBody = "Dear " + db.getStringByQuery("select * from Member where ID=" + MemberID, "Name") + ",<br><br> We have sent " + WithdrawedAmount + "Ks to your bank account " + db.getStringByQuery("select * from Bank where ID=" + BankID, "Name") + " Account (" + db.getStringByQuery("select * from MemberBank where ID=" + MemberBankID, "AccountNumber") + ").<br><br>Kind Regards,<br>Myanmar IT Star Company Limited"; t.SendEmail("Withdraw Fund Sent-DM Group", MailBody, Email); return(RedirectToAction("WithdrawRequest")); }
public ActionResult BookSeat() { int TotalCost = 0; String TransferBill = ""; string SeatList = ""; string passedInfo = "success"; int EID = Convert.ToInt32(Request.Form["EventID"]); //Get EOrgID first via EID to retrieve its username int EOrgID = d.getIntByQuery("select * from Event where ID=" + EID, "EOrgID"); string Username = d.getStringByQuery("select * from Login where AllID=" + EOrgID + " and AccessLevel=2", "UserName"); string EOrgPhone = d.getStringByQuery("select * from Event where ID=" + EID, "Phone"); string SelectedSeat = Request.Form["SelectedSeat"]; string Name = Request.Form["Name"]; string Phone = Request.Form["Phone"]; string Operator = Request.Form["Operator"]; string[] separater = { "," }; string[] selectedSeat = SelectedSeat.Split(separater, StringSplitOptions.RemoveEmptyEntries); int i = 0; if (selectedSeat.Length > 0) { foreach (var word in selectedSeat) { //In case of two parallel action, check Seat Status (Owner is Sold and User is Book) if (d.getStringByQuery("select * from Seat where EID=" + EID + " and Name='" + selectedSeat[i] + "'", "Status").Equals("Sold")) { i = i + 1; passedInfo = "justSold"; continue; } d.ChangeByQuery("update Seat set Status='Book' where EID=" + EID + " and Name='" + selectedSeat[i] + "'"); int SeatID = d.getIntByQuery("select * from Seat where EID=" + EID + " and Name='" + selectedSeat[i] + "'", "ID"); d.ChangeByQuery("insert into CustomerTicket(Name, Phone, SeatID, InsertedDate) values(N'" + Name + "',N'" + Phone + "'," + SeatID + ",'" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "')"); TotalCost = TotalCost + d.getIntByQuery("select * from Seat where ID=" + SeatID, "Price"); SeatList = SeatList + selectedSeat[i] + "/"; i = i + 1; passedInfo = "success"; } } else { passedInfo = "noSeat"; } //Get Phone //Get Operator //amount - Total Price /* * MPT - *223*amount*number# * Ooredoo - *155*amount*number# * MEC - *110*amount*number# */ //Check Operator for tranferring phone bill if (passedInfo.Equals("success")) { if (Operator.Equals("mpt")) { TransferBill = "*223*" + TotalCost + "*" + EOrgPhone + "%23"; } else if (Operator.Equals("ooredoo")) { TransferBill = "*155*" + TotalCost + "*" + EOrgPhone + "%23"; } else if (Operator.Equals("mec")) { TransferBill = "*110*" + TotalCost + "*" + EOrgPhone + "%23"; } Session["passedInfo"] = passedInfo; string url = Session["userurl"].ToString(); ViewBag.Username = Username; ViewBag.TransferBill = TransferBill; ViewBag.FromPhone = Phone; ViewBag.ToPhone = EOrgPhone; ViewBag.TotalCost = TotalCost; ViewBag.SeatList = SeatList; return(View()); } else { Session["passedInfo"] = passedInfo; string url = Session["userurl"].ToString(); Response.Redirect(url); return(View()); } }
public ActionResult ProcessRegisterForm() { string ServerMessage = ""; int RegisterCode = Convert.ToInt32(Session["RegisterCode"]); int Code = Convert.ToInt32(Request.Form["Code"]); if (RegisterCode != Code) { Session["RegisterSession"] = "wrongEmail"; return(RedirectToAction("LoginForm")); } #region Get Form Data string Name = Request.Form["Name"]; string Phone = Request.Form["Phone"]; string Address = Request.Form["Address"]; string Email = Request.Form["Email"]; string Username = Request.Form["Username"]; string Password = Request.Form["Password"]; int ReferredCode = Convert.ToInt32(Request.Form["ReferredCode"]); string FBLink = Request.Form["FBLink"]; int TownshipID = Convert.ToInt32(Request.Form["TownshipID"]); int JobID = Convert.ToInt32(Request.Form["JobID"]); #endregion //Get Referral Code //Check Duplicate Phone and Username int RefferalCode = GetReferralCode(); if (db.CheckByQuery("select * from Member where Phone=N'" + Phone + "'")) { ServerMessage = "duplicatePhone"; } else if (db.CheckByQuery("select * from Login where Username=N'" + Username + "'")) { ServerMessage = "duplicateEmail"; } else if (db.CheckByQuery("select * from Member where Email=N'" + Email + "'")) { ServerMessage = "duplicateEmail"; } else { db.ChangeByQuery("insert into Member values(N'" + Name + "',N'" + Phone + "',N'" + Address + "','" + Email + "'," + RefferalCode + ",'" + DateTime.Now.ToString("MM.dd.yyyy") + "','" + FBLink + "','False'," + TownshipID + "," + JobID + ")"); int LastMemberID = db.getIntByQuery("select * from Member where Phone=N'" + Phone + "' and Email='" + Email + "'", "ID"); db.ChangeByQuery("insert into Login values(" + LastMemberID + ",N'" + Username + "',N'" + Password + "',2,'True','" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); //Get ID of Parent Node int Parent = db.getIntByQuery("select * from Member where ReferralCode=" + ReferredCode, "ID"); //Get TreeLevel int TreeLevel = db.getIntByQuery("select * from Tree where Parent=" + Parent, "TreeLevel"); TreeLevel = TreeLevel + 1; //Insert into Tree db.ChangeByQuery("insert into Tree values(" + Parent + "," + LastMemberID + "," + TreeLevel + ",'" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); //Create Wallet Account with 8 radom code string MemberWallet = "M" + GetRandomCodeForWallet(); db.ChangeByQuery("insert into Wallet values(" + LastMemberID + ",'" + MemberWallet + "',0,'" + DateTime.Now.ToString("MM.dd.yyyy") + "')"); ServerMessage = "successful"; } Session["RegisterSession"] = ServerMessage; if (ServerMessage == "successful") { return(RedirectToAction("LoginForm", "Account")); } else { return(RedirectToAction("RegisterForm", "Account")); } }