public void EditData(int Id, string ListName, List <systemListData> ListData, int UserId)
 {
     if (Id > 0)
     {
         foreach (var item in ListData)
         {
             SystemListValue SystemListValue = _db.SystemListValues.Where(x => x.Id == item.Id).FirstOrDefault();
             SystemListValue.Value = item.ListValue;
             SystemListValue.UserIDLastModifiedBy = UserId;
             SystemListValue.LastModified         = DateTime.Now;
             _db.SaveChanges();
         }
     }
 }
Пример #2
0
        public ActionResult DeleteOtherSetting(int Id)
        {
            OtherSettingViewModel model = new OtherSettingViewModel();

            model.Id = Id;
            if (Id > 0)
            {
                SystemListValue SystemListValue = _db.SystemListValues.Where(x => x.Id == Id).FirstOrDefault();
                SystemListValue.UserIDLastModifiedBy = SessionProxy.UserId;
                SystemListValue.LastModified         = DateTime.Now;
                SystemListValue.Archived             = true;
                _db.SaveChanges();
            }
            return(PartialView("_PartialOtherSettingList", returnList()));
        }
        public void SaveData(int Id, string ListName, string[] ListValue, int UserId)
        {
            if (Id > 0)
            {
                foreach (var item in ListValue)
                {
                    SystemListValue SystemListValue = new SystemListValue();
                    SystemListValue.SystemListID         = Id;
                    SystemListValue.Value                = item;
                    SystemListValue.Archived             = false;
                    SystemListValue.UserIDCreatedBy      = UserId;
                    SystemListValue.CreatedDate          = DateTime.Now;
                    SystemListValue.UserIDLastModifiedBy = UserId;
                    SystemListValue.LastModified         = DateTime.Now;
                    SystemListValue.Description          = "";
                    _db.SystemListValues.Add(SystemListValue);
                    _db.SaveChanges();
                }
            }
            else
            {
                SystemList SystemLists = new SystemList();
                SystemLists.SystemListName       = ListName;
                SystemLists.Archived             = false;
                SystemLists.UserIDCreatedBy      = UserId;
                SystemLists.CreatedDate          = DateTime.Now;
                SystemLists.UserIDLastModifiedBy = UserId;
                SystemLists.LastModified         = DateTime.Now;
                _db.SystemLists.Add(SystemLists);
                _db.SaveChanges();

                foreach (var item in ListValue)
                {
                    SystemListValue SystemListValue = new SystemListValue();
                    SystemListValue.SystemListID         = SystemLists.Id;
                    SystemListValue.Value                = item;
                    SystemListValue.Archived             = false;
                    SystemListValue.UserIDCreatedBy      = UserId;
                    SystemListValue.CreatedDate          = DateTime.Now;
                    SystemListValue.UserIDLastModifiedBy = UserId;
                    SystemListValue.LastModified         = DateTime.Now;
                    SystemListValue.Description          = "";
                    _db.SystemListValues.Add(SystemListValue);
                    _db.SaveChanges();
                }
            }
        }
        public void SaveSkills(int Id, string Value, string Description, string SkillType, int UserId)
        {
            int skillTypeId = 0;

            if (SkillType == "Technical")
            {
                SystemList systemName = _otherSettingMethod.getSystemListByName("Technical Skills");
                skillTypeId = systemName.Id;
            }
            else
            {
                SystemList systemName = _otherSettingMethod.getSystemListByName("General Skills");
                skillTypeId = systemName.Id;
            }

            if (Id > 0)
            {
                SystemListValue SystemListValue = _db.SystemListValues.Where(x => x.Id == Id).FirstOrDefault();
                SystemListValue.SystemListID         = skillTypeId;
                SystemListValue.Value                = Value;
                SystemListValue.Archived             = false;
                SystemListValue.UserIDCreatedBy      = UserId;
                SystemListValue.CreatedDate          = DateTime.Now;
                SystemListValue.UserIDLastModifiedBy = UserId;
                SystemListValue.LastModified         = DateTime.Now;
                SystemListValue.Description          = Description;

                _db.SaveChanges();
            }
            else
            {
                SystemListValue SystemListValue = new SystemListValue();
                SystemListValue.SystemListID         = skillTypeId;
                SystemListValue.Value                = Value;
                SystemListValue.Archived             = false;
                SystemListValue.UserIDCreatedBy      = UserId;
                SystemListValue.CreatedDate          = DateTime.Now;
                SystemListValue.UserIDLastModifiedBy = UserId;
                SystemListValue.LastModified         = DateTime.Now;
                SystemListValue.Description          = Description;
                _db.SystemListValues.Add(SystemListValue);
                _db.SaveChanges();
            }
        }