public bool ApproveOrReject(Guid id, Enums.Action action) { Blog blog = iBlogDA.GetById(id); if (blog == null) { return(false); } if (action == Enums.Action.Approve) { blog.State.Id = Guid.Parse(Enums.BlogState.Approved.GetValueByProperty(Enums.Property.Id)); blog.PublishDate = DateTime.UtcNow; } else if (action == Enums.Action.Reject) { blog.State.Id = Guid.Parse(Enums.BlogState.Rejected.GetValueByProperty(Enums.Property.Id)); } Update(new Blog[] { blog }); return(true); }
public static void Log <T>(Enums.Action action, int userId, string propertyChanged, string oldValue, string newValue) { string objectChanged = typeof(T).Name.ToString(); string friendlyObjectChangeName = objectChanged; //vv switch-case statement doesn't work with variable values in the cases, so we'll use If-then statement, unless we found something better. if (string.Compare(objectChanged, typeof(Models.ClanWar).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.ClanWar.ClanWarViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.ClanWar.ClanWarUpsertViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Managers.ClanWarManager).Name.ToString(), true) == 0) { friendlyObjectChangeName = "ClanWar"; } ; if (string.Compare(objectChanged, typeof(Models.ClanWarPick).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.ClanWarPick.ClanWarPickUpsertViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.ClanWarPick.ClanWarPickViewModel).Name.ToString(), true) == 0) { friendlyObjectChangeName = "ClanWarPicks"; } ; if (string.Compare(objectChanged, typeof(Models.WarRanking).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.Rankings.ClanMemberStatsViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.Rankings.RankingsUpsertViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Models.ViewModels.Rankings.RankingsViewModel).Name.ToString(), true) == 0 || string.Compare(objectChanged, typeof(Managers.RankingsManager).Name.ToString(), true) == 0) { friendlyObjectChangeName = "ClanRankings"; } ; //TODO //vv add the rest of the ElseIf statements to log the specific object Log(action, userId, friendlyObjectChangeName, propertyChanged, oldValue, newValue); }
public bool APMCCRUD(APMC objAPMC, Enums.Action type) { bool Return = false; ds = new DataSet(); cmd = new SqlCommand(); ObjSQLHelper = new SQLHelper(); try { switch (type) { case Enums.Action.CREATE: cmd.Parameters.AddWithValue("@Action", "CREATE"); break; case Enums.Action.UPDATE: cmd.Parameters.AddWithValue("@Action", "UPDATE"); break; case Enums.Action.DELETE: cmd.Parameters.AddWithValue("@Action", "DELETE"); break; } cmd.Parameters.AddWithValue("@AutoId", objAPMC.AutoId); cmd.Parameters.AddWithValue("@Name", objAPMC.Name); cmd.Parameters.AddWithValue("@Address1", objAPMC.Address1); cmd.Parameters.AddWithValue("@Address2", objAPMC.Address2); cmd.Parameters.AddWithValue("@StateId", objAPMC.StateId); cmd.Parameters.AddWithValue("@DistrictId", objAPMC.DistrictId); cmd.Parameters.AddWithValue("@TalukaId", objAPMC.TalukaId); cmd.Parameters.AddWithValue("@PinCode", objAPMC.PinCode); cmd.Parameters.AddWithValue("@ContactNo", objAPMC.ContactNo); cmd.Parameters.AddWithValue("@MobileNo", objAPMC.MobileNo); cmd.Parameters.AddWithValue("@EmailId", objAPMC.EmailId); cmd.Parameters.AddWithValue("@ChairmanFirstname", objAPMC.ChairmanFirstname); cmd.Parameters.AddWithValue("@ChairmanMiddlename", objAPMC.ChairmanMiddlename); cmd.Parameters.AddWithValue("@ChairmanLastname", objAPMC.ChairmanLastname); cmd.Parameters.AddWithValue("@ChairmanAddress1", objAPMC.ChairmanAddress1); cmd.Parameters.AddWithValue("@ChairmanAddress2", objAPMC.ChairmanAddress2); cmd.Parameters.AddWithValue("@ChairmanStateId", objAPMC.ChairmanStateId); cmd.Parameters.AddWithValue("@ChairmanDistrictId", objAPMC.ChairmanDistrictId); cmd.Parameters.AddWithValue("@ChairmanTalukaId", objAPMC.ChairmanTalukaId); cmd.Parameters.AddWithValue("@ChairmanPinCode", objAPMC.ChairmanPinCode); cmd.Parameters.AddWithValue("@ChairmanContactNo", objAPMC.ChairmanContactNo); cmd.Parameters.AddWithValue("@ChairmanMobileNo", objAPMC.ChairmanMobileNo); cmd.Parameters.AddWithValue("@ChairmanEmailId", objAPMC.ChairmanEmailId); cmd.Parameters.AddWithValue("@SecretaryFirstname", objAPMC.SecretaryFirstname); cmd.Parameters.AddWithValue("@SecretaryMiddlename", objAPMC.SecretaryMiddlename); cmd.Parameters.AddWithValue("@SecretaryLastname", objAPMC.SecretaryLastname); cmd.Parameters.AddWithValue("@SecretaryAddress1", objAPMC.SecretaryAddress1); cmd.Parameters.AddWithValue("@SecretaryAddress2", objAPMC.SecretaryAddress2); cmd.Parameters.AddWithValue("@SecretaryStateId", objAPMC.SecretaryStateId); cmd.Parameters.AddWithValue("@SecretaryDistrictId", objAPMC.SecretaryDistrictId); cmd.Parameters.AddWithValue("@SecretaryTalukaId", objAPMC.SecretaryTalukaId); cmd.Parameters.AddWithValue("@SecretaryPinCode", objAPMC.SecretaryPinCode); cmd.Parameters.AddWithValue("@SecretaryContactNo", objAPMC.SecretaryContactNo); cmd.Parameters.AddWithValue("@SecretaryMobileNo", objAPMC.SecretaryMobileNo); cmd.Parameters.AddWithValue("@SecretaryEmailId", objAPMC.SecretaryEmailId); cmd.Parameters.AddWithValue("@TotalShop", objAPMC.TotalShop); cmd.Parameters.AddWithValue("@RegisterVendor", objAPMC.RegisterVendor); cmd.Parameters.AddWithValue("@DealInFruit", objAPMC.DealInFruit); cmd.Parameters.AddWithValue("@DealInVeg", objAPMC.DealInVeg); cmd.Parameters.AddWithValue("@DealInOther", objAPMC.DealInOther); cmd.Parameters.AddWithValue("@DealOther", objAPMC.DealOther); cmd.Parameters.AddWithValue("@BankId", objAPMC.BankId); cmd.Parameters.AddWithValue("@BranchName", objAPMC.BranchName); cmd.Parameters.AddWithValue("@BranchAddress", objAPMC.BranchAddress); cmd.Parameters.AddWithValue("@AccountNumber", objAPMC.AccountNumber); cmd.Parameters.AddWithValue("@IFSCCode", objAPMC.IFSCCode); cmd.Parameters.AddWithValue("@IMAGELOGO", objAPMC.IMAGELOGO); cmd.Parameters.AddWithValue("@IMAGECERTI", objAPMC.IMAGECERTI); cmd.Parameters.AddWithValue("@IMAGELICENSE", objAPMC.IMAGELICENSE); cmd.Parameters.AddWithValue("@IMAGEGST", objAPMC.IMAGEGST); cmd.Parameters.AddWithValue("@StatusId", objAPMC.StatusId); cmd.Parameters.AddWithValue("@UserId", objAPMC.UserId); string ProcName = "APMC_SP"; if (ObjSQLHelper.IUDProcData(ProcName, cmd)) { ObjSQLHelper.CommitTransaction(); Return = true; } else { ObjSQLHelper.RollBackTransaction(); } } catch (Exception ex) { Console.WriteLine(ex.Message); ObjSQLHelper.RollBackTransaction(); ObjSQLHelper.ClearObjects(); } finally { ObjSQLHelper.ClearObjects(); } return(Return); }
/// <summary> /// Method to validate an authentication token /// </summary> /// <param name="AuthToken"></param> /// <param name="IPAddress"></param> /// <param name="UserType">type of user to be validated</param> /// <param name="IsAuthorize"></param> /// <param name="Action"></param> /// <returns></returns> public bool validateAuthToken(string AuthToken, string IPAddress, bool IsAuthorize, Enums.Action Action) { try { string AES_KEY = CommonUtility.GetAppSettingKey(Constants.AuthToken.AES_KEY); string AES_SALT = CommonUtility.GetAppSettingKey(Constants.AuthToken.AES_SALT); bool IsValidateIPAddress = Convert.ToBoolean(CommonUtility.GetAppSettingKey(Constants.AuthToken.IsValidateIPAddress)); int TokenValiditySec = Convert.ToInt32(CommonUtility.GetAppSettingKey(Constants.AuthToken.TokenValiditySec)); var TokenBody = CryptoUtility.Decrypt(AuthToken, AES_KEY, AES_SALT); var LstTokenBody = JLT.Common.Utility.StringUtility.SplitString(TokenBody, "##"); var LstInnerMsg = JLT.Common.Utility.StringUtility.SplitString(LstTokenBody[0], Constants.AuthToken.SeperatorString); //InnerMsg = UserID + Role + IPAddress + CryptoUtility.GenerateTimeStamp(); var TokenHash = LstTokenBody[1]; string Msg_Hash = string.Empty; using (var objTokenDBService = new TokenDBService()) { var Hash_Salt = objTokenDBService.GetHashSalt(LstInnerMsg[0]); Msg_Hash = CryptoUtility.GenerateHash(LstTokenBody[0], Hash_Salt); } if (Convert.ToInt64(CryptoUtility.GenerateTimeStamp()) - Convert.ToInt64(LstInnerMsg[3]) < TokenValiditySec) { if (IsValidateIPAddress) { if (!String.Equals(LstInnerMsg[2], IPAddress, StringComparison.Ordinal)) { throw new SecurityTokenException("401|Error validating access token: Suspicious request, IP mismatch found(Token: " + AuthToken + " :: Token IP Address: " + LstInnerMsg[2] + " - Current IP Address: " + IPAddress + ")"); //Suspicious Request } } if (String.Equals(Msg_Hash, TokenHash, StringComparison.Ordinal)) { if (IsAuthorize) { if ((Convert.ToInt64(Action) & Convert.ToInt64(LstInnerMsg[1])) == Convert.ToInt64(Action)) { return(true); } else { throw new SecurityTokenException("403|User is not authorized to perform this action(Token: " + AuthToken + " :: IP Address: " + IPAddress + ")"); //User does not have role for this action } } else { return(true); } } else { throw new SecurityTokenException("401|Error validating access token: token not valid(Token: " + AuthToken + " :: IP Address: " + IPAddress + ")"); //Token Expired } } else { throw new SecurityTokenException("401|Error validating access token: Session has expired(Token: " + AuthToken + " :: IP Address: " + IPAddress + ")"); //Token Expired } } catch (SecurityTokenException e) { throw e; } catch (Exception ex) { throw new Exception("401|Default Exeption(Token: " + AuthToken + " | IP Address: " + IPAddress + ")", ex); } }
public JavaScriptVisit(IVisitable visitable, Enums.Action action, WebView webView) : base(visitable, action, webView) { }
public int VendorCRUD(Vendor objVendor, Enums.Action type) { int Return = 0; ds = new DataSet(); cmd = new SqlCommand(); ObjSQLHelper = new SQLHelper(); try { switch (type) { case Enums.Action.CREATE: cmd.Parameters.AddWithValue("@Action", "CREATE"); break; case Enums.Action.UPDATE: cmd.Parameters.AddWithValue("@Action", "UPDATE"); break; case Enums.Action.DELETE: cmd.Parameters.AddWithValue("@Action", "DELETE"); break; } cmd.Parameters.AddWithValue("@AutoId", objVendor.AutoId); cmd.Parameters.AddWithValue("@FirstName", objVendor.FirstName); cmd.Parameters.AddWithValue("@MiddleName", objVendor.MiddleName); cmd.Parameters.AddWithValue("@LastName", objVendor.LastName); cmd.Parameters.AddWithValue("@Address1", objVendor.Address1); cmd.Parameters.AddWithValue("@Address2", objVendor.Address2); cmd.Parameters.AddWithValue("@StateId", objVendor.StateId); cmd.Parameters.AddWithValue("@DistrictId", objVendor.DistrictId); cmd.Parameters.AddWithValue("@TalukaId", objVendor.TalukaId); cmd.Parameters.AddWithValue("@PinCode", objVendor.PinCode); cmd.Parameters.AddWithValue("@ContactNo", objVendor.ContactNo); cmd.Parameters.AddWithValue("@MobileNo", objVendor.MobileNo); cmd.Parameters.AddWithValue("@ResidanceAddress1", objVendor.ResidanceAddress1); cmd.Parameters.AddWithValue("@ResidanceAddress2", objVendor.ResidanceAddress2); cmd.Parameters.AddWithValue("@ResidanceStateId", objVendor.ResidanceStateId); cmd.Parameters.AddWithValue("@ResidanceDistrictId", objVendor.ResidanceDistrictId); cmd.Parameters.AddWithValue("@ResidanceTalukaId", objVendor.ResidanceTalukaId); cmd.Parameters.AddWithValue("@ResidancePinCode", objVendor.ResidancePinCode); cmd.Parameters.AddWithValue("@ResidanceContactNo", objVendor.ResidanceContactNo); cmd.Parameters.AddWithValue("@ResidanceMobileNo", objVendor.ResidanceMobileNo); cmd.Parameters.AddWithValue("@IsAPMCAssosiated", objVendor.IsAPMCAssosiated); cmd.Parameters.AddWithValue("@APMCId", objVendor.APMCId); cmd.Parameters.AddWithValue("@RefTypeId", objVendor.RefTypeId); cmd.Parameters.AddWithValue("@RefNameId", objVendor.RefNameId); cmd.Parameters.AddWithValue("@DealInFruit", objVendor.DealInFruit); cmd.Parameters.AddWithValue("@DealInVeg", objVendor.DealInVeg); cmd.Parameters.AddWithValue("@DealInOther", objVendor.DealInOther); cmd.Parameters.AddWithValue("@DealOther", objVendor.DealOther); cmd.Parameters.AddWithValue("@BankId", objVendor.BankId); cmd.Parameters.AddWithValue("@BranchName", objVendor.BranchName); cmd.Parameters.AddWithValue("@BranchAddress", objVendor.BranchAddress); cmd.Parameters.AddWithValue("@AccountNumber", objVendor.AccountNumber); cmd.Parameters.AddWithValue("@IFSCCode", objVendor.IFSCCode); cmd.Parameters.AddWithValue("@IMAGEAADHAR", objVendor.IMAGEAADHAR); cmd.Parameters.AddWithValue("@IMAGELOGO", objVendor.IMAGELOGO); cmd.Parameters.AddWithValue("@IMAGEPAN", objVendor.IMAGEPAN); cmd.Parameters.AddWithValue("@IMAGEGST", objVendor.IMAGEGST); cmd.Parameters.AddWithValue("@StatusId", objVendor.StatusId); cmd.Parameters.AddWithValue("@UserId", objVendor.UserId); cmd.Parameters.AddWithValue("@OutputId", SqlDbType.BigInt); cmd.Parameters["@OutputId"].Size = 8; cmd.Parameters["@OutputId"].Direction = ParameterDirection.Output; string ProcName = "Vendor_SP"; Return = Common.ConvertDBNullToInt(ObjSQLHelper.IUDProcDataWithOutputParameter(ProcName, cmd)); if (Return > 0) { ObjSQLHelper.CommitTransaction(); } else { ObjSQLHelper.RollBackTransaction(); } } catch (Exception ex) { Console.WriteLine(ex.Message); ObjSQLHelper.RollBackTransaction(); ObjSQLHelper.ClearObjects(); } finally { ObjSQLHelper.ClearObjects(); } return(Return); }
public ColdBootVisit(IVisitable visitable, Enums.Action action, WebView webView) : base(visitable, action, webView) { }
public bool OnPress(Action action) { return(Input.GetKey(GetKeyCode(action))); }
public bool FarmerCRUD(Farmer objFarmer, Enums.Action type) { bool Return = false; ds = new DataSet(); cmd = new SqlCommand(); ObjSQLHelper = new SQLHelper(); try { switch (type) { case Enums.Action.CREATE: cmd.Parameters.AddWithValue("@Action", "CREATE"); break; case Enums.Action.UPDATE: cmd.Parameters.AddWithValue("@Action", "UPDATE"); break; case Enums.Action.DELETE: cmd.Parameters.AddWithValue("@Action", "DELETE"); break; } cmd.Parameters.AddWithValue("@AutoId", objFarmer.AutoId); cmd.Parameters.AddWithValue("@FirstName", objFarmer.FirstName); cmd.Parameters.AddWithValue("@MiddleName", objFarmer.MiddleName); cmd.Parameters.AddWithValue("@LastName", objFarmer.LastName); cmd.Parameters.AddWithValue("@Address1", objFarmer.Address1); cmd.Parameters.AddWithValue("@Address2", objFarmer.Address2); cmd.Parameters.AddWithValue("@StateId", objFarmer.StateId); cmd.Parameters.AddWithValue("@DistrictId", objFarmer.DistrictId); cmd.Parameters.AddWithValue("@TalukaId", objFarmer.TalukaId); cmd.Parameters.AddWithValue("@PinCode", objFarmer.PinCode); cmd.Parameters.AddWithValue("@ContactNo", objFarmer.ContactNo); cmd.Parameters.AddWithValue("@MobileNo", objFarmer.MobileNo); cmd.Parameters.AddWithValue("@FarmAddress1", objFarmer.FarmAddress1); cmd.Parameters.AddWithValue("@FarmAddress2", objFarmer.FarmAddress2); cmd.Parameters.AddWithValue("@FarmStateId", objFarmer.FarmStateId); cmd.Parameters.AddWithValue("@FarmDistrictId", objFarmer.FarmDistrictId); cmd.Parameters.AddWithValue("@FarmTalukaId", objFarmer.FarmTalukaId); cmd.Parameters.AddWithValue("@FarmPinCode", objFarmer.FarmPinCode); cmd.Parameters.AddWithValue("@KishanCard", objFarmer.KishanCard); cmd.Parameters.AddWithValue("@FarmEmail", objFarmer.FarmEmail); cmd.Parameters.AddWithValue("@IsAPMCAssosiated", objFarmer.IsAPMCAssosiated); cmd.Parameters.AddWithValue("@APMCId", objFarmer.APMCId); cmd.Parameters.AddWithValue("@RefTypeId", objFarmer.RefTypeId); cmd.Parameters.AddWithValue("@RefNameId", objFarmer.RefNameId); cmd.Parameters.AddWithValue("@DealInFruit", objFarmer.DealInFruit); cmd.Parameters.AddWithValue("@DealInVeg", objFarmer.DealInVeg); cmd.Parameters.AddWithValue("@DealInOther", objFarmer.DealInOther); cmd.Parameters.AddWithValue("@DealOther", objFarmer.DealOther); cmd.Parameters.AddWithValue("@BankId", objFarmer.BankId); cmd.Parameters.AddWithValue("@BranchName", objFarmer.BranchName); cmd.Parameters.AddWithValue("@BranchAddress", objFarmer.BranchAddress); cmd.Parameters.AddWithValue("@AccountNumber", objFarmer.AccountNumber); cmd.Parameters.AddWithValue("@IFSCCode", objFarmer.IFSCCode); cmd.Parameters.AddWithValue("@IMAGEAADHAR", objFarmer.IMAGEAADHAR); cmd.Parameters.AddWithValue("@IMAGEPAN", objFarmer.IMAGEPAN); cmd.Parameters.AddWithValue("@IMAGEGST", objFarmer.IMAGEGST); cmd.Parameters.AddWithValue("@StatusId", objFarmer.StatusId); cmd.Parameters.AddWithValue("@UserId", objFarmer.UserId); string ProcName = "Farmer_SP"; if (ObjSQLHelper.IUDProcData(ProcName, cmd)) { ObjSQLHelper.CommitTransaction(); Return = true; } else { ObjSQLHelper.RollBackTransaction(); } } catch (Exception ex) { Console.WriteLine(ex.Message); ObjSQLHelper.RollBackTransaction(); ObjSQLHelper.ClearObjects(); } finally { ObjSQLHelper.ClearObjects(); } return(Return); }
public BankAccountCommand(BankAccount account, Enums.Action action, int amount) { this.account = account ?? throw new ArgumentNullException(nameof(account)); this.action = action; this.amount = amount; }
public ConditionDerniereAction(Enums.Action action) { this.action = action; }