public ResponseBo ChangeLanguage(BaseBo baseBo) { ResponseBo responseBo = new ResponseBo(); try { using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); p.Add("@Id", baseBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@LanguageId ", baseBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); conn.Execute("Update Person set LanguageId=@LanguageId,UpdateDate=getdate(),UpdatePersonId=@Id where Id=@Id", p, commandType: CommandType.Text); } responseBo.IsSuccess = true; responseBo.Message = null; } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, baseBo); } return(responseBo); }
public ResponseBo IsEmailVerified(BaseBo baseBo) { ResponseBo responseBo = new ResponseBo(); try { using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output); p.Add("@PersonId ", baseBo.Session.RealPerson.Id, DbType.String, ParameterDirection.Input, 255); conn.Execute("spAuthIsEmailVerified", p, commandType: CommandType.StoredProcedure); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, baseBo); } return(responseBo); }
public ResponseBo <List <OrderStatListBo> > GetStatList(BaseBo baseBo) { ResponseBo <List <OrderStatListBo> > responseBo = new ResponseBo <List <OrderStatListBo> >(); try { using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output); p.Add("@MyPersonId", baseBo.Session.MyPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@OperatorRealId", baseBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@LanguageId", baseBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); responseBo.Bo = conn.Query <OrderStatListBo>("spOrderStatList", p, commandType: CommandType.StoredProcedure).ToList(); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, baseBo).ToResponse <List <OrderStatListBo> >(); } return(responseBo); }
public ResponseDto <List <DictionaryDto> > ChangeLanguage(DictionaryGetListCriteriaDto criteriaDto) { ResponseDto <List <DictionaryDto> > responseDto = new ResponseDto <List <DictionaryDto> >(); BaseBo baseBo = base.ToBaseBo(); baseBo.Session.RealPerson.LanguageId = criteriaDto.LanguageId; // Anonymous persons cannot effect language in db. if (baseBo.Session.RealPerson.Id != -2) { ResponseBo responseBo = realPersonBusiness.ChangeLanguage(baseBo); responseDto = responseBo.ToResponseDto <List <DictionaryDto> >(); if (responseBo.IsSuccess) { foreach (Session session in SessionManager.SessionList) { if (session.RealPerson.Id != Session.RealPerson.Id) { continue; } session.RealPerson.LanguageId = criteriaDto.LanguageId; } if (Business.Stc.NeedToSendDics(criteriaDto.ChangeSetID, criteriaDto.LanguageId)) { responseDto.Dto = new List <DictionaryDto>(); foreach (DicItem item in Business.Stc.DicItemList) { responseDto.Dto.Add(new DictionaryDto() { Key = item.Key, Value = Business.Stc.GetbyLang(item, criteriaDto.LanguageId) }); } } } } else { responseDto.IsSuccess = true; if (Business.Stc.NeedToSendDics(criteriaDto.ChangeSetID, criteriaDto.LanguageId)) { responseDto.Dto = new List <DictionaryDto>(); foreach (DicItem item in Business.Stc.DicItemList) { responseDto.Dto.Add(new DictionaryDto() { Key = item.Key, Value = Business.Stc.GetbyLang(item, criteriaDto.LanguageId) }); } } } return(responseDto); }
protected BaseBo ToBaseBo() { BaseBo baseBo = new BaseBo(); baseBo.Session = Session.Copy(); return(baseBo); }
//// GET api/<controller> //public IEnumerable<string> Get() //{ // return new string[] { "value1", "value2" }; //} //// GET api/<controller>/5 //public string Get(int id) //{ // return "value"; //} //// POST api/<controller> //public void Post([FromBody]string value) //{ //} //// PUT api/<controller>/5 //public void Put(int id, [FromBody]string value) //{ //} //// DELETE api/<controller>/5 //public void Delete(int id) //{ //} protected ResponseDto SaveExLog(Exception exception, Type type, string methodName) { Business.BaseBusiness baseBusiness = new Business.BaseBusiness(); BaseBo baseBo = new BaseBo(); baseBo.Session = Session; return(baseBusiness.SaveExLog(exception, type, methodName, baseBo, Enums.ApplicationTypes.MhServiceWebApi).ToResponseDto()); }
protected void AddStandartSpParams(ref DynamicParameters p, BaseBo baseBo) { // Outputs p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output); p.Add("@ReturnedId", dbType: DbType.Int64, direction: ParameterDirection.Output); // Inputs p.Add("@ApiSessionId", baseBo.Session.ApiSessionId, DbType.Int64, ParameterDirection.Input); p.Add("@MyPersonId", baseBo.Session.MyPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@OperatorRealId", baseBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@LanguageId", baseBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); }
public ResponseBo <List <NotificationPreferenceListBo> > GetList(BaseBo baseBo) { ResponseBo <List <NotificationPreferenceListBo> > responseBo = new ResponseBo <List <NotificationPreferenceListBo> >(); try { using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); base.AddStandartSpParams(ref p, baseBo); responseBo.Bo = conn.Query <NotificationPreferenceListBo>("spNotificationPreferenceList", p, commandType: CommandType.StoredProcedure).ToList(); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, baseBo).ToResponse <List <NotificationPreferenceListBo> >(); } return(responseBo); }
/// <summary> /// /// </summary> /// <param name="exception"></param> /// <param name="type"></param> /// <param name="methodName"></param> /// <param name="baseBo"></param> /// <param name="applicationTypeId">Fill this param only if it is 'Angular' otherwise keep it null.</param> public ResponseBo SaveExLog(Exception exception, Type type, string methodName, BaseBo baseBo, Enums.ApplicationTypes?applicationTypeId = null) { LogExceptionBusiness exceptionBusiness = new LogExceptionBusiness(); if (applicationTypeId == null) { applicationTypeId = Enums.ApplicationTypes.Unknown; string fullName = type.FullName.Replace(".", ""); if (fullName.StartsWith(Enums.ApplicationTypes.MhBusinessBo.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhBusinessBo; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhBusinessContract.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhBusinessContract; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhBusiness.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhBusiness; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhEnums.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhEnums; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhSessions.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhSessions; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhUtils.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhUtils; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhDb.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhDb; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhDbAccess.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhDbAccess; } else if (fullName.StartsWith(Enums.ApplicationTypes.websocketsharp.ToString())) { applicationTypeId = Enums.ApplicationTypes.websocketsharp; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhServiceCurrencyCollect.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhServiceCurrencyCollect; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhServiceDto.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhServiceDto; } else if (fullName.StartsWith(Enums.ApplicationTypes.MhServiceWebApi.ToString())) { applicationTypeId = Enums.ApplicationTypes.MhServiceWebApi; } } string clientIpAddress = null; long? apiSessionId = null; if (baseBo != null) { clientIpAddress = baseBo.Session.ClientIpAddress; apiSessionId = baseBo.Session.ApiSessionId; } ResponseBo responseBo = exceptionBusiness.Save(exception, applicationTypeId.Value, type.Name, methodName, clientIpAddress, apiSessionId); responseBo.IsSuccess = false; Enums.Languages languageId = Enums.Languages.xTurkish; if (baseBo != null && baseBo.Session != null && baseBo.Session.RealPerson != null) { languageId = baseBo.Session.RealPerson.LanguageId; } responseBo.Message = GetDicValue("xUnexpectedErrorOccurred", languageId); if (responseBo.ReturnedId != null) { responseBo.Message += Environment.NewLine + GetDicValue("xTextErrorNumber", languageId) + ":" + Environment.NewLine + responseBo.ReturnedId.Value.ToString(); } return(responseBo); }