public bool AddAccount(Accounts account) { using (KraContext Context = new KraContext()) { Context.Account.Add(account); Context.SaveChanges(); } return(true); }
public string[] GetQuarters(int AccountId, int year) { string[] quarters; using (KraContext Context = new KraContext()) { quarters = (from parameters in Context.AccountParameter where parameters.AccountID == AccountId && parameters.Year == year select parameters.Quarter).Distinct().ToArray(); } return(quarters); }
public List <Accounts> GetAllAccounts() { List <Accounts> AccountList; using (KraContext Context = new KraContext()) { AccountList = (from accounts in Context.Account select accounts).ToList(); } return(AccountList); }
public List <KraParameters> GetParameters() { List <KraParameters> AllParameters; using (KraContext Context = new KraContext()) { AllParameters = (from prams in Context.Params select prams).ToList(); } return(AllParameters); }
public List <Accounts> GetAllAccounts(int ADMId) { List <Accounts> AccountList; using (KraContext Context = new KraContext()) { AccountList = (from accounts in Context.Account where accounts.ManagerID == ADMId select accounts).ToList(); } return(AccountList); }
public Accounts GetAccount(int accountid) { Accounts Account; using (KraContext Context = new KraContext()) { Account = Context.Account.Find(accountid); } return(Account); }
public List <AccountParameters> GetAllAccountParameters(int AccountId, string Quarter, int Year) { List <AccountParameters> AllParameters; using (KraContext Context = new KraContext()) { AllParameters = (from Params in Context.AccountParameter where Params.AccountID == AccountId && Params.Quarter == Quarter && Params.Year == Year select Params).ToList(); } return(AllParameters); }
public List <int> GetYears(int AccountId) { List <int> years; using (KraContext Context = new KraContext()) { years = (from parameters in Context.AccountParameter where parameters.AccountID == AccountId orderby parameters.Year ascending select parameters.Year).Distinct().ToList(); } return(years); }
public AccountParameters GetParameter(int AccountId, int ParamId, string Quarter, int Year) { AccountParameters parameter = null; using (KraContext Context = new KraContext()) { parameter = (from bs in Context.AccountParameter where bs.AccountID == AccountId && bs.ParamID == ParamId && bs.Quarter == Quarter && bs.Year == Year select bs).FirstOrDefault(); } return(parameter); }
public List <ParameterBounds> GetParameterBounds(int AccountParamID) { List <ParameterBounds> AllBounds; using (KraContext Context = new KraContext()) { AllBounds = (from bounds in Context.Bounds where bounds.AccountParamID == AccountParamID select bounds).ToList(); } return(AllBounds); }
public AccountTeamSize GetTeamSize(int AccountId, string Quarter, int Year) { AccountTeamSize TeamSize; using (KraContext Context = new KraContext()) { TeamSize = (from teamsize in Context.TeamSize where teamsize.AccountId == AccountId && teamsize.Quarter == Quarter && teamsize.Year == Year select teamsize).FirstOrDefault(); } return(TeamSize); }
public AccountParameters GetParameter(int AccountParamId) { AccountParameters parameter = null; using (KraContext Context = new KraContext()) { parameter = Context.AccountParameter.Find(AccountParamId); } return(parameter); }
public bool UpdateParameterWeightage(int AccountParamId, int Weightage) { using (KraContext Context = new KraContext()) { AccountParameters Parameter = Context.AccountParameter.Find(AccountParamId); Parameter.Weightage = Weightage; Context.SaveChanges(); } return(true); }
public KraInputScores GetScore(int AccountParamId) { KraInputScores Scores; using (KraContext Context = new KraContext()) { Scores = (from Score in Context.Score where Score.AccountParamID == AccountParamId select Score).SingleOrDefault(); } return(Scores); }
public bool AddScore(KraInputScores score) { using (KraContext Context = new KraContext()) { KraInputScores Scores = (from Score in Context.Score where Score.AccountParamID == score.AccountParamID select Score).SingleOrDefault(); if (Scores != null) { Scores.Score = score.Score; Context.SaveChanges(); } else { Context.Score.Add(score); } Context.SaveChanges(); } return(true); }
public bool AddTeamSize(AccountTeamSize TeamSize) { using (KraContext Context = new KraContext()) { AccountTeamSize size = (from teamsize in Context.TeamSize where teamsize.AccountId == TeamSize.AccountId && teamsize.Quarter == TeamSize.Quarter select teamsize).SingleOrDefault(); if (size != null) { size.TeamSize = TeamSize.TeamSize; Context.SaveChanges(); } else { Context.TeamSize.Add(TeamSize); Context.SaveChanges(); } } return(true); }
public bool AddParameter(KraParameters Parameter) { var result = true; using (KraContext Context = new KraContext()) { KraParameters parameter = (from bs in Context.Params where bs.ParamName.ToLower() == Parameter.ParamName.ToLower() || bs.ParamName.ToUpper() == Parameter.ParamName.ToUpper() select bs).SingleOrDefault(); if (parameter != null) { result = false; } else { Context.Params.Add(Parameter); Context.SaveChanges(); } } return(result); }
public bool AddAccountParameter(AccountParameters Param) { using (KraContext Context = new KraContext()) { AccountParameters Parameter = (from parameter in Context.AccountParameter where parameter.AccountParamID == Param.AccountParamID select parameter).SingleOrDefault(); if (Parameter != null) { Parameter.ParamID = Param.ParamID; Parameter.Quarter = Param.Quarter; Context.SaveChanges(); } else { Context.AccountParameter.Add(Param); Context.SaveChanges(); } } return(true); }
public bool AddParameterBound(ParameterBounds bounds) { using (KraContext Context = new KraContext()) { ParameterBounds bound = Context.Bounds.Find(bounds.DefinitionID); if (bound == null) { Context.Bounds.Add(bounds); Context.SaveChanges(); } else { bound.MinValue = bounds.MinValue; bound.MaxValue = bounds.MaxValue; bound.Result = bounds.Result; Context.SaveChanges(); } } return(true); }