public ActionResult AddLanguage([FromBody] AddLanguageViewModel language)
 {
     {
         if (ModelState.IsValid)
         {
             String id          = " ";
             String talentId    = String.IsNullOrWhiteSpace(id) ? _userAppContext.CurrentUserId : id;
             var    addLanguage = new UserLanguage
             {
                 Id            = ObjectId.GenerateNewId().ToString(),
                 UserId        = _userAppContext.CurrentUserId,
                 Language      = language.Name,
                 LanguageLevel = language.Level,
                 IsDeleted     = false
             };
             var user = _userRepository.GetByIdAsync(talentId).Result;
             user.Languages.Add(addLanguage);
             _userRepository.Update(user);
             return(Json(new { Success = true }));
         }
         return(Json(new { Success = false }));
     }
 }
        public async Task <T> GetResourceAsync <T>(string url, UserLanguage Lang, params string[] paramters)
        {
            using (var client = new HttpClient())
            {
                string apiServiceUrl = SharedClass.ApiServerUrl + (Lang == UserLanguage.English ? "en" : "ar") + "/";

                //Passing service base url
                client.BaseAddress = new Uri(apiServiceUrl);

                client.DefaultRequestHeaders.Clear();
                //Define request data format
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var urlParams = new StringBuilder();

                foreach (string param in paramters)
                {
                    urlParams.Append(param + "/");
                }

                var paramList = urlParams.ToString();
                var fullUrl   = string.IsNullOrEmpty(paramList) ? url : url + paramList;

                //Sending request to find web api REST service resource GetAllEmployees using HttpClient
                var response = await client.GetAsync(fullUrl);

                //Checking the response is successful or not which is sent using HttpClient
                if (response.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var data = await response.Content.ReadAsAsync <T>();

                    return(data);
                }
                return(default(T));
            }
        }
Exemple #3
0
        public IEnumerable <Lead> GetLeadsByMobile(string Mobile, UserLanguage lang)
        {
            string functionToGetProblemsName = lang == UserLanguage.Arabic ? "getOptionSetDisplay" : "getOptionSetDisplayen";

            string query = String.Format(@"select
	                                        cl.LeadId,
	                                        cl.new_cityId,
	                                        cl.new_cityidName,
	                                        cl.new_districtidName,
	                                        cl.new_regionName,
	                                        cl.FirstName,
	                                        cl.LastName,
	                                        cl.companyname,
	                                        cl.new_sector,
	                                        [dbo].[{0}]('new_sector','Lead', cl.new_sector) as sectorName,
	                                        cl.industrycode,
	                                        cl.new_salespersonName,
	                                        cl.new_molfile,
	                                        cl.new_medicallead,
	                                        cl.mobilephone,
	                                        cl.emailaddress1,
	                                        cl.Description,
	                                        cl.StatusCode,
	                                        [dbo].[{0}]('StatusCode','Lead', cl.StatusCode) as statusName,
	                                        cl.new_leadservicetype,
	                                        [dbo].[{0}]('new_leadservicetype','Lead', cl.new_leadservicetype) as serviceTypeName,
                                            cl.address1_line1,
                                            cl.JobTitle,
                                            cl.CreatedOn
	                                        from Lead cl
                                            where cl.mobilephone = '{1}' and
                                            cl.CreatedOn BETWEEN DATEADD(day,DATEDIFF(day,2,GETDATE()),0) and GETDATE()", functionToGetProblemsName, Mobile);

            DataTable dt = CRMAccessDB.SelectQ(query).Tables[0];

            return(dt.AsEnumerable().Select(dataRow => new Lead(dataRow)));
        }
Exemple #4
0
        internal string GetTermsForMobile(UserLanguage lang)
        {
            try
            {
                //1-Getting all RV that dident saved in CRM
                string    sql = @" select * FROM [LaborServices].[dbo].[Localizations]
  where [ResourceId] like 'TermsDataForMobile' and [LocaleId] like '" + (lang == UserLanguage.Arabic ? "ar" : "en") + "'";
                DataTable dt  = CRMAccessDB.SelectQlabourdb(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string terms = dt.Rows[i]["Value"].ToString();
                        return(terms);
                    }
                }
            }
            catch (Exception e)
            {
                return("");
            }

            return("");
        }
