Beispiel #1
0
        public ResponseBo FullNameExists(string fullName, Enums.Languages languageId)
        {
            ResponseBo responseBo = new ResponseBo();

            try
            {
                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    p.Add("@FullName ", fullName, DbType.String, ParameterDirection.Input, 255);
                    p.Add("@PersonTypeId ", (int)Enums.PersonTypes.xShop, DbType.Int32, ParameterDirection.Input);
                    int result = conn.ExecuteScalar("select COUNT(*) from Person P where P.PersonTypeId = @PersonTypeId and P.Surname = @FullName", p).ToInt32();

                    if (result == 0)
                    {
                        responseBo.IsSuccess = true;
                    }
                    else
                    {
                        responseBo.IsSuccess = false;
                        responseBo.Message   = GetDicValue("xShopFullNameAlreadyExist", languageId);
                    }
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, null);
            }

            return(responseBo);
        }
Beispiel #2
0
        public ResponseDto <List <ShopTypeGroupDto> > GetShopTypeList()
        {
            ResponseDto <List <ShopTypeGroupDto> > responseDto = new ResponseDto <List <ShopTypeGroupDto> >();

            responseDto.IsSuccess = true;

            Enums.Languages languageId = Session.RealPerson.LanguageId;

            responseDto.Dto = Business.Stc.EnumShopTypeList.
                              GroupBy(x => x.GroupId).Select(x => x.First()).
                              Select(
                x => new ShopTypeGroupDto()
            {
                Id         = x.GroupId,
                Name       = Business.Stc.GetDicValue(x.GroupName, languageId),
                GroupOrder = x.GroupOrder,
                TypeList   = Business.Stc.EnumShopTypeList.Where(y => y.GroupId == x.GroupId).Select(
                    y => new ShopTypeDto()
                {
                    Id   = y.Id,
                    Name = Business.Stc.GetDicValue(y.TypeName, languageId)
                }).ToList()
            }).OrderBy(k => k.GroupOrder).ToList();

            return(responseDto);
        }
Beispiel #3
0
    public void ChangedLanguage(bool isNext)
    {
        Language = (Enums.Languages)Enum.Parse(typeof(Enums.Languages), PlayerPrefs.GetString("Language", "EU"));
        var newLang = Language.Next();

        if (!isNext)
        {
        }
        LanguageOption.GetComponent <Image>().sprite = Flags[(int)newLang];
        PlayerPrefs.SetString("Language", newLang.ToString());
    }
Beispiel #4
0
        //protected string GetDicValue(string key, params string[] param)
        //{
        //    Enums.Languages language = Enums.Languages.Turkce;
        //    if (Session != null)
        //    {
        //        RealPersonBo realPersonBo = Session.RealPerson;
        //        if (realPersonBo != null)
        //            language = realPersonBo.LanguageId;
        //    }

        //    return GetDicValue(key, language, param);
        //}
        public static string GetbyLang(DicItem dicItem, Enums.Languages language)
        {
            switch (language)
            {
            case Enums.Languages.xTurkish:
                return(dicItem.Tr);

            case Enums.Languages.xEnglish:
                return(dicItem.En);

            default:
                return(dicItem.Tr);
            }
        }
Beispiel #5
0
        public static string GetDicValue(string key, Enums.Languages language, params string[] param)
        {
            if (Stc.DicItemList == null || Stc.DicItemList.Count == 0)
            {
                return(key);
            }

            DicItem item = Stc.DicItemList.Where(x => x.Key == key).FirstOrDefault();

            if (item == null)
            {
                return(key);
            }

            return(GetbyLang(item, language));
        }
Beispiel #6
0
    void Start()
    {
        Language  = (Enums.Languages)Enum.Parse(typeof(Enums.Languages), PlayerPrefs.GetString("Language", "EU"));
        Music     = PlayerPrefs.GetInt("Music", 1);
        Sounds    = PlayerPrefs.GetInt("Sounds", 1);
        Vibration = PlayerPrefs.GetInt("Vibration", 1);

        SoundsOption    = GameObject.Find("SoundsOption").gameObject;
        MusicOption     = GameObject.Find("MusicOption").gameObject;
        VibrationOption = GameObject.Find("VibrationOption").gameObject;
        LanguageOption  = GameObject.Find("LanguageOption").gameObject;

        SoundsOption.GetComponent <Image>().sprite    = Sounds == 1 ? IsOn : IsOff;
        MusicOption.GetComponent <Image>().sprite     = Music == 1 ? IsOn : IsOff;
        VibrationOption.GetComponent <Image>().sprite = Vibration == 1 ? IsOn : IsOff;

        LanguageOption.GetComponent <Image>().sprite = Flags[(int)Language];
    }
Beispiel #7
0
        public static string DictionaryProcessText(string text, Enums.Languages languageId)
        {
            string result = text;

            Regex regex = new Regex("{{x(.+?)}}");

            MatchCollection mc = regex.Matches(text);

            if (mc != null && mc.Count > 0)
            {
                string word = null;
                foreach (Match item in mc)
                {
                    word   = "x" + item.Groups[1].ToString();
                    result = result.Replace("{{" + word + "}}", Business.Stc.GetDicValue(word, languageId));
                }
            }

            return(result);
        }
Beispiel #8
0
        public static bool NeedToSendDics(string changeSetId, Enums.Languages langId)
        {
            bool result = false;

            if (changeSetId.IsGuid())
            {
                Guid dicChangeSetId   = changeSetId.ToGuid();
                Guid dicChangeSetIdMe = Business.Stc.GetDicChangeSetId(langId);
                if (dicChangeSetId != dicChangeSetIdMe)
                {
                    result = true;
                }
            }
            else
            {
                result = true;
            }

            return(result);
        }
Beispiel #9
0
        public static Guid GetDicChangeSetId(Enums.Languages langId)
        {
            Guid result;

            DicItem dicItem = DicItemList.Where(x => x.Id == -1).First();

            switch (langId)
            {
            case Enums.Languages.xTurkish:
                result = dicItem.Tr.ToGuid();
                break;

            case Enums.Languages.xEnglish:
                result = dicItem.En.ToGuid();
                break;

            default:
                result = dicItem.Tr.ToGuid();
                break;
            }

            return(result);
        }
Beispiel #10
0
        /// <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);
        }
Beispiel #11
0
        //protected string GetDicValue(string key, params string[] param)
        //{
        //    Enums.Languages language = Enums.Languages.Turkce;
        //    if (Session != null)
        //    {
        //        RealPersonBo realPersonBo = Session.RealPerson;
        //        if (realPersonBo != null)
        //            language = realPersonBo.LanguageId;
        //    }

        //    return GetDicValue(key, language, param);
        //}
        protected string GetbyLang(DicItem dicItem, Enums.Languages language)
        {
            return(Stc.GetbyLang(dicItem, language));
        }
Beispiel #12
0
 protected string GetDicValue(string key, Enums.Languages language, params string[] param)
 {
     return(Stc.GetDicValue(key, language, param));
 }
Beispiel #13
0
 protected string GetDicValue(int Id, Enums.Languages language, params string[] param)
 {
     return(GetDicValue(Id, language, param));
 }
 static void InitLocalization()
 {
     language = (Enums.Languages)Enum.Parse(typeof(Enums.Languages), PlayerPrefs.GetString("Language", "EU"));
     loc      = LocalizationContainer.Load();
 }
