public int AddAccType(AccType _AccType) { try { var _max = _IUoW.Repository <AccType>().GetMaxValue(x => x.AccTypeId) + 1; _AccType.AccTypeId = _max.ToString().PadLeft(3, '0'); _AccType.AuthStatusId = "U"; _AccType.LastAction = "ADD"; _AccType.MakeBy = "mTaka"; _AccType.MakeDT = System.DateTime.Now; var result = _IUoW.Repository <AccType>().Add(_AccType); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; _IAuthLogService.AddAuthLog(_IUoW, null, _AccType, "ADD", "0001", _AccType.FunctionId, 1, "AccType", "MTK_SP_ACC_TYPE", "AccTypeId", _AccType.AccTypeId, _AccType.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddAccType(obj)", string.Empty); return(0); } }
public void Interest(EmpFields emp) { Console.Write("Enter your Id : "); emp.AccId = Convert.ToInt32(Console.ReadLine()); result = Search(emp.AccId, con); string[] tokens = result.Split(','); balance = Convert.ToInt32(tokens[0]); if (balance < 0) { Console.WriteLine(" No record found with this Account Id. Please try again...."); } else { AccType = tokens[1]; char[] ch = AccType.ToCharArray(); AccType = ch[0] + ""; float simpleInterest = 0; if (AccType == "s") { simpleInterest = (balance * 4 * 1) / 100; Console.WriteLine("Interest is: {0} Rs per Year", simpleInterest); } else if (AccType == "c") { simpleInterest = (balance * 1 * 1) / 100; Console.WriteLine("Interest is: {0} Rs per Year", simpleInterest); } else { Console.WriteLine("Interest cannot be appliet on DMAT's Account"); } } }
public Account(string id, string name, string type, double balance) { this.id = id; this.name = name; // this.type = type; this.balance = balance; switch (this.type) { case AccType.IF: this.type = AccType.IF; break; case AccType.CA: this.type = AccType.CA; break; case AccType.SA: this.type = AccType.SA; break; case AccType.BA: this.type = AccType.BA; break; } }
public void CreateNewAcc(AccType acctype, string name, string lastname) { if (name == null || lastname == null) { throw new ArgumentNullException("Parametrs can't be null"); } if (name.Length <= 1 || lastname.Length <= 1) { throw new ArgumentNullException("Parametrs can't be empty or less then 1"); } switch (acctype) { case AccType.Basic: AccountStorage.Add(new BaseAccount(name, lastname)); break; case AccType.Gold: AccountStorage.Add(new GoldAccount(name, lastname)); break; case AccType.Platinum: AccountStorage.Add(new PlatinumAccount(name, lastname)); break; } }
public bool LoadFromFile() { Accounts.Clear(); using (BinaryReader reader = new BinaryReader(File.Open(_path, FileMode.Open))) { while (reader.PeekChar() > -1) { var id = reader.ReadString(); var ownerFirstName = reader.ReadString(); var ownerLastName = reader.ReadString(); var amount = reader.ReadDecimal(); var points = reader.ReadInt32(); var type = reader.ReadString(); AccType accType = AccType.Base; switch (type) { case "Gold": accType = AccType.Gold; break; case "Platinum": accType = AccType.Platinum; break; } Accounts.Add(new Account(id, ownerFirstName, ownerLastName, amount, points, accType)); } } return(true); }
public void Interest(employee emp) { try { Console.Write("Enter your Id : "); emp.id = Convert.ToInt32(Console.ReadLine()); balance = Convert.ToInt32(bankingEntities.employees.Find(emp.id).balance); result = Convert.ToString(bankingEntities.employees.Find(emp.id).accountType); Console.WriteLine("Your available balance is : {0}", balance); AccType = result; char[] ch = AccType.ToCharArray(); AccType = ch[0] + ""; float simpleInterest = 0; if (AccType == "s") { simpleInterest = (balance * 4 * 1) / 100; Console.WriteLine("Interest is: {0} Rs per Year", simpleInterest); } else if (AccType == "c") { simpleInterest = (balance * 1 * 1) / 100; Console.WriteLine("Interest is: {0} Rs per Year", simpleInterest); } else { Console.WriteLine("Interest cannot be appliet on DMAT's Account"); } } catch (Exception e) { Console.WriteLine(" No record found with this Account Id. Please try again...."); } }
public HttpResponseMessage GetAccTypeById(HttpRequestMessage reqObject) { string AccTypeId = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccType = JsonConvert.DeserializeObject <AccType>(_requestedDataObject.BusinessData); AccTypeId = _AccType.AccTypeId; } if (!string.IsNullOrWhiteSpace(AccTypeId)) { _AccType = new AccType(); _AccType = _IAccTypeService.GetAccTypeById(AccTypeId); } if (_AccType != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_AccType, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_AccType, "Account Type Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage DeleteAccType(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccType = JsonConvert.DeserializeObject <AccType>(_requestedDataObject.BusinessData); } if (_AccType == null || string.IsNullOrWhiteSpace(_AccType.AccTypeId)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Account TypeId Not Found..."); _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); } result = _IAccTypeService.DeleteAccType(_AccType); if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been deleted successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Account Types Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public Account(string id, string name, AccType type, double balance) { this.id = id; this.name = name; this.type = type; this.balance = balance; }
public Accountant(int i, int a, string n, AccType act, List <Transachistory> h) { Age = a; Name = n; Id = i; actype = act; tranzaksiya = h; }
public ActionResult DeleteConfirmed(int id) { AccType accType = db.AccTypes.Find(id); db.AccTypes.Remove(accType); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Konstruktor /// </summary> /// <param name="login">Login konta</param> /// <param name="password">Haslo konta</param> /// <param name="email">Email konta</param> /// <param name="type">Typ konta</param> public Account(string login, string password, string email, AccType type = AccType.NORMAL) { Login = login; Password = password; Email = email; Type = type; }
public SUIAccessibility(IntPtr HWnd, AccType type) { IntPtr Result = SUIWinAPIs.AccessibleObjectFromWindow(HWnd, (int)type, ref GuidOfIAcc, ref IAcc); if (!Result.Equals(IntPtr.Zero)) { throw new Exception("Object does not support IAccessible."); } }
public Account(string id, string ownerFirstName, string ownerLastName, decimal amount, int points, AccType type) { Id = id; OwnerFirstName = ownerFirstName; OwnerLastName = ownerLastName; Amount = amount; Points = points; Type = type; }
public void Withdraw(EmpFields emp) { //int bal = emp.balance; Console.Write("Enter your Id : "); emp.AccId = Convert.ToInt32(Console.ReadLine()); result = Search(emp.AccId, con); string[] tokens = result.Split(','); balance = Convert.ToInt32(tokens[0]); if (balance < 0) { Console.WriteLine(" No record found with this Account Id. Please try again...."); } else { Console.WriteLine("Your available balance is : {0}", balance); AccType = tokens[1]; char[] ch = AccType.ToCharArray(); AccType = ch[0] + ""; Console.WriteLine("Enter the amount you want to withdraw "); int draw = Convert.ToInt32(Console.ReadLine()); if (AccType == "s") { if ((balance - draw) < 1000) { Console.WriteLine("Minimum Balance in savings account must be 1000 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } else if (AccType == "c") { if ((balance - draw) < 0) { Console.WriteLine("Minimum Balance in current account must be 0 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } else { if ((balance - draw) < -10000) { Console.WriteLine("Minimum Balance in current account must be -10000 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } } Update(balance, con, emp.AccId); }
public void Withdraw(employee emp) { //int bal = emp.balance; Console.Write("Enter your Id : "); emp.id = Convert.ToInt32(Console.ReadLine()); try { balance = Convert.ToInt32(bankingEntities.employees.Find(emp.id).balance); result = Convert.ToString(bankingEntities.employees.Find(emp.id).accountType); Console.WriteLine("Your available balance is : {0}", balance); AccType = result; char[] ch = AccType.ToCharArray(); AccType = ch[0] + ""; Console.WriteLine("Enter the amount you want to withdraw "); int draw = Convert.ToInt32(Console.ReadLine()); if (AccType == "s") { if ((balance - draw) < 1000) { Console.WriteLine("Minimum Balance in savings account must be 1000 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } else if (AccType == "c") { if ((balance - draw) < 0) { Console.WriteLine("Minimum Balance in current account must be 0 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } else { if ((balance - draw) < -10000) { Console.WriteLine("Minimum Balance in current account must be -10000 Rs. Please withdraw some less amount."); } else { balance = balance - draw; } } bankingEntities.employees.Find(emp.id).balance = balance; bankingEntities.SaveChanges(); } catch (Exception e) { Console.WriteLine(" No record found with this Account Id. Please try again...."); } }
public ActionResult Edit([Bind(Include = "typeId,accNType")] AccType accType) { if (ModelState.IsValid) { db.Entry(accType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accType)); }
private void btnlogin_Click(object sender, EventArgs e) { try { String Cred = "SELECT ManID, [Username], [Password], Type FROM Account WHERE [Username]= @Username AND [Password]= @Password"; con.Open(); SqlDa = new SqlDataAdapter(Cred, con); SqlDa.SelectCommand.Parameters.Add("@Username", SqlDbType.VarChar, 20).Value = txtusername.Text; SqlDa.SelectCommand.Parameters.Add("@Password", SqlDbType.VarChar, 20).Value = txtpassword.Text; con.Close(); DataTable CredTable = new DataTable(); SqlDa.Fill(CredTable); if (CredTable.Rows.Count == 0) { lblmessage.Visible = true; } else { String AccType; AccType = CredTable.Rows[0]["Type"].ToString(); ManID = CredTable.Rows[0]["ManID"].ToString(); if (AccType.Equals("Admin")) { admin AdminFrm = new admin(); AdminFrm.Show(); this.Hide(); } else if (AccType.Equals("Moderator")) { mod ModFrm = new mod(); ModFrm.Show(); this.Hide(); } // Save login info to log getNextLogID(); String Log = "INSERT INTO Log(LogNo, Date, LoginTime, ManID) VALUES(@LogNo, @Date, @LoginTime, @ManID)"; con.Open(); cmd = new SqlCommand(Log, con); cmd.Parameters.Add("@LogNo", SqlDbType.VarChar, 8).Value = LogNo; cmd.Parameters.Add("@Date", SqlDbType.Date).Value = DateTime.Now.ToString("yyyy-MM-dd"); cmd.Parameters.Add("@LoginTime", SqlDbType.Time).Value = DateTime.Now.ToString("HH:mm:ss"); cmd.Parameters.Add("@ManID", SqlDbType.VarChar, 8).Value = ManID; cmd.ExecuteNonQuery(); con.Close(); } } catch (Exception ex) { MessageBox.Show("Error While Login!!" + Environment.NewLine + ex); } }
public ActionResult Create([Bind(Include = "typeId,accNType")] AccType accType) { if (ModelState.IsValid) { db.AccTypes.Add(accType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(accType)); }
/// <summary> /// Adds a bank Account for a specific household /// </summary> /// <param name="houseId">Fk pointing to household</param> /// <param name="accountType">Enum accounttype</param> /// <param name="ownerId">Fk pointing to Owner User</param> /// <param name="name">Name of the Bank Account</param> /// <param name="startingBalance">Balance to start</param> /// <param name="lowBalanceThreshold">Alert Level balance</param> /// <returns>PK of BankAccount</returns> public int AddBankAccount(int houseId, AccType accountType, string ownerId, string name, float startingBalance, float lowBalanceThreshold) { var emumAccountType = (int)accountType; return(Database.ExecuteSqlCommand("AddBankAccount @houseId, @accountType, @ownerId, @name, @startingBalance, @lowBalanceThreshold", new SqlParameter("houseId", houseId), new SqlParameter("accountType", emumAccountType), new SqlParameter("ownerId", ownerId), new SqlParameter("name", name), new SqlParameter("startingBalance", startingBalance), new SqlParameter("lowBalanceThreshold", lowBalanceThreshold))); }
// GET: AccTypes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AccType accType = db.AccTypes.Find(id); if (accType == null) { return(HttpNotFound()); } return(View(accType)); }
public void CreateNewAcc(AccType acctype, string name, string lastname) { if (name == null || lastname == null) { throw new ArgumentNullException("Parametrs can't be null"); } if (name.Length <= 1 || lastname.Length <= 1) { throw new ArgumentNullException("Parametrs can't be empty or less then 1"); } storage.Add(acctype.ToString(), name, lastname); }
public int DeleteAccType(AccType _AccType) { try { int result = 0; bool IsRecordExist; if (!string.IsNullOrWhiteSpace(_AccType.AccTypeId)) { IsRecordExist = _IUoW.Repository <AccType>().IsRecordExist(x => x.AccTypeId == _AccType.AccTypeId); if (IsRecordExist) { var _oldAccType = _IUoW.Repository <AccType>().GetBy(x => x.AccTypeId == _AccType.AccTypeId); var _oldAccTypeForLog = ObjectCopier.DeepCopy(_oldAccType); _oldAccType.AuthStatusId = _AccType.AuthStatusId = "U"; _oldAccType.LastAction = _AccType.LastAction = "DEL"; _oldAccType.LastUpdateDT = _AccType.LastUpdateDT = System.DateTime.Now; result = _IUoW.Repository <AccType>().Update(_oldAccType); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; _IAuthLogService.AddAuthLog(_IUoW, _oldAccTypeForLog, _AccType, "DEL", "0001", _AccType.FunctionId, 1, "AccType", "MTK_SP_ACC_TYPE", "AccTypeId", _AccType.AccTypeId, _AccType.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } //result = _IUoW.Repository<AccType>().Delete(_AccType); return(result); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "DeleteAccType(obj)", string.Empty); return(0); } }
public AccType GetAccTypeBy(AccType _AccTypeBy) { try { if (_AccTypeBy == null) { return(_AccTypeBy); } return(_IUoW.Repository <AccType>().GetBy(x => x.AccTypeId == _AccTypeBy.AccTypeId && x.AuthStatusId != "D" && x.LastAction != "DEL")); } catch (Exception ex) { throw ex; } }
private void sendEmail(string email, string name, string username, string password) { // ViewState["fpcode"] = (r.Next(1000, 9999).ToString("D4")); SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; //smtp.Port = 25; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "finalyearproject"); smtp.EnableSsl = true; MailMessage msg = new MailMessage(); msg.Subject = "UoK Semester Automation System | Account Activation "; if (AccType.Equals("ChairPerson")) { msg.Body = "Dear " + name + ",\nYou are selected as a Chair Person of Department of " + Session["DName"].ToString() + " \n\nYour account has been activated.\nKindly copy the following information and paste it in the required field.\n\n\t\t\t\t" + "User Name: " + username + "\n\n\t\t\t\t" + "Password: "******"\n"; } else { msg.Body = "Dear " + name + ",\nThank you for joining us!\n\nYour account has been activated.\nKindly copy the following information and paste it in the required field.\n\n\t\t\t\t" + "User Name: " + username + "\n\n\t\t\t\t" + "Password: "******"\n"; } string to = email; msg.To.Add(to); string from = " UoK Semester Automation System <*****@*****.**>"; msg.From = new MailAddress(from); // smtp.EnableSsl = true; try { smtp.Send(msg); Response.Write("<script>alert('Email has been send successfully')</script> "); } catch (Exception exp) { Response.Write("<script>alert('Email not Sent')</script>"); } }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here try { userIdentity.AddClaim(new Claim("User", User)); userIdentity.AddClaim(new Claim("AccType", AccType.ToString())); userIdentity.AddClaim(new Claim("FullName", FullName)); userIdentity.AddClaim(new Claim("SchoolName", SchoolName)); } catch (System.Exception) { } return(userIdentity); }
public HttpResponseMessage GetAccTypeBy(HttpRequestMessage reqObject) { _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccType = JsonConvert.DeserializeObject <AccType>(_requestedDataObject.BusinessData); _AccType = _IAccTypeService.GetAccTypeBy(_AccType); } if (_AccType != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_AccType, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_AccType, "Account Type Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public static void createAccount(AccType actype, int bal, string uname) { try { if (actype == AccType.Savings) { SavingsAccount savingsAcc = new SavingsAccount(); savingsAcc.openAccount(bal, uname); } else if (actype == AccType.Current) { CurrentAccount currentAcc = new CurrentAccount(); currentAcc.openAccount(bal, uname); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// Create a new <see cref="BankAccount"/> based on <paramref name="_type"/> /// </summary> /// <param name="_type"></param> /// <param name="_name"></param> /// <returns>A new instance of <see cref="BankAccount"/> where the name is set</returns> public BankAccount CreateAccount(AccType _type, string _name) { BankAccount newAccount = null; switch (_type) { case AccType.SalaryAccount: newAccount = new SalaryAccount(_name); break; case AccType.SavingsAccount: newAccount = new SavingsAccount(_name); break; case AccType.OverdraftAccount: newAccount = new OverdraftAccount(_name); break; } AddAccount(newAccount); AccountCount++; return(newAccount); }
public SUIAccessibility(IntPtr HWnd, AccType type) { IntPtr Result = SUIWinAPIs.AccessibleObjectFromWindow(HWnd, (int)type, ref GuidOfIAcc, ref IAcc); if (!Result.Equals(IntPtr.Zero)) throw new Exception("Object does not support IAccessible."); }
public SUIAccessibility(SUIWindow accWin,AccType type):this(accWin.WindowHandle,type) { }
public SUIAccessibility(SUIWindow accWin, AccType type) : this(accWin.WindowHandle, type) { }