Exemple #5
0
    void LoopLanguage()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            isEnglish = !isEnglish;
            if (isEnglish)
            {
                tEnglish.color = Color.red;
                tEspanol.color = Color.white;
            }
            else
            {
                tEnglish.color = Color.white;
                tEspanol.color = Color.red;
            }
        }
        if (Input.GetKeyDown(KeyCode.Return))
        {
            if (isEnglish)
            {
                language = UserLanguage.English;
            }
            else
            {
                language = UserLanguage.Spanish;
            }

            GameManager.Instance.actualLenguaje = language;
            UpdateTexts();
            tEspanol.gameObject.SetActive(false);
            tEnglish.gameObject.SetActive(false);
            tSeparador.gameObject.SetActive(false);
            tOptions.color = Color.red;
            isMainMenu     = true;
        }
    }
        public ServiceContractPerHour GetHourlyContractDetails(string contractId, UserLanguage Language)
        {
            string optionSetGetValFn, otherLangOptionSetGetValFn;

            switch (Language)
            {
            case UserLanguage.Arabic:
                optionSetGetValFn          = "dbo.getOptionSetDisplay";
                otherLangOptionSetGetValFn = "dbo.getOptionSetDisplayen";
                break;

            default:
                optionSetGetValFn          = "dbo.getOptionSetDisplayen";
                otherLangOptionSetGetValFn = "dbo.getOptionSetDisplay";
                break;
            }

            string query = String.Format(@"select contract.new_hindvcontractid,
	   contract.new_contractnumber,
	   hourlypricing.new_name as hourlypricingname,
	    Contract.new_finalprice,
		Contract.new_contractmonth,
		Isnull(appointment.userrate,0) as userrate,
		appointment.nextappointment,
        contract.new_city,
        contract.new_cityName,
        contract.new_district,
        contract.new_districtName ,
        hourlypricing.new_nationalityName,
        hourlypricing.new_nationality,
		contract.new_selecteddays,
		contract.new_shift,
		contract.new_vatrate	as vatrate,


		contract.new_hoursnumber,
		contract.new_weeklyvisits,
		contract.new_totalprice_def as totalprice,
		contract.new_totalprice_def ,
		ISNULL(contract.new_vatrate,0) * 100 as new_vatrate,
		contract.new_vatamount,
		contract.new_discount_def,
		Round(contract.new_weeklyvisits * contract.new_hoursnumber * Contract.new_contractmonth * hourlypricing.new_hourprice,2,2) as totalPriceBeforeDiscount,
		contract.new_employeenumber,
        contract.new_latitude,
		contract.new_longitude,
        Convert(date, contract.new_contractstartdate) as new_contractstartdate,
        Isnull({0}('new_contractmonth','new_HIndvContract',Contract.new_contractmonth),{1}('new_contractmonth','new_HIndvContract',Contract.new_contractmonth) ) as durationname,
        Contract.statuscode,
  Contract.createdon,
        Isnull({2}('statuscode','new_HIndvContract',Contract.statuscode),{3}('statuscode','new_HIndvContract',Contract.statuscode) ) as statusname,
    contract.new_HIndivClintnameName,
    contact.mobilephone,
		  contract.new_HIndivClintname

		  --contract.new_discount_def,contract.new_totalprice_def,contract.new_totalvisits_def,contract.new_monthvisits_def,
		  --contract.new_contractmonth,,Contract.new_selectedshifts,Contract.new_visitprice_def,
		  --
		  --hourlypricing.new_hourlypricingId,
		  from new_HIndvContract  contract inner join new_hourlypricing hourlypricing on contract.new_houlrypricing=hourlypricing.new_hourlypricingId 
		  left outer join (
		  select new_hourlyappointmentBase.new_servicecontractperhour, 
		  IIF(  Count(new_hourlyappointmentBase.new_rate) > 0, ROUND( Sum(Isnull(new_hourlyappointmentBase.new_rate,0)) / Count(new_hourlyappointmentBase.new_rate), 0) , null) as userrate,
		  max(new_hourlyappointmentBase.new_shiftstart) as nextAppointment
		  from new_hourlyappointmentBase
		  where Convert (date, new_shiftstart) <= Convert(date,GetDate())
		  group by new_servicecontractperhour
		  ) as  appointment on new_servicecontractperhour= contract.new_HIndvContractId
        left outer join contact on contact.contactid = contract.new_HIndivClintname
		  where  contract.new_hindvcontractid = '{4}'
  order by contract.new_ContractNumber desc", optionSetGetValFn, otherLangOptionSetGetValFn, optionSetGetValFn, otherLangOptionSetGetValFn, contractId);

            DataTable dt = CRMAccessDB.SelectQ(query).Tables[0];

            if (dt.Rows.Count == 0)
            {
                return(null);
            }

            var contract = new ServiceContractPerHour(dt.Rows[0], Language);

            contract.HourlyPricingCost = new HourlyPricingCost(dt.Rows[0]);
            return(contract);
        }
Exemple #7
0
 public void UpdateText(UserLanguage language)
 {
     targetText.text = LocalizationManager.Instance.TryGetText(language, textKey);
 }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            //Your code here;
            // TODO: Update method
            try
            {
                User existingUser = await _userRepository.GetByIdAsync(updaterId);

                existingUser.FirstName      = model.FirstName;
                existingUser.LastName       = model.LastName;
                existingUser.Email          = model.Email;
                existingUser.Phone          = model.Phone;
                existingUser.Address        = model.Address;
                existingUser.Nationality    = model.Nationality;
                existingUser.Summary        = model.Summary;
                existingUser.Description    = model.Description;
                existingUser.LinkedAccounts = model.LinkedAccounts;
                existingUser.CvName         = model.CvName;
                existingUser.CvName         = model.CvUrl;

                List <UserLanguage> userLanguagesList = new List <UserLanguage>();
                if (model.Languages != null)
                {
                    model.Languages.ForEach(language =>
                    {
                        UserLanguage userLanguage = LanguageFromViewModel(language);
                        userLanguagesList.Add(userLanguage);
                    });

                    existingUser.Languages = userLanguagesList;
                }


                List <UserSkill> userSkillsList = new List <UserSkill>();
                if (model.Skills != null)
                {
                    model.Skills.ForEach(skill =>
                    {
                        UserSkill userSkill = SkillFromViewModel(skill);
                        userSkillsList.Add(userSkill);
                    });

                    existingUser.Skills = userSkillsList;
                }


                List <UserExperience> userExperiencesList = new List <UserExperience>();
                if (model.Experience != null)
                {
                    model.Experience.ForEach(experience =>
                    {
                        UserExperience userExperience = ExperienceFromViewModel(experience);
                        userExperiencesList.Add(userExperience);
                    });

                    existingUser.Experience = userExperiencesList;
                }

                existingUser.VisaStatus       = model.VisaStatus;
                existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                existingUser.JobSeekingStatus = model.JobSeekingStatus;

                existingUser.ProfilePhoto    = model.ProfilePhoto;
                existingUser.ProfilePhotoUrl = model.ProfilePhotoUrl;

                // Update
                await _userRepository.Update(existingUser);

                return(true);
            }
            catch (Exception e)
            {
                return(false);

                throw e;
            }
            //throw new NotImplementedException();
        }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    var user = (await _userRepository.GetByIdAsync(updaterId));
                    user.LinkedAccounts   = model.LinkedAccounts;
                    user.Summary          = model.Summary;
                    user.Description      = model.Description;
                    user.FirstName        = model.FirstName;
                    user.LastName         = model.LastName;
                    user.Email            = model.Email;
                    user.Phone            = model.Phone;
                    user.Address          = model.Address;
                    user.Nationality      = model.Nationality;
                    user.VisaStatus       = model.VisaStatus;
                    user.VisaExpiryDate   = model.VisaExpiryDate;
                    user.JobSeekingStatus = model.JobSeekingStatus;

                    var newLanguage = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var language = user.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguage.Add(language);
                    }

                    user.Languages = newLanguage;

                    var newSkill = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = user.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkill.Add(skill);
                    }
                    user.Skills = newSkill;

                    var newExperience = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var experience = user.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (experience == null)
                        {
                            experience = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString(),
                            };
                        }
                        UpdateExperienceFromView(item, experience);
                        newExperience.Add(experience);
                    }
                    user.Experience = newExperience;

                    await _userRepository.Update(user);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }
            //Your code here;
            //throw new NotImplementedException();
        }
Exemple #10
0
        public Promotion GetPromotionByCode(RequestHourlyPricing requestHourlyPricing, UserLanguage Lang)
        {
            string code = requestHourlyPricing.PromotionCode;

            if (string.IsNullOrEmpty(code))
            {
                code = DefaultValues.ServiceContractPerHour_DefaultPromotionCode;
            }

            string    query = String.Format(@"select new_promotionslistId,
                                            new_name,new_code,new_description,new_freevisits,new_discount,
                                            new_fixeddiscount,new_availalbe,new_fromdate,new_todate
                                            from new_promotionslist where new_availalbe = 1 and new_code='{0}'", code);
            DataTable dt    = CRMAccessDB.SelectQ(query).Tables[0];

            if (dt.Rows.Count == 0 && code != DefaultValues.ServiceContractPerHour_DefaultPromotionCode)
            {
                requestHourlyPricing.PromotionCode = DefaultValues.ServiceContractPerHour_DefaultPromotionCode;

                return(GetPromotionByCode(requestHourlyPricing, Lang));
            }

            bool checkresult = true;

            PropertyInfo[] properties = typeof(RequestHourlyPricing).GetProperties();

            InvalidProperties = new List <string>();

            foreach (PropertyInfo property in properties)
            {
                string propValue = property.GetValue(requestHourlyPricing) != null?property.GetValue(requestHourlyPricing).ToString() : "";

                if (!string.IsNullOrEmpty(propValue))
                {
                    bool isPromotionValid = checkpromotionvalidation(property.Name, propValue, dt.Rows[0]["new_promotionslistId"].ToString());
                    checkresult = isPromotionValid && checkresult;
                }
            }

            if (checkresult == false)
            {
                //requestHourlyPricing.PromotionCode = DefaultValues.ServiceContractPerHour_DefaultPromotionCode;

                string    query1 = String.Format(@"select new_promotionslistId,
                                            new_name,new_code,new_description,new_freevisits,new_discount,
                                            new_fixeddiscount,new_availalbe,new_fromdate,new_todate
                                            from new_promotionslist where new_code='{0}'", DefaultValues.ServiceContractPerHour_DefaultPromotionCode);
                DataTable dt1    = CRMAccessDB.SelectQ(query1).Tables[0];

                var p = new Promotion(dt1.AsEnumerable().FirstOrDefault());

                //var p = GetPromotionByCode(requestHourlyPricing);

                string errorMessage = "";

                if (Lang == UserLanguage.Arabic)
                {
                    errorMessage = "كود الخصم غير مناسب مع الباقة المختارة";
                }
                else
                {
                    errorMessage = "Invalid Promotion With Selected Package. ";
                }
                //if (InvalidProperties.Any())
                //{
                //    InvalidProperties.ForEach(s =>
                //    {
                //        errorMessage += " [ " + s + " ] ";
                //    });
                //}
                p.Name = errorMessage;
                return(p);
            }

            var validPromotion = new Promotion(dt.AsEnumerable().FirstOrDefault());

            validPromotion.Name = validPromotion.Description;

            return(validPromotion);
            //return dt.AsEnumerable().Select(dataRow => new Promotion(dataRow));
        }
Exemple #11
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            User user = await _userRepository.GetByIdAsync(model.Id);

            user.FirstName             = model.FirstName;
            user.MiddleName            = model.MiddleName;
            user.LastName              = model.LastName;
            user.Gender                = model.Gender;
            user.Email                 = model.Email;
            user.Phone                 = model.Phone;
            user.MobilePhone           = model.MobilePhone;
            user.IsMobilePhoneVerified = model.IsMobilePhoneVerified;
            user.Address               = model.Address;
            user.Nationality           = model.Nationality;
            user.VisaStatus            = model.VisaStatus;
            user.VisaExpiryDate        = model.VisaExpiryDate;
            user.VideoName             = model.VideoName;
            user.ProfilePhotoUrl       = model.ProfilePhotoUrl;
            //VideoUrl = "", //additional here
            user.CvName = model.CvName;
            //CvUrl = "",
            user.Summary          = model.Summary;
            user.Description      = model.Description;
            user.LinkedAccounts   = model.LinkedAccounts;
            user.JobSeekingStatus = model.JobSeekingStatus;

            var newLanguages   = new List <UserLanguage>();
            var newSkills      = new List <UserSkill>();
            var newExperiences = new List <UserExperience>();

            model.Languages.ForEach(mLanguage => {
                UserLanguage language = null;
                if (mLanguage.Id == null)
                {
                    language = new UserLanguage
                    {
                        Id        = ObjectId.GenerateNewId().ToString(),
                        IsDeleted = false
                    };
                }
                else
                {
                    language = user.Languages.SingleOrDefault(x => x.Id == mLanguage.Id);
                    if (language == null)
                    {
                        language = new UserLanguage
                        {
                            Id        = ObjectId.GenerateNewId().ToString(),
                            IsDeleted = false
                        };
                    }
                }

                language.UserId        = user.Id;
                language.Language      = mLanguage.Name;
                language.LanguageLevel = mLanguage.Level;
                newLanguages.Add(language);
            });

            user.Languages.ForEach(uLanguage => {
                if (uLanguage.IsDeleted == false)
                {
                    bool deleted = true;
                    model.Languages.ForEach(mLanguage =>
                    {
                        if (mLanguage.Id != null && uLanguage.Id.Equals(mLanguage.Id))
                        {
                            deleted = false;
                        }
                    });
                    if (deleted == true)
                    {
                        uLanguage.IsDeleted = true;
                        newLanguages.Add(uLanguage);
                    }
                }
            });

            model.Skills.ForEach(mSkill => {
                UserSkill skill = null;
                if (mSkill.Id == null)
                {
                    skill = new UserSkill
                    {
                        Id        = ObjectId.GenerateNewId().ToString(),
                        IsDeleted = false
                    };
                }
                else
                {
                    skill = user.Skills.SingleOrDefault(x => x.Id == mSkill.Id);
                    if (skill == null)
                    {
                        skill = new UserSkill
                        {
                            Id        = ObjectId.GenerateNewId().ToString(),
                            IsDeleted = false
                        };
                    }
                }

                skill.UserId          = user.Id;
                skill.Skill           = mSkill.Name;
                skill.ExperienceLevel = mSkill.Level;
                newSkills.Add(skill);
            });

            user.Skills.ForEach(uSkill => {
                if (uSkill.IsDeleted == false)
                {
                    bool deleted = true;
                    model.Skills.ForEach(mSkill =>
                    {
                        if (mSkill.Id != null && uSkill.Id.Equals(mSkill.Id))
                        {
                            deleted = false;
                        }
                    });
                    if (deleted == true)
                    {
                        uSkill.IsDeleted = true;
                        newSkills.Add(uSkill);
                    }
                }
            });

            model.Experience.ForEach(mExp => {
                UserExperience exp = null;
                if (mExp.Id == null)
                {
                    exp = new UserExperience
                    {
                        Id               = ObjectId.GenerateNewId().ToString(),
                        Company          = mExp.Company,
                        Position         = mExp.Position,
                        Responsibilities = mExp.Responsibilities,
                        Start            = mExp.Start,
                        End              = mExp.End,
                        IsDeleted        = false,
                    };
                }
                else
                {
                    exp = user.Experience.SingleOrDefault(x => x.Id == mExp.Id);
                    if (exp == null)
                    {
                        exp = new UserExperience
                        {
                            Id               = ObjectId.GenerateNewId().ToString(),
                            Company          = mExp.Company,
                            Position         = mExp.Position,
                            Responsibilities = mExp.Responsibilities,
                            Start            = mExp.Start,
                            End              = mExp.End,
                            IsDeleted        = false,
                        };
                    }
                }

                newExperiences.Add(exp);
            });

            user.Experience.ForEach(uExp => {
                if (uExp.IsDeleted == false)
                {
                    bool deleted = true;
                    model.Experience.ForEach(mExp =>
                    {
                        if (mExp.Id != null && uExp.Id.Equals(mExp.Id))
                        {
                            deleted = false;
                        }
                    });
                    if (deleted == true)
                    {
                        uExp.IsDeleted = true;
                        newExperiences.Add(uExp);
                    }
                }
            });

            user.Languages  = newLanguages;
            user.Skills     = newSkills;
            user.Experience = newExperiences;

            //Languages = user.Languages, need for loop
            //Skills = user.Skills,
            //Education = user.Education,
            //Certifications = user.Certifications,
            //Experience = user.Experience,

            await _userRepository.Update(user);

            return(true);
        }
Exemple #12
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (updaterId != null)
                {
                    User user = (await _userRepository.GetByIdAsync(updaterId));
                    user.FirstName = model.FirstName;
                    user.LastName  = model.LastName;
                    user.Email     = model.Email;
                    //  user.CvName = model.CvName;
                    user.Phone = model.Phone;
                    // user.MobilePhone = model.MobilePhone;
                    // user.IsMobilePhoneVerified = model.IsMobilePhoneVerified;
                    // user.Gender = model.Gender;
                    user.Address     = model.Address;
                    user.Nationality = model.Nationality;
                    user.Description = model.Description;
                    user.Summary     = model.Summary;
                    user.Location    = null;
                    //    user.MiddleName = null;
                    user.VisaStatus     = model.VisaStatus;
                    user.VisaExpiryDate = model.VisaExpiryDate;
                    //user.VideoName = model.VideoName;
                    //user.Videos = null;
                    user.ProfilePhoto     = model.ProfilePhoto;
                    user.ProfilePhotoUrl  = model.ProfilePhotoUrl;
                    user.LinkedAccounts   = model.LinkedAccounts;
                    user.JobSeekingStatus = model.JobSeekingStatus;
                    user.UpdatedBy        = updaterId;
                    user.UpdatedOn        = DateTime.Now;

                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = user.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                UserId    = _userAppContext.CurrentUserId,
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }
                    user.Skills = newSkills;

                    var newLans = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var lan = user.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (lan == null)
                        {
                            lan = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                UserId    = _userAppContext.CurrentUserId,
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, lan);
                        newLans.Add(lan);
                    }
                    user.Languages = newLans;

                    var newExps = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var exp = user.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (exp == null)
                        {
                            exp = new UserExperience
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateExperienceFromView(item, exp);
                        newExps.Add(exp);
                    }
                    user.Experience = newExps;

                    //var newCerts = new List<UserCertification>();
                    //foreach (var item in model.Certifications)
                    //{
                    //    var cert = user.Certifications.SingleOrDefault(x => x.Id == item.Id);
                    //    if (cert == null)
                    //    {
                    //        cert = new UserCertification
                    //        {
                    //            Id = ObjectId.GenerateNewId().ToString(),
                    //            IsDeleted = false
                    //        };
                    //    }
                    //    UpdateCertificationFromView(item, cert);
                    //    newCerts.Add(cert);
                    //}
                    //user.Certifications = newCerts;

                    //var newEdus = new List<UserEducation>();
                    //foreach (var item in model.Education)
                    //{
                    //    var edu = user.Education.SingleOrDefault(x => x.Id == item.Id);
                    //    if (edu == null)
                    //    {
                    //        edu = new UserEducation
                    //        {
                    //            Id = ObjectId.GenerateNewId().ToString(),
                    //            IsDeleted = false
                    //        };
                    //    }
                    //    UpdateEducationFromView(item, edu);
                    //    newEdus.Add(edu);
                    //}
                    //user.Education = newEdus;
                    Console.WriteLine(user);
                    await _userRepository.Update(user);

                    return(true);
                }
                return(false);
            }

            catch (MongoException e)
            {
                Console.WriteLine(e.Data);
                return(false);
            }
        }
Exemple #13
0
 private void UpdateLanguageFromView(UserLanguage item, UserLanguage language)
 {
     //throw new NotImplementedException();
 }
Exemple #14
0
        static void Main(string[] args)
        {
            using (var context = new LanguagesContext())
            {
                var languageHello = new Translations
                {
                    GermanWord  = "hallo",
                    SpanishWord = "hola",
                    ItalianWord = "ciao",
                    EnglishWord = "hello",
                };
                var languageMorning = new Translations
                {
                    GermanWord  = "morgen",
                    SpanishWord = "manana",
                    ItalianWord = "mattina",
                    EnglishWord = "morning"
                };
                var languageCat = new Translations
                {
                    GermanWord  = "katze",
                    SpanishWord = "gato",
                    ItalianWord = "gatto",
                    EnglishWord = "cat"
                };
                var languageDog = new Translations
                {
                    GermanWord  = "hund",
                    SpanishWord = "perro",
                    ItalianWord = "cane",
                    EnglishWord = "dog"
                };
                var UserChris = new Users
                {
                    UserName = "******",
                    Location = "Louisville"
                };
                var UserMorgan = new Users
                {
                    UserName = "******",
                    Location = "Nashville"
                };
                var UserChristian = new Users
                {
                    UserName = "******",
                    Location = "Nashville"
                };

                var UserBrooklyn = new Users
                {
                    UserName = "******",
                    Location = "Shepherdsville"
                };
                var GermanMorgan = new UserLanguage
                {
                    LanguageChoice = LanguageId.German
                };
                var SpanishMorgan = new UserLanguage
                {
                    LanguageChoice = LanguageId.Spanish
                };
                var GermanChris = new UserLanguage
                {
                    LanguageChoice = LanguageId.German
                };
                var ItalianChris = new UserLanguage
                {
                    LanguageChoice = LanguageId.Italian
                };
                UserMorgan.LanguageIds.Add(GermanMorgan);
                UserMorgan.LanguageIds.Add(SpanishMorgan);
                UserChris.LanguageIds.Add(GermanChris);
                UserChris.LanguageIds.Add(ItalianChris);
                context.Translations.AddRange(new List <Translations> {
                    languageHello, languageMorning, languageCat, languageDog
                });
                context.Users.AddRange(new List <Users> {
                    UserChris, UserMorgan, UserBrooklyn
                });
                context.SaveChanges();
            }
        }
 public static void ChangeLanguage(UserLanguage newLanguage)
 {
     OnLanguageChanged?.Invoke(language, new SettingChangedEventArgs <UserLanguage>(language.Value, newLanguage));
     language.Value = newLanguage;
 }
Exemple #16
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    User existingUser = await _userRepository.GetByIdAsync(model.Id);

                    existingUser.Email            = model.Email;
                    existingUser.FirstName        = model.FirstName;
                    existingUser.LastName         = model.LastName;
                    existingUser.LinkedAccounts   = model.LinkedAccounts;
                    existingUser.Phone            = model.Phone;
                    existingUser.Description      = model.Description;
                    existingUser.Summary          = model.Summary;
                    existingUser.Address          = model.Address;
                    existingUser.Nationality      = model.Nationality;
                    existingUser.VisaStatus       = model.VisaStatus;
                    existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                    existingUser.JobSeekingStatus = model.JobSeekingStatus;
                    existingUser.ProfilePhoto     = model.ProfilePhoto;
                    existingUser.ProfilePhotoUrl  = model.ProfilePhotoUrl;

                    var newLanguages = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var language = existingUser.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguages.Add(language);
                    }

                    existingUser.Languages = newLanguages;

                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = existingUser.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }

                    existingUser.Skills = newSkills;

                    var newExperiences = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var experience = existingUser.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (experience == null)
                        {
                            experience = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString()
                            };
                        }
                        UpdateExperienceFromView(item, experience);
                        newExperiences.Add(experience);
                    }

                    existingUser.Experience = newExperiences;

                    existingUser.UpdatedBy = updaterId;
                    existingUser.UpdatedOn = DateTime.Now;

                    await _userRepository.Update(existingUser);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Exemple #17
0
        public IEnumerable <HourlyAppointment> GetHourlyAppointments(string contractId, UserLanguage lang)
        {
            string functionToGetProblemsName = lang == UserLanguage.Arabic ? "getOptionSetDisplay" : "getOptionSetDisplayen";

            string SqlShifts = String.Format(@"select 
                                        new_hourlyappointmentId,
                                        new_servicecontractperhour,
                                        new_employeeName,
                                        new_employee,
                                        new_status,
                                        [dbo].[{0}]('new_status','new_hourlyappointment', new_hourlyappointment.new_status) as statusName,
                                        new_hourlyappointment.new_notes,
                                        dateadd(hh,3,new_shiftend) as new_shiftend ,
                                        dateadd(hh,3,new_shiftstart) as new_shiftstart ,
                                        dateadd(hh,3,new_actualshiftstart) new_actualshiftstart,
                                        dateadd(hh,3,new_actualshiftend) new_actualshiftend,
                                        Isnull( new_rate,0) as new_rate,
                                        new_carid,
                                        new_caridName
                                from new_hourlyappointment inner join new_HIndvContract on new_HIndvContract.new_HIndvContractId = new_hourlyappointment.new_servicecontractperhour
                                where new_hourlyappointment.new_servicecontractperhour = '{1}'
                                order by new_shiftstart", functionToGetProblemsName, contractId);

            var result = CRMAccessDB.SelectQ(SqlShifts).Tables[0].AsEnumerable().Select(dataRow => new HourlyAppointment(dataRow));

            return(result);
        }
Exemple #18
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    User existingTalent = (await _userRepository.GetByIdAsync(model.Id));



                    existingTalent.FirstName        = model.FirstName;
                    existingTalent.MiddleName       = model.MiddleName;
                    existingTalent.LastName         = model.LastName;
                    existingTalent.Gender           = model.Gender;
                    existingTalent.Email            = model.Email;
                    existingTalent.Phone            = model.Phone;
                    existingTalent.MobilePhone      = model.MobilePhone;
                    existingTalent.Address          = model.Address;
                    existingTalent.Nationality      = model.Nationality;
                    existingTalent.Description      = model.Description;
                    existingTalent.VisaStatus       = model.VisaStatus;
                    existingTalent.VisaExpiryDate   = model.VisaExpiryDate;
                    existingTalent.CvName           = model.CvName;
                    existingTalent.Summary          = model.Summary;
                    existingTalent.Description      = model.Description;
                    existingTalent.ProfilePhoto     = model.ProfilePhoto;
                    existingTalent.ProfilePhotoUrl  = model.ProfilePhotoUrl;
                    existingTalent.VideoName        = model.VideoName;
                    existingTalent.LinkedAccounts   = model.LinkedAccounts;
                    existingTalent.JobSeekingStatus = model.JobSeekingStatus;
                    existingTalent.UpdatedBy        = updaterId;
                    existingTalent.UpdatedOn        = DateTime.Now;

                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = existingTalent.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }
                    existingTalent.Skills = newSkills;


                    var newLanguage = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var language = existingTalent.Languages.SingleOrDefault(x => x.Id == item.Id);

                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguage.Add(language);
                    }
                    existingTalent.Languages = newLanguage;


                    var newEducation = new List <UserEducation>();
                    foreach (var item in model.Education)
                    {
                        var education = existingTalent.Education.SingleOrDefault(x => x.Id == item.Id);
                        if (education == null)
                        {
                            education = new UserEducation
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateEducationFromView(item, education);
                        newEducation.Add(education);
                    }
                    existingTalent.Education = newEducation;



                    var newCertifications = new List <UserCertification>();
                    foreach (var item in model.Certifications)
                    {
                        var certifications = existingTalent.Certifications.SingleOrDefault(x => x.Id == item.Id);
                        if (certifications == null)
                        {
                            certifications = new UserCertification
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateCertificationFromView(item, certifications);
                        newCertifications.Add(certifications);
                    }
                    existingTalent.Certifications = newCertifications;

                    var newExperience = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var experience = existingTalent.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (experience == null)
                        {
                            experience = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString(),
                            };
                        }
                        UpdateExperienceFromView(item, experience);
                        newExperience.Add(experience);
                    }
                    existingTalent.Experience = newExperience;


                    await _userRepository.Update(existingTalent);
                }
                return(true);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Exemple #19
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel talent, string updaterId)
        {
            try
            {
                if (talent.Id != null)
                {
                    User existingUser = (await _userRepository.GetByIdAsync(talent.Id));
                    existingUser.FirstName             = talent.FirstName;
                    existingUser.MiddleName            = talent.MiddleName;
                    existingUser.LastName              = talent.LastName;
                    existingUser.Gender                = talent.Gender;
                    existingUser.Email                 = talent.Email;
                    existingUser.Phone                 = talent.Phone;
                    existingUser.MobilePhone           = talent.MobilePhone;
                    existingUser.IsMobilePhoneVerified = talent.IsMobilePhoneVerified;
                    existingUser.Address               = talent.Address;
                    existingUser.Nationality           = talent.Nationality;
                    existingUser.VisaStatus            = talent.VisaStatus;
                    existingUser.JobSeekingStatus      = talent.JobSeekingStatus;
                    existingUser.VisaExpiryDate        = talent.VisaExpiryDate;
                    existingUser.Summary               = talent.Summary;
                    existingUser.Description           = talent.Description;
                    existingUser.ProfilePhoto          = talent.ProfilePhoto;
                    existingUser.ProfilePhotoUrl       = talent.ProfilePhotoUrl;
                    existingUser.VideoName             = talent.VideoName;
                    existingUser.CvName                = talent.CvName;
                    existingUser.LinkedAccounts        = talent.LinkedAccounts;
                    existingUser.UpdatedBy             = updaterId;
                    existingUser.UpdatedOn             = DateTime.Now;

                    var newLanguages = new List <UserLanguage>();
                    foreach (var item in talent.Languages)
                    {
                        var language = existingUser.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguages.Add(language);
                    }
                    existingUser.Languages = newLanguages;

                    var newSkills = new List <UserSkill>();
                    foreach (var item in talent.Skills)
                    {
                        var skill = existingUser.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }
                    existingUser.Skills = newSkills;

                    var newExperience = new List <UserExperience>();
                    foreach (var item in talent.Experience)
                    {
                        var work = existingUser.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (work == null)
                        {
                            work = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString()
                            };
                        }
                        UpdateExperienceFromView(item, work);
                        newExperience.Add(work);
                    }
                    existingUser.Experience = newExperience;

                    await _userRepository.Update(existingUser);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }
        }
Exemple #20
0
        public object UpdateLanguage([FromBody] UserLanguage language)
        {
            if (EnsureUserRights(UserLevel.Default))
            {
                var  user    = GetCurrentUser();
                bool success = false;

                using (var conn = new MySqlConnection(ConnectionString.Get("EscademyDB")))
                {
                    conn.Open();
                    using (var cmd = conn.CreateCommand())
                    {
                        cmd.CommandText = "INSERT INTO esc_profilelanguages (account_id, language_id, level) VALUES(@uid,@language,@level) ON DUPLICATE KEY UPDATE language_id = @language, level = @level";
                        cmd.Parameters.AddWithValue("@uid", user.Id);
                        cmd.Parameters.AddWithValue("@language", language.Language);
                        cmd.Parameters.AddWithValue("@level", language.Level);

                        success = cmd.ExecuteNonQuery() >= 1;
                    }

                    conn.Close();
                }

                return(Json(new { auth = "OK", success, language = language.Language, level = language.Level, levelText = UserLanguage.GetLevelText(language.Level), languageText = UserLanguage.GetLanguageString(language.Language) }));
            }
            return(Json(new { auth = "NO_AUTH" }));
        }
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try
            {
                if (model.Id != null)
                {
                    User existingUser = await _userRepository.GetByIdAsync(model.Id);

                    //languages
                    var newLanguages = new List <UserLanguage>();
                    foreach (var item in model.Languages)
                    {
                        var language = existingUser.Languages.SingleOrDefault(x => x.Id == item.Id);
                        if (language == null)
                        {
                            language = new UserLanguage
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateLanguageFromView(item, language);
                        newLanguages.Add(language);
                    }
                    //skills
                    var newSkills = new List <UserSkill>();
                    foreach (var item in model.Skills)
                    {
                        var skill = existingUser.Skills.SingleOrDefault(x => x.Id == item.Id);
                        if (skill == null)
                        {
                            skill = new UserSkill
                            {
                                Id        = ObjectId.GenerateNewId().ToString(),
                                IsDeleted = false
                            };
                        }
                        UpdateSkillFromView(item, skill);
                        newSkills.Add(skill);
                    }

                    //Experience
                    var newExperience = new List <UserExperience>();
                    foreach (var item in model.Experience)
                    {
                        var experience = existingUser.Experience.SingleOrDefault(x => x.Id == item.Id);
                        if (experience == null)
                        {
                            experience = new UserExperience
                            {
                                Id = ObjectId.GenerateNewId().ToString()
                            };
                        }
                        UpdateExperienceFromView(item, experience);
                        newExperience.Add(experience);
                    }
                    //var newJob= new JobSeekingStatus
                    //{
                    //    Status = "Actively looking for a job",
                    //    AvailableDate = DateTime.Now
                    // };


                    //assigning values
                    existingUser.Experience            = newExperience;
                    existingUser.Skills                = newSkills;
                    existingUser.Languages             = newLanguages;
                    existingUser.FirstName             = model.ContactDetails.FirstName;
                    existingUser.MiddleName            = model.MiddleName;
                    existingUser.LastName              = model.ContactDetails.LastName;
                    existingUser.Gender                = model.Gender;
                    existingUser.Email                 = model.ContactDetails.Email;
                    existingUser.Phone                 = model.ContactDetails.Phone;
                    existingUser.MobilePhone           = model.MobilePhone;
                    existingUser.IsMobilePhoneVerified = model.IsMobilePhoneVerified;
                    existingUser.Address               = model.Address;
                    existingUser.Nationality           = model.Nationality;
                    existingUser.VisaStatus            = model.VisaStatus;
                    existingUser.VisaExpiryDate        = model.VisaExpiryDate;
                    existingUser.CvName                = model.CvName;
                    existingUser.Summary               = model.Summary;
                    existingUser.Description           = model.Description;
                    existingUser.LinkedAccounts        = model.LinkedAccounts;
                    existingUser.JobSeekingStatus      = model.JobSeekingStatus;
                    existingUser.UpdatedBy             = updaterId;
                    existingUser.UpdatedOn             = DateTime.Now;

                    await _userRepository.Update(existingUser);

                    return(true);
                }
                return(false);
            }
            catch (MongoException e)
            {
                return(false);
            }

            //Your code here;
            //throw new NotImplementedException();
        }
 protected void UpdateLanguageFromView(AddLanguageViewModel model, UserLanguage original)
 {
     original.LanguageLevel = model.Level;
     original.Language      = model.Name;
 }
Exemple #23
0
        private void changeLanguage(UserLanguage userLanguage)
        {
            CultureInfo newCulture;

            switch (userLanguage)
            {
                case UserLanguage.en:
                    newCulture = new CultureInfo("en");
                    break;
                case UserLanguage.es:
                    newCulture = new CultureInfo("es");
                    break;
                default:
                    newCulture = Thread.CurrentThread.CurrentCulture;
                    break;
            }

            Thread.CurrentThread.CurrentUICulture = newCulture;
        }
Exemple #24
0
 public void ChangeLanguage(UserLanguage newLang)
 {
     LocalizationManager.Instance.ChangeLanguage(newLang);
 }
 public Promotion testCheckPromotionValidation(RequestHourlyPricing requestHourlyPricing, UserLanguage lang = UserLanguage.Arabic)
 {
     return(PromotionMgr.GetPromotionByCode(requestHourlyPricing, lang));
 }
Exemple #26
0
        public async Task <bool> UpdateTalentProfile(TalentProfileViewModel model, string updaterId)
        {
            try {
                if (updaterId != null)
                {
                    User existingUser = (await _userRepository.GetByIdAsync(model.Id));
                    existingUser.Address          = model.Address;
                    existingUser.LinkedAccounts   = model.LinkedAccounts;
                    existingUser.Phone            = model.Phone;
                    existingUser.Email            = model.Email;
                    existingUser.FirstName        = model.FirstName;
                    existingUser.LastName         = model.LastName;
                    existingUser.Nationality      = model.Nationality;
                    existingUser.Summary          = model.Summary;
                    existingUser.Description      = model.Description;
                    existingUser.VisaStatus       = model.VisaStatus;
                    existingUser.VisaExpiryDate   = model.VisaExpiryDate;
                    existingUser.ProfilePhoto     = model.ProfilePhoto;
                    existingUser.ProfilePhotoUrl  = model.ProfilePhotoUrl;
                    existingUser.JobSeekingStatus = model.JobSeekingStatus;

                    if (model.Languages != null)
                    {
                        var newLanguage = new List <UserLanguage>();
                        foreach (var lang in model.Languages)
                        {
                            var Language = existingUser.Languages.SingleOrDefault(x => x.Id == lang.Id);
                            if (Language == null)
                            {
                                Language = new UserLanguage
                                {
                                    Id = ObjectId.GenerateNewId().ToString(),
                                    //Language=lang.Name,
                                    //LanguageLevel=lang.Level,
                                    UserId    = updaterId,
                                    IsDeleted = false
                                };
                            }
                            UpdateLangFromView(lang, Language);
                            newLanguage.Add(Language);
                        }
                        existingUser.Languages = newLanguage;
                    }
                    if (model.Skills != null)
                    {
                        var newSkills = new List <UserSkill>();
                        foreach (var item in model.Skills)
                        {
                            var skill = existingUser.Skills.SingleOrDefault(x => x.Id == item.Id);
                            if (skill == null)
                            {
                                skill = new UserSkill
                                {
                                    Id        = ObjectId.GenerateNewId().ToString(),
                                    IsDeleted = false
                                };
                            }
                            UpdateSkillFromView(item, skill);
                            newSkills.Add(skill);
                        }
                        existingUser.Skills = newSkills;
                    }
                    if (model.Experience != null)
                    {
                        var newExperience = new List <UserExperience>();
                        foreach (var item in model.Experience)
                        {
                            var Exp = existingUser.Experience.SingleOrDefault(x => x.Id == item.Id);
                            if (Exp == null)
                            {
                                Exp = new UserExperience
                                {
                                    Id = ObjectId.GenerateNewId().ToString()
                                };
                            }
                            UpdateExperienceFromView(item, Exp);
                            newExperience.Add(Exp);
                        }
                        existingUser.Experience = newExperience;
                    }

                    await _userRepository.Update(existingUser);
                }


                return(true);
            }
            catch (Exception e) { return(false); }
            //Your code here;
            //throw new NotImplementedException();
        }
Exemple #27
0
 public void Add(UserLanguage entity)
 {
     _context.UserLanguage.Add(entity);
     _context.SaveChanges();
 }
