public ActionResult SendActivationCode(int Id) { object result = ""; try { B_SmsAuthorise bSms = new B_SmsAuthorise(); var sms = bSms.GetSmsDetails(Id); if (sms != null) { var code = new B_SmsAuthorise().AddCode(sms.PhoneNumber); new ApplicationHelper.Sms().SendSms(sms.PhoneNumber, code.ToString()); result = "Success"; } else { throw F_ExeptionFactory.MakeExeption("متاسفانه کد فعال سازی ارسال نشد. مجددا تلاش کنید", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationCode", E_LogType.SYSTEM_ERROR); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult ResetPasswordSendVerificationCode(string PhoneNumber) { object result = ""; try { if (string.IsNullOrEmpty(PhoneNumber)) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (PhoneNumber.Length != 11) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } var user = new B_Users().GetUsers(PhoneNumber); if (user == null) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده در سیستم ثبت نشده است", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (user.IsDeleted == true) { throw F_ExeptionFactory.MakeExeption("چنین کاربری یافت نشد", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "User", Enums.Loging.E_LogType.SYSTEM_ERROR); } int code = new B_SmsAuthorise().AddCode(PhoneNumber); if (code != 0) { new ApplicationHelper.Sms().SendSms(PhoneNumber, code.ToString()); result = new B_SmsAuthorise().GetSmsDetailsId(PhoneNumber); } else { throw F_ExeptionFactory.MakeExeption("متاسفانه کد فعال سازی ارسال نشد. مجددا تلاش کنید", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationCode", E_LogType.SYSTEM_ERROR); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }