public IActionResult UserInfoEdit(UsreInfoViewModel model)
        {
            var    response = ResponseModelFactory.CreateInstance;
            string guid     = model.SightseerUuid;

            if (ConfigurationManager.AppSettings.IsTrialVersion)
            {
                response.SetIsTrial();
                return(Ok(response));
            }
            using (_dbContext)
            {
                var entity = _dbContext.Sightseer.FirstOrDefault(x => x.SightseerUuid == Guid.Parse(guid));
                entity.SightseerName = model.SightseerName;
                entity.Sex           = model.Sex;
                entity.Nation        = model.Nation;
                entity.Phone         = model.Phone;
                entity.IdentityCard  = model.IdentityCard;
                entity.Laiyuandi     = model.Laiyuandi;
                entity.Age           = model.Age;
                entity.Shengneiwai   = model.Shengneiwai;
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("编辑", "成功:编辑:游客信息一条数据", _dbContext);
                }
                response.SetSuccess("修改成功");
                return(Ok(response));
            }
        }
        public IActionResult UserInfoCreate(UsreInfoViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = new HaikanSmartTownCockpit.Api.Entities.Sightseer();
                entity.SightseerUuid = Guid.NewGuid();
                entity.SightseerName = model.SightseerName;
                entity.Sex           = model.Sex;
                entity.Nation        = model.Nation;
                entity.Phone         = model.Phone;
                entity.IdentityCard  = model.IdentityCard;
                entity.Laiyuandi     = model.Laiyuandi;
                entity.Age           = model.Age;
                entity.Shengneiwai   = model.Shengneiwai;
                //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd");
                //entity.AddPeople = model.addPeople;
                entity.IsDeleted = 0;
                entity.AddTime   = DateTime.Now.ToString("yyyy-MM-dd");
                entity.AddPeople = AuthContextService.CurrentUser.DisplayName;
                _dbContext.Sightseer.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:游客信息一条数据", _dbContext);
                }
                response.SetSuccess("添加成功");
                return(Ok(response));
            }
        }
Esempio n. 3
0
        public IActionResult Create(UsreInfoViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = new Cunzhenmb();
                entity.CunzhenmbUuid = Guid.NewGuid();
                entity.RealName      = model.RealName;
                entity.Sex           = model.Sex;
                entity.Birth         = model.Birth;
                entity.IdentityCard  = model.IdentityCard;
                entity.Domicile      = model.Domicile;
                entity.Phone         = model.Phone;
                entity.Nation        = model.Nation;
                entity.Address       = model.Address;
                entity.Education     = model.Education;
                entity.Residence     = model.Residence;
                entity.Wechat        = model.Wechat;
                entity.AddTime       = DateTime.Now.ToString("yyyy-MM-dd");
                entity.AddPeople     = AuthContextService.CurrentUser.DisplayName;
                entity.IsDeleted     = 0;
                _dbContext.Cunzhenmb.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:村镇民兵信息一条数据", _dbContext);
                }
                response.SetSuccess("添加成功");
                return(Ok(response));
            }
        }
Esempio n. 4
0
        public IActionResult Edit(UsreInfoViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            if (ConfigurationManager.AppSettings.IsTrialVersion)
            {
                response.SetIsTrial();
                return(Ok(response));
            }
            using (_dbContext)
            {
                var entity = _dbContext.Cunzhenmb.FirstOrDefault(x => x.CunzhenmbUuid.ToString() == model.CunzhenmbUuid);
                entity.RealName     = model.RealName;
                entity.Sex          = model.Sex;
                entity.Address      = model.Address;
                entity.Birth        = model.Birth;
                entity.IdentityCard = model.IdentityCard;
                entity.Domicile     = model.Domicile;
                entity.Phone        = model.Phone;
                entity.Residence    = model.Residence;
                entity.Nation       = model.Nation;
                entity.Wechat       = model.Wechat;
                entity.Education    = model.Education;
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("编辑", "成功:编辑:村镇民兵信息一条数据", _dbContext);
                }
                response.SetSuccess("修改成功");
                return(Ok(response));
            }
        }
Esempio n. 5
0
        public IActionResult UserInfoEdit(UsreInfoViewModel model)
        {
            var    response = ResponseModelFactory.CreateInstance;
            string guid     = model.UserInfoUuid;

            if (ConfigurationManager.AppSettings.IsTrialVersion)
            {
                response.SetIsTrial();
                return(Ok(response));
            }
            using (_dbContext)
            {
                var entity = _dbContext.Userinfoty.FirstOrDefault(x => x.UserInfoUuid == Guid.Parse(guid));
                entity.RealName        = model.RealName;
                entity.Sex             = model.Sex;
                entity.Education       = model.Education;
                entity.Politics        = model.Politics;
                entity.Nation          = model.Nation;
                entity.Household       = model.Household;
                entity.Relation        = model.Relation;
                entity.HouseholderName = model.HouseholderName;
                if (model.Birth != null && model.Birth != "")
                {
                    entity.Birth = DateTime.Parse(model.Birth).ToString("yyyy-MM-dd");
                    DateTime now   = DateTime.Now;
                    DateTime birth = Convert.ToDateTime(model.Birth);
                    int      age   = now.Year - birth.Year;
                    if (now.Month < birth.Month || (now.Month == birth.Month && now.Day < birth.Day))
                    {
                        age--;
                    }
                    entity.Age = age < 0 ? 0 : age;
                }
                else
                {
                    entity.Birth = "";
                }
                if (model.QianYiEtime != null && model.QianYiEtime != "")
                {
                    entity.QianYiEtime = DateTime.Parse(model.QianYiEtime).ToString("yyyy-MM-dd");
                }
                else
                {
                    entity.QianYiEtime = "";
                }
                if (model.QianYiStime != null && model.QianYiStime != "")
                {
                    entity.QianYiStime = DateTime.Parse(model.QianYiStime).ToString("yyyy-MM-dd");
                }
                else
                {
                    entity.QianYiStime = "";
                }
                entity.IdentityCard = model.IdentityCard;
                entity.Occupation   = model.Occupation;
                entity.Residence    = model.Residence;
                entity.Domicile     = model.Domicile;

                entity.Phone = model.Phone;
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("编辑", "成功:编辑:统一人员信息一条数据", _dbContext);
                }
                response.SetSuccess("修改成功");
                return(Ok(response));
            }
        }
Esempio n. 6
0
        public IActionResult UserInfoCreate(UsreInfoViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = new HaikanSmartTownCockpit.Api.Entities.Userinfoty();
                entity.UserInfoUuid = Guid.NewGuid();
                entity.RealName     = model.RealName;
                entity.Sex          = model.Sex;
                entity.Education    = model.Education;
                entity.Politics     = model.Politics;
                entity.Nation       = model.Nation;
                entity.IdentityCard = model.IdentityCard;
                entity.Occupation   = model.Occupation;
                entity.Residence    = model.Residence;
                entity.Domicile     = model.Domicile;

                entity.Household       = model.Household;
                entity.Relation        = model.Relation;
                entity.HouseholderName = model.HouseholderName;
                entity.Phone           = model.Phone;
                if (model.Birth != null && model.Birth != "")
                {
                    entity.Birth = DateTime.Parse(model.Birth).ToString("yyyy-MM-dd");
                    DateTime now   = DateTime.Now;
                    DateTime birth = Convert.ToDateTime(model.Birth);
                    int      age   = now.Year - birth.Year;
                    if (now.Month < birth.Month || (now.Month == birth.Month && now.Day < birth.Day))
                    {
                        age--;
                    }
                    entity.Age = age < 0 ? 0 : age;
                }
                else
                {
                    entity.Birth = "";
                }
                if (model.QianYiEtime != null && model.QianYiEtime != "")
                {
                    entity.QianYiEtime = DateTime.Parse(model.QianYiEtime).ToString("yyyy-MM-dd");
                }
                else
                {
                    entity.QianYiEtime = "";
                }
                if (model.QianYiStime != null && model.QianYiStime != "")
                {
                    entity.QianYiStime = DateTime.Parse(model.QianYiStime).ToString("yyyy-MM-dd");
                }
                else
                {
                    entity.QianYiStime = "";
                }
                entity.AddTime   = DateTime.Now.ToString("yyyy-MM-dd");
                entity.AddPeople = AuthContextService.CurrentUser.DisplayName;
                //entity.AddTime = DateTime.Now.ToString("yyyy-MM-dd");
                //entity.AddPeople = model.addPeople;
                entity.IsDeleted = 0;
                _dbContext.Userinfoty.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:统一人员信息一条数据", _dbContext);
                }
                response.SetSuccess("添加成功");
                return(Ok(response));
            }
        }