Exemple #28
0
 public string ToString(string delimiter)
 {
     return(StartDate.ToString() + delimiter + EndDate.ToString() + delimiter + Status.ToString() + delimiter + Progress.ToString() + delimiter + Duration.ToString() + delimiter + Finished.ToString() + delimiter + RecordedDate.ToString() + delimiter + ResponseId.ToString() + delimiter + DistributionChannel.ToString() + delimiter + UserLanguage.ToString() + delimiter + TimePISFirstClick.ToString() + delimiter + TimePISLastClick.ToString() + delimiter + TimePISPageSubmit.ToString() + delimiter + TimePISClickCount.ToString() + delimiter + TimeConsentFirstClick.ToString() + delimiter + TimeConsentLastClick.ToString() + delimiter + TimeConsentPageSubmit.ToString() + delimiter + TimeConsentClickCount.ToString() + delimiter + Consent.ToString() + delimiter + ConsentMistake.ToString() + delimiter + Q177FirstClick.ToString() + delimiter + Q177LastClick.ToString() + delimiter + Q177PageSubmit.ToString() + delimiter + Q177ClickCount.ToString() + delimiter + ProlificId.ToString() + delimiter + TimeContext1FirstClick.ToString() + delimiter + TimeContext1LastClick.ToString() + delimiter + TimeContext1PageSubmit.ToString() + delimiter + TimeContext1ClickCount.ToString() + delimiter + TimeContext2FirstClick.ToString() + delimiter + TimeContext2LastClick.ToString() + delimiter + TimeContext2PageSubmit.ToString() + delimiter + TimeContext2ClickCount.ToString() + delimiter + TimeContext3FirstClick.ToString() + delimiter + TimeContext3LastClick.ToString() + delimiter + TimeContext3PageSubmit.ToString() + delimiter + TimeContext3ClickCount.ToString() + delimiter + TimeControlReportFirstClick.ToString() + delimiter + TimeControlReportLastClick.ToString() + delimiter + TimeControlReportPageSubmit.ToString() + delimiter + TimeControlReportClickCount.ToString() + delimiter + TimeUcdReportP1FirstClick.ToString() + delimiter + TimeUcdReportP1LastClick.ToString() + delimiter + TimeUcdReportP1PageSubmit.ToString() + delimiter + TimeUcdReportP1ClickCount.ToString() + delimiter + TimeUcdReportP2FirstClick.ToString() + delimiter + TimeUcdReportP2LastClick.ToString() + delimiter + TimeUcdReportP2PageSubmit.ToString() + delimiter + TimeUcdReportP2ClickCount.ToString() + delimiter + TimeS1FirstClick.ToString() + delimiter + TimeS1LastClick.ToString() + delimiter + TimeS1PageSubmit.ToString() + delimiter + TimeS1ClickCount.ToString() + delimiter + SubjUnderstanding.ToString() + delimiter + SubjClarity.ToString() + delimiter + SubjTrusted.ToString() + delimiter + TimeS2FirstClick.ToString() + delimiter + TimeS2LastClick.ToString() + delimiter + TimeS2PageSubmit.ToString() + delimiter + TimeS2ClickCount.ToString() + delimiter + SubjNext1.ToString() + delimiter + SubjNext3.ToString() + delimiter + SubjNext2.ToString() + delimiter + SubjNext4.ToString() + delimiter + SubjNext5.ToString() + delimiter + TimeOcStatusFirstClick.ToString() + delimiter + TimeOcStatusLastClick.ToString() + delimiter + TimeOcStatusPageSubmit.ToString() + delimiter + TimeOcStatusClickCount.ToString() + delimiter + OcStatusVerbal.ToString() + delimiter + OcStatusProb.ToString() + delimiter + OcStatusSlider1.ToString() + delimiter + TimeOcChildFirstClick.ToString() + delimiter + TimeOcChildLastClick.ToString() + delimiter + TimeOcChildPageSubmit.ToString() + delimiter + TimeOcChildClickCount.ToString() + delimiter + OcChildVerbal.ToString() + delimiter + OcChildProb.ToString() + delimiter + OcChildSlider1.ToString() + delimiter + TimeOcCompareFirstClick.ToString() + delimiter + TimeOcCompareLastClick.ToString() + delimiter + TimeOcComparePageSubmit.ToString() + delimiter + TimeOcCompareClickCount.ToString() + delimiter + ObjcompCompare.ToString() + delimiter + TimeOcHardFirstClick.ToString() + delimiter + TimeOcHardLastClick.ToString() + delimiter + TimeOcHardPageSubmit.ToString() + delimiter + TimeOcHardClickCount.ToString() + delimiter + Objcomp1000Hard.ToString() + delimiter + Objcomp800Hard.ToString() + delimiter + TimeSch1FirstClick.ToString() + delimiter + TimeSch1LastClick.ToString() + delimiter + TimeSch1PageSubmit.ToString() + delimiter + TimeSch1ClickCount.ToString() + delimiter + Scheuner1.ToString() + delimiter + Scheuner2.ToString() + delimiter + Scheuner3.ToString() + delimiter + TimeSch2FirstClick.ToString() + delimiter + TimeSch2LastClick.ToString() + delimiter + TimeSch2PageSubmit.ToString() + delimiter + TimeSch2ClickCount.ToString() + delimiter + Scheuner4.ToString() + delimiter + Scheuner5.ToString() + delimiter + Scheuner6.ToString() + delimiter + Scheuner7.ToString() + delimiter + Scheuner8.ToString() + delimiter + TimeSch3FirstClick.ToString() + delimiter + TimeSch3LastClick.ToString() + delimiter + TimeSch3PageSubmit.ToString() + delimiter + TimeSch3ClickCount.ToString() + delimiter + Scheuner9.ToString() + delimiter + Scheuner10.ToString() + delimiter + Scheuner11.ToString() + delimiter + Scheuner12.ToString() + delimiter + Scheuner13.ToString() + delimiter + TimeSch4FirstClick.ToString() + delimiter + TimeSch4LastClick.ToString() + delimiter + TimeSch4PageSubmit.ToString() + delimiter + TimeSch4ClickCount.ToString() + delimiter + Scheuner14.ToString() + delimiter + Scheuner15.ToString() + delimiter + Scheuner16.ToString() + delimiter + Scheuner17.ToString() + delimiter + Scheuner18.ToString() + delimiter + TimeLimitationsFirstClick.ToString() + delimiter + TimeLimitationsLastClick.ToString() + delimiter + TimeLimitationsPageSubmit.ToString() + delimiter + TimeLimitationsClickCount.ToString() + delimiter + Limitations.ToString() + delimiter + TimeNoticedFirstClick.ToString() + delimiter + TimeNoticedLastClick.ToString() + delimiter + TimeNoticedPageSubmit.ToString() + delimiter + TimeNoticedClickCount.ToString() + delimiter + ResultNoticed.ToString() + delimiter + ResultUnderstood.ToString() + delimiter + TimeSnumeracyFirstClick.ToString() + delimiter + TimeSnumeracyLastClick.ToString() + delimiter + TimeSnumeracyPageSubmit.ToString() + delimiter + TimeSnumeracyClickCount.ToString() + delimiter + SNumeracy1.ToString() + delimiter + SNumeracy2.ToString() + delimiter + SNumeracy3.ToString() + delimiter + SNumeracy4.ToString() + delimiter + SNumeracy5.ToString() + delimiter + SNumeracy6.ToString() + delimiter + SNumeracy7.ToString() + delimiter + SNumeracy8.ToString() + delimiter + TimePriorexp1FirstClick.ToString() + delimiter + TimePriorexp1LastClick.ToString() + delimiter + TimePriorexp1PageSubmit.ToString() + delimiter + TimePriorexp1ClickCount.ToString() + delimiter + CFExperience.ToString() + delimiter + CFExperienceDetail.ToString() + delimiter + TimePriorexp2FirstClick.ToString() + delimiter + TimePriorexp2LastClick.ToString() + delimiter + TimePriorexp2PageSubmit.ToString() + delimiter + TimePriorexp2ClickCount.ToString() + delimiter + TimeDemo1FirstClick.ToString() + delimiter + TimeDemo1LastClick.ToString() + delimiter + TimeDemo1PageSubmit.ToString() + delimiter + TimeDemo1ClickCount.ToString() + delimiter + Age.ToString() + delimiter + Gender.ToString() + delimiter + GenderOther.ToString() + delimiter + CombinedIncome.ToString() + delimiter + AdultsInHouse.ToString() + delimiter + ChildrenInHouse.ToString() + delimiter + Education.ToString() + delimiter + TimeDemo2FirstClick.ToString() + delimiter + TimeDemo2LastClick.ToString() + delimiter + TimeDemo2PageSubmit.ToString() + delimiter + TimeDemo2ClickCount.ToString() + delimiter + Comments.ToString() + delimiter + Design.ToString() + delimiter + TestResult.ToString() + delimiter + OCStatusAbsoluteTime.ToString() + delimiter + OCChildAbsoluteTime.ToString() + delimiter + OCCompareAbsoluteTime.ToString());
 }
        public IEnumerable <BaseQuickLookup> GetLookups_DistrictNationalities(string districtId, UserLanguage language)
        {
            string displayField = (language == UserLanguage.Arabic ? "name" : "NameEnglish");

            string sql = @"SELECT distinct country.new_CountryId CountryId ,country.new_name name,country.new_code code,country.new_isocode isocode,
                        country.new_NameEnglish NameEnglish,country.new_axcode axcode ,country.versionnumber  
                        from new_CountryBase country, new_hourlypricingBase hourPrice,new_carresource,new_district,new_district_carresource
                        where country.new_CountryId =hourPrice.new_nationality
						and new_carresource.new_carresourceId=new_district_carresource.new_carresourceid and new_district.new_districtId=new_district_carresource.new_districtId
						and new_district.new_districtId='@id'  order by country.new_name"                        ;

            sql = sql.Replace("@id", districtId);
            return(CRMAccessDB.SelectQ(sql).Tables[0].AsEnumerable().Select(dataRow => new BaseQuickLookup(dataRow["CountryId"].ToString(), dataRow[displayField].ToString())));
        }
        public IEnumerable <HourlyPricing> GetPricing(RequestHourlyPricing requestHourlyPricing, UserLanguage Lang)
        {
            //Get HOurlyPricing Of Nationality
            List <HourlyPricing> MorningHP = GetHourlyPricingByNationalityAndShift(requestHourlyPricing.NationalityId, DayShifts.Morning).ToList();
            List <HourlyPricing> EveningHP = GetHourlyPricingByNationalityAndShift(requestHourlyPricing.NationalityId, DayShifts.Evening).ToList();


            int countofdays = requestHourlyPricing.Days.Split(',').Count();

            // Get Promotion

            var promotion = PromotionMgr.GetPromotionByCode(requestHourlyPricing, Lang);



            //Get Available Days
            List <string> MorningAD = ShiftMgr.GetDays(requestHourlyPricing, DayShifts.Morning, countofdays, promotion).ToList();
            List <string> EveningAD = ShiftMgr.GetDays(requestHourlyPricing, DayShifts.Evening, countofdays, promotion).ToList();


            //Check If Days Available Or Not
            bool IsMDAvabilable = !requestHourlyPricing.Days.Split(',').ToList().Except(MorningAD).Any();
            bool IsEDAvabilable = !requestHourlyPricing.Days.Split(',').ToList().Except(EveningAD).Any();

            // key openDays was made in Nas web api to display all days not only district days and this not in availabiltiy business
            //if (ConfigurationManager.AppSettings["OpenDays"] == "true")
            //{
            //    IsMDAvabilable = true;
            //    IsEDAvabilable = true;
            //}


            MorningHP = MorningHP.Select(a => CastToClientHourlyPricing(a, countofdays, requestHourlyPricing.HoursCount, requestHourlyPricing.ContractDuration, requestHourlyPricing.Empcount, IsMDAvabilable, MorningAD, promotion)).ToList();
            EveningHP = EveningHP.Select(a => CastToClientHourlyPricing(a, countofdays, requestHourlyPricing.HoursCount, requestHourlyPricing.ContractDuration, requestHourlyPricing.Empcount, IsEDAvabilable, EveningAD, promotion)).ToList();

            var AllHP = new List <HourlyPricing>();

            AllHP.AddRange(MorningHP);
            AllHP.AddRange(EveningHP);

            return(AllHP);
        }
        internal IEnumerable <ServiceContractPerHour> GetUserHourlyContracts(string userId, string statusCode, UserLanguage Language)
        {
            //Get Customer Contracts
            string statusCondition = String.IsNullOrEmpty(statusCode) ? string.Empty : String.Format(" And  contract.statuscode = {0} ", statusCode);
            string optionSetGetValFn, otherLangOptionSetGetValFn;

            switch (Language)
            {
            case UserLanguage.Arabic:
                optionSetGetValFn          = "dbo.getOptionSetDisplay";
                otherLangOptionSetGetValFn = "dbo.getOptionSetDisplayen";
                break;

            default:
                optionSetGetValFn          = "dbo.getOptionSetDisplayen";
                otherLangOptionSetGetValFn = "dbo.getOptionSetDisplay";
                break;
            }

            string query = String.Format(@"select contract.new_hindvcontractid,
	   contract.new_contractnumber,
	   hourlypricing.new_name as hourlypricingname,
	    Contract.new_finalprice,
        Contract.CreatedOn,
		Contract.new_contractmonth,
		contract.new_shift,
		Isnull(appointment.userrate,0) as userrate,
		appointment.nextappointment,
        Convert(date, contract.new_contractstartdate) as new_contractstartdate,
        contract.new_latitude,
		contract.new_longitude,
        Isnull({0}('new_contractmonth','new_HIndvContract',Contract.new_contractmonth),{1}('new_contractmonth','new_HIndvContract',Contract.new_contractmonth) ) as durationname,
        Contract.statuscode,
        Isnull({2}('statuscode','new_HIndvContract',Contract.statuscode),{3}('statuscode','new_HIndvContract',Contract.statuscode) ) as statusname
           -- contract.new_HIndivClintnameName, 
		  --contract.new_HIndivClintname,contract.new_cityName
		  --,contract.new_city,contract.new_districtName ,contract.new_district,
		  --contract.new_discount_def,contract.new_totalprice_def,contract.new_totalvisits_def,contract.new_monthvisits_def,
		  --contract.new_contractmonth,contract.new_selecteddays,Contract.new_selectedshifts,Contract.new_visitprice_def,
		  --hourlypricing.new_nationalityName,
		  --hourlypricing.new_hourlypricingId,hourlypricing.new_shift
		  from new_HIndvContract  contract inner join new_hourlypricing hourlypricing on contract.new_houlrypricing=hourlypricing.new_hourlypricingId 
		  left outer join (
		  select new_hourlyappointmentBase.new_servicecontractperhour, 
		  IIF(  Count(new_hourlyappointmentBase.new_rate) > 0, ROUND( Sum(Isnull(new_hourlyappointmentBase.new_rate,0)) / Count(new_hourlyappointmentBase.new_rate), 0) , null) as userrate,
		  max(new_hourlyappointmentBase.new_shiftstart) as nextAppointment
		  from new_hourlyappointmentBase
		  where new_hourlyappointmentBase.new_rate is not null and Convert (date, new_shiftstart) <= Convert(date,GetDate())
		  group by new_servicecontractperhour
		  ) as  appointment on new_servicecontractperhour= contract.new_HIndvContractId

		  where contract.new_HIndivClintname = '{4}'  {5}
  order by contract.new_ContractNumber desc", optionSetGetValFn, otherLangOptionSetGetValFn, optionSetGetValFn, otherLangOptionSetGetValFn, userId, statusCondition);

            DataTable dt = CRMAccessDB.SelectQ(query).Tables[0];

            return(dt.AsEnumerable().Select(dataRow => new ServiceContractPerHour(dataRow, Language)));


            //List<ServiceContractPerHour> List = new List<ServiceContractPerHour>();

            //string ContractIds = "";
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    List.Add(new ServiceContractPerHour()
            //    {

            //        ContractId = dt.Rows[i][0].ToString(),
            //        ContractNum = dt.Rows[i][1].ToString(),
            //        Customer = dt.Rows[i][2].ToString(),
            //        CustomerId = dt.Rows[i][3].ToString(),
            //        City = dt.Rows[i][4].ToString(),
            //        District = dt.Rows[i]["new_districtName"].ToString(),
            //        Nationality = dt.Rows[i]["new_nationalityName"].ToString(),
            //        HourlyPricing = new HourlyPricing()
            //        {
            //            Discount = dt.Rows[i]["new_discount_def"].ToString(),
            //            TotalPrice = dt.Rows[i]["new_totalprice_def"].ToString(),
            //            TotalVisit = dt.Rows[i]["new_totalvisits_def"].ToString(),
            //            MonthVisits = dt.Rows[i][10].ToString(),
            //            NoOfMonths = dt.Rows[i]["new_contractmonth"].ToString(),
            //            VisitPrice = dt.Rows[i]["new_visitprice_def"].ToString(),
            //            NationalityName = dt.Rows[i]["new_nationalityName"].ToString(),
            //            hourlypricingId = dt.Rows[i][17].ToString(),
            //            Name = dt.Rows[i]["new_name"].ToString(),
            //            TotalbeforeDiscount = ((decimal.Parse(dt.Rows[i]["new_visitprice_def"].ToString()) * int.Parse(dt.Rows[i]["new_monthvisits_def"].ToString()) * int.Parse(dt.Rows[i]["new_totalvisits_def"].ToString()) * 4).ToString())


            //        },
            //        SelectedDays = dt.Rows[i]["new_selecteddays"].ToString(),
            //        Shift = dt.Rows[i]["new_shift"].ToString() == "False" ? "Morning" : "Evening",

            //        HourlyAppointments = new List<HourlyAppointment>()
            //    });

            //    ContractIds += "'" + dt.Rows[i][0].ToString() + "'";

            //    if (i != dt.Rows.Count - 1)
            //        ContractIds += ",";

            //}

            //return List;
        }