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 ProcessApplyOrgAccount() { string Info = "success"; string Name = Request.Form["Name"]; int TownID = Convert.ToInt32(Request.Form["TownID"]); int ECategory = Convert.ToInt32(Request.Form["Category"]); string Email = Request.Form["Email"]; string Phone = Request.Form["Phone"]; string Version = Request.Form["Version"]; string AccountType = Request.Form["AccountType"]; //Check with phone number. Insert into AppliedAccount. if (db.CheckByQuery("select * from EOrg where Phone='" + Phone + "'") || db.CheckByQuery("select * from AppliedAccount where Phone='" + Phone + "'")) { Info = "duplicatePhone"; } else { db.ChangeByQuery("insert into AppliedAccount(Name, TownID, ECategoryID, Email, Phone, Version, AccountType) values(N'" + Name + "'," + TownID + "," + ECategory + ",'" + Email + "','" + Phone + "','" + Version + "','" + AccountType + "')"); } Session["Info"] = Info; string url = Session["appliedAccountUrl"].ToString(); Response.Redirect(url); return(View()); }
public ActionResult ProcessHteNumberForm() { if (Session["CurrentUserID"] == null) { Response.Redirect("~/Login/LoginForm"); } int ShopID = Convert.ToInt32(Session["CurrentUserID"]); int CustomerID = Convert.ToInt32(Session["CustomerID"]); int HteTypeID = 2; string No = Request.Form["No"]; No = No.Replace(" ", string.Empty); No = No.Replace("-", string.Empty); No = No.Replace("_", string.Empty); No = No.Replace("\'", string.Empty); No = No.Replace("-", string.Empty); No = No.Replace("\\", string.Empty); No = No.Replace("\\/", string.Empty); No = No.Replace("။", string.Empty); No = No.Replace("၊", string.Empty); No = No.Replace(":", string.Empty); No = No.Replace(";", string.Empty); No = No.Replace("0", "၀"); No = No.Replace("1", "၁"); No = No.Replace("2", "၂"); No = No.Replace("3", "၃"); No = No.Replace("4", "၄"); No = No.Replace("5", "၅"); No = No.Replace("6", "၆"); No = No.Replace("7", "၇"); No = No.Replace("8", "၈"); No = No.Replace("9", "၉"); int CostPrice = db.getIntByQuery("select * from HteAttribute where HteTypeID=" + HteTypeID + " and ShopID=" + ShopID, "CostPrice"); int Profit = db.getIntByQuery("select * from HteAttribute where HteTypeID=" + HteTypeID + " and ShopID=" + ShopID, "SellingPrice") - CostPrice; if (!(db.CheckByQuery("select * from HteNumber where CustomerID= " + CustomerID + " and No LIKE N'" + No + "%'"))) { db.ChangeByQuery("insert into HteNumber values(" + ShopID + "," + CustomerID + ",N'" + No + "','" + DateTime.Now.ToString("MM.dd.yyyy") + "'," + HteTypeID + "," + Profit + "," + CostPrice + ")"); db.ChangeByQuery("update HteAttribute set Quantity = Quantity-1 where ShopID=" + ShopID + " and HteTypeID=2"); } 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 Manage() { EOrgID = Convert.ToInt32(Session["CurrentUserID"]); //Check if there is event or not. Retrieve EOrgID from Session. if (d.CheckByQuery("select * from Event where EOrgID=" + EOrgID) == false) { return(RedirectToAction("NotFound")); } return(View()); }
public ActionResult ProcessSecretCodeForm() { int SecretCode = Convert.ToInt32(Request.Form["SecretCode"]); if (db.CheckByQuery("select * from Secret where Code=" + SecretCode)) { return(RedirectToAction("ClickSection")); } Session["SecretCodeSession"] = "wrong"; return(RedirectToAction("SecreteCodeForm")); }
public ActionResult ProcessAddContactShop() { string Name = Request.Form["Name"]; string Phone = Request.Form["Phone"]; if (!(db.CheckByQuery("select * from ContactShop where Phone='" + Phone + "'"))) { int InternStaffID = Convert.ToInt32(Request.Form["InternStaffID"]); db.ChangeByQuery("insert into ContactShop values(N'" + Name + "',N'" + Phone + "',null,'new',null,'" + DateTime.Now.ToString("MM.dd.yyyy") + "'," + InternStaffID + ")"); } return(RedirectToAction("AddContactShop", "MyanmarITStar")); }
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")); } }