Beispiel #15
0
        public ResponseBo <List <PosProductShortCutListBo> > GetShortCutList(long shopId, long operatorRealId, Enums.Languages languageId)
        {
            ResponseBo <List <PosProductShortCutListBo> > responseBo = new ResponseBo <List <PosProductShortCutListBo> >();

            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("@ShopId", shopId, DbType.Int64, ParameterDirection.Input);
                    p.Add("@OperatorRealId", operatorRealId, DbType.Int64, ParameterDirection.Input);
                    p.Add("@LanguageId", languageId, DbType.Int32, ParameterDirection.Input);

                    responseBo.Bo        = conn.Query <PosProductShortCutListBo>("spPosProductShortCutList", 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, null).ToResponse <List <PosProductShortCutListBo> >();
            }

            return(responseBo);
        }
Beispiel #16
0
        public ResponseBo Register(RegisterBo registerBo)
        {
            ResponseBo responseBo = new ResponseBo();

            try
            {
                Enums.Languages langId = registerBo.LanguageId;

                #region Checks
                if (registerBo == null)
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xInvalidData", langId);

                    return(responseBo);
                }
                if (registerBo.Username.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xEmailCantBeEmpty", langId);

                    return(responseBo);
                }
                if (registerBo.Name.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xFirstNameCantBeEmpty", langId);

                    return(responseBo);
                }
                if (registerBo.Surname.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xLastNameCantBeEmpty", langId);

                    return(responseBo);
                }

                if (registerBo.Password.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xPasswordCantBeEmpty", langId);

                    return(responseBo);
                }
                if (Validation.ValidateEmail(registerBo.Username) == false)
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xEnterValidMailAddress", langId);

                    return(responseBo);
                }

                if (registerBo.HaveShopToo && registerBo.ShopShortName.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xShopSignNameCantBeEmpty", langId);

                    return(responseBo);
                }
                if (registerBo.HaveShopToo && registerBo.ShopTypeId.IsNull())
                {
                    responseBo.IsSuccess = false;
                    responseBo.Message   = GetDicValue("xSelectShopType", langId);

                    return(responseBo);
                }
                #endregion

                // we may change it later.
                // but username equals to email.
                registerBo.Email = registerBo.Username;

                using (SqlConnection conn = DbAccess.Connection.GetConn())
                {
                    var p = new DynamicParameters();
                    p.Add("@Id", dbType: DbType.Int64, direction: ParameterDirection.Output);
                    p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255);
                    p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output);
                    p.Add("@Name", registerBo.Name, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@Surname ", registerBo.Surname, DbType.String, ParameterDirection.Input, 50);
                    p.Add("@Username", registerBo.Username, DbType.String, ParameterDirection.Input, 250);
                    p.Add("@Password", registerBo.Password, DbType.String, ParameterDirection.Input, 250);
                    p.Add("@Email", registerBo.Email, DbType.String, ParameterDirection.Input, 250);
                    p.Add("@LanguageId", registerBo.LanguageId, DbType.Int32, ParameterDirection.Input);

                    p.Add("@GenderId", registerBo.GenderId, DbType.Int32, ParameterDirection.Input);
                    p.Add("@Birthdate", registerBo.Birthdate, DbType.Date, ParameterDirection.Input);

                    p.Add("@HaveShopToo", registerBo.HaveShopToo, DbType.Boolean, ParameterDirection.Input);
                    p.Add("@ShopShortName", registerBo.ShopShortName, DbType.String, ParameterDirection.Input, 255);
                    p.Add("@ShopTypeId", registerBo.ShopTypeId, DbType.Int32, ParameterDirection.Input);

                    var user = conn.Execute("spAuthRegister", p, commandType: CommandType.StoredProcedure);
                    responseBo.ReturnedId = p.Get <long?>("@Id");
                    responseBo.Message    = p.Get <string>("@Message");
                    responseBo.IsSuccess  = p.Get <bool>("@IsSuccess");
                }
            }
            catch (Exception ex)
            {
                responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, null);
            }

            return(responseBo);
        }
 void Awake()
 {
     language = (Enums.Languages)Enum.Parse(typeof(Enums.Languages), PlayerPrefs.GetString("Language", "EU"));
 }