public string Update(FeatureSetAccess entity)
 {
     this.Context.FeatureSetAccesses.Attach(entity);
     this.Context.Entry(entity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
 public void InsertCompanyFeatureSet(FeatureSet fs, FeatureSetAccess fsa)
 {
     var result = this.fsRepo.Insert(fs);
     
     long outValue = 0;
     if (long.TryParse(result, out outValue))    //faisal bhai sidha sidha convert.toint32 q nhi kia itni lambi q ki???
     {
         foreach (var f in fs.FeatureSetList)
         {
             f.FeatureSetId = outValue;
         }
         fslRepo.Insert(fs.FeatureSetList.ToList());
         fsa.FeatureSetId = outValue;
         result = this.fsaRepo.Insert(fsa);
     }
 }
        public JsonResult UpdateCompanyFeature(long companyId, string featureName, string featureList)
        {
            FeatureSet fs = new FeatureSet();
            fs.Name = featureName;
            fs.AccessType = "company";
            fs.CreateDate = DateTime.Now;
            List<FeatureSetList> fsList = new List<FeatureSetList>();
            var newValue = featureList.Replace("undefined|","").Replace("undefined±","").Split(new char[] { '±' }, StringSplitOptions.None);
            foreach(string s in newValue)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    fsList.Add(new FeatureSetList { FeatureId = long.Parse(s.Split(new char[] { '|' }, StringSplitOptions.None)[0]), FeatureSetId = fs.Id });
                }
            }
            fs.FeatureSetList = fsList;

            FeatureSetAccess fsa = new FeatureSetAccess();
            fsa.CompanyId = companyId;
            fsa.FeatureSetId = fs.Id;
            fsa.CreateDate = DateTime.Now;

            service.InsertCompanyFeatureSet(fs, fsa);

            return Json("Success");
        }
 public string Update(FeatureSetAccess entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(FeatureSetAccess entity)
 {
     return this.repository.Insert(entity);
 }
        public JsonResult InsertCompanyFeature(long companyId, string featureName, string featureList)
        {
            #region Feature Set

            FeatureSet fs = new FeatureSet();
            fs.Name = featureName;
            fs.AccessType = AuthenticationHelper.UserRole == UserRoles.SuperAdmin.ToString() ? "company" : "user";
            fs.CompanyId = companyId;
            fs.CreateDate = DateTime.Now;
            fs.CreateBy = AuthenticationHelper.UserId;

            #region FeatureSet List
            List<FeatureSetList> fsList = new List<FeatureSetList>();
            var newValue = featureList.Replace("undefined|", "").Replace("undefined±", "").Split(new char[] { '±' }, StringSplitOptions.None);
            foreach (string s in newValue)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    fsList.Add(new FeatureSetList { FeatureId = long.Parse(s.Split(new char[] { '|' }, StringSplitOptions.None)[0]), FeatureSetId = fs.Id });
                }
            }
            #endregion

            fs.FeatureSetList = fsList;

            #endregion

            #region Feature Set Access

            FeatureSetAccess fsa = new FeatureSetAccess();
            fsa.CompanyId = companyId;
            fsa.FeatureSetId = fs.Id;
            fsa.CreateDate = DateTime.Now;

            service.InsertCompanyFeatureSet(fs, fsa);

            #endregion

            return Json("Success");
        }
 public string Insert(FeatureSetAccess entity)
 {
     this.Context.FeatureSetAccesses.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }