public static void Delete(string name) { string appId = Maps.Instance.GetMap().Id; string connectionString = Maps.Instance.DuradosMap.connectionString; string whereStatment = string.Format(WHERE, name, appId); SqlGeneralAccess.Delete(TABLE_NAME, whereStatment, connectionString); }
public static bool IsCronExists(string name) { string appId = Maps.Instance.GetMap().Id; string connectionString = Maps.Instance.DuradosMap.connectionString; string whereStatement = string.Format(WHERE, name, appId); Dictionary <string, object> values = new Dictionary <string, object>(); return(SqlGeneralAccess.Select(values, TABLE_NAME, whereStatement, connectionString).Rows.Count > 0); }
public static DataTable GetCycleCrons(int cycle) { DataTable cronsTable = new DataTable(); string connectionString = Maps.Instance.DuradosMap.connectionString; string whereStatement = string.Format(" Cycle = {0}", cycle); Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("AppId", null); cronsTable = SqlGeneralAccess.Select(values, TABLE_NAME, whereStatement, connectionString); return(cronsTable); }
public static void Create(string name, string cycle) { Dictionary <string, object> values = new Dictionary <string, object>(); string appId = Maps.Instance.GetMap().Id; string connectionString = Maps.Instance.DuradosMap.connectionString; int cycleNumber = System.Convert.ToInt32(Enum.Parse(typeof(CycleEnum), cycle)); values.Add("CronName", name); values.Add("Cycle", cycleNumber); values.Add("AppId", appId); SqlGeneralAccess.Create(values, TABLE_NAME, true, connectionString); }
public static void Edit(string name, string cycle, string prevName) { Dictionary <string, object> values = new Dictionary <string, object>(); string appId = Maps.Instance.GetMap().Id; int cycleNumber = System.Convert.ToInt32(Enum.Parse(typeof(CycleEnum), cycle)); values.Add("CronName", name); values.Add("Cycle", cycleNumber); string whereStatement = string.Format(WHERE, prevName, appId); string connectionString = Maps.Instance.DuradosMap.connectionString; SqlGeneralAccess.Update(values, TABLE_NAME, whereStatement, connectionString); }
/// <summary> /// Change web master access password if neccessary /// </summary> /// <param name="changeMembershipPassword"></param> /// <param name="changeUserPasswordInDB"></param> /// <param name="userName"></param> /// <param name="password"></param> private void changeWebMasterPassword(bool changeMembershipPassword, bool changeUserPasswordInDB, string userName, string password) { //Get newUser id DataRow newUserRow = Maps.Instance.DuradosMap.Database.GetUserRow(userName); if (newUserRow == null) { throw new DuradosException("Error in create new web master user"); } int newUserId = Convert.ToInt32(newUserRow["ID"]); //change password in Membership if (changeMembershipPassword) { string currentEncriptedPassword = Convert.ToString(newUserRow["Password"]); string currentPassword = CryptorHelper.Decrypt(currentEncriptedPassword, true); if (!changeUserPasswordInDB || !MembershipService.ChangePassword(userName, currentPassword, password, false)) { currentPassword = MembershipService.ResetPassword(userName); MembershipService.ChangePassword(userName, currentPassword, password, false); } } //change password in DB if (changeUserPasswordInDB) { string encryptedPassword = CryptorHelper.Encrypt(password, true); Dictionary <string, object> updatedValues = new Dictionary <string, object>(); updatedValues.Add("Password", encryptedPassword); SqlGeneralAccess.Update(updatedValues, "durados_User", "ID=" + newUserId.ToString(), Maps.Instance.DuradosMap.Database.ConnectionString); } MembershipService.UnlockUser(userName); }