public int UserAccount_Save(BLL.UserAccount ua) { try { DAL.UserAccount d = DB.UserAccounts.Where(x => x.Id == ua.Id).FirstOrDefault(); if (d == null) { d = new DAL.UserAccount(); DB.UserAccounts.Add(d); ua.toCopy <DAL.UserAccount>(d); DB.SaveChanges(); ua.Id = d.Id; LogDetailStore(ua, LogDetailType.INSERT); } else { ua.toCopy <DAL.UserAccount>(d); DB.SaveChanges(); LogDetailStore(ua, LogDetailType.UPDATE); } Clients.Clients(OtherLoginClientsOnGroup).UserAccount_Save(ua); return(ua.Id); } catch (Exception ex) { } return(0); }
public Boolean Admin_Authentication(string CompanyName, String LoginId, String Password) { try { DAL.UserAccount ua = DB.UserAccounts .Where(x => x.UserType.CompanyDetail.CompanyName == CompanyName && x.LoginId == LoginId && x.Password == Password && x.UserType.TypeOfUser == BLL.DataKeyValue.Administrator_Key && x.UserType.CompanyDetail.IsActive != false) .FirstOrDefault(); if (ua != null) { return(true); } else { return(false); } } catch (Exception ex) { WriteErrorLog("Login", "UserAccount_Login", 0, Caller.CompanyId, ex.Message); return(true); } }
void UserSetup(BLL.FundMaster fm) { DAL.UserAccount ua = new DAL.UserAccount(); ua.LoginId = fm.UserId; ua.UserName = fm.UserId; ua.Password = fm.Password; DAL.UserType ut = new DAL.UserType(); ut.TypeOfUser = BLL.DataKeyValue.Administrator_Key; ut.FundMasterId = fm.Id; ut.UserAccounts.Add(ua); foreach (var utfd in DB.UserTypeFormDetails) { DAL.UserTypeDetail utd = new DAL.UserTypeDetail(); utd.UserTypeFormDetailId = utfd.Id; utd.IsViewForm = true; utd.AllowInsert = true; utd.AllowUpdate = true; utd.AllowDelete = true; ut.UserTypeDetails.Add(utd); } DB.UserTypes.Add(ut); DB.SaveChanges(); SetDataKeyValue(fm.Id, ut.TypeOfUser, ut.Id); }
public BLL.UserAccount UserAccount_Login(string AccYear, String CompanyName, String LoginId, String Password) { var rv = new BLL.UserAccount(); try { DAL.UserAccount ua = DB.UserAccounts .Where(x => x.UserType.CompanyDetail.CompanyName == CompanyName && x.LoginId == LoginId && x.Password == Password && x.UserType.CompanyDetail.IsActive != false) .FirstOrDefault(); if (ua != null) { Groups.Add(Context.ConnectionId, ua.UserType.CompanyId.ToString()); Caller.CompanyId = ua.UserType.CompanyId; Caller.UnderCompanyId = ua.UserType.CompanyDetail.UnderCompanyId; Caller.CompanyType = ua.UserType.CompanyDetail.CompanyType; Caller.UserId = ua.Id; Caller.AccYear = AccYear; rv = UserAccountDAL_BLL(ua); int yy = DateTime.Now.Month < 4 ? DateTime.Now.Year - 1 : DateTime.Now.Year; if (AccYear.Length > 4) { int.TryParse(AccYear.Substring(0, 4), out yy); } rv.UserType.Company.LoginAccYear = yy; return(rv); } else { return(rv); } } catch (Exception ex) { WriteErrorLog("Login", "UserAccount_Login", rv.Id, Caller.CompanyId, ex.Message); return(rv); } }
private BLL.UserAccount UserAccountDAL_BLL(DAL.UserAccount d) { BLL.UserAccount b = d.toCopy <BLL.UserAccount>(new BLL.UserAccount()); b.UserType = UserTypeDAL_BLL(d.UserType); return(b); }