Example #1
0
        public void SubmitForm(CertificateEntity certificateEntity, string keyValue, string projectType)
        {
            List <CertificateEntity> models  = GetList();
            List <CertificateEntity> modelsT = models.Where(m => m.IdCard == certificateEntity.IdCard && m.Id != keyValue).ToList();

            if (modelsT != null && modelsT.Count > 0)
            {
                List <CertificateEntity> modelsT2 = modelsT.Where(m => m.Number == certificateEntity.Number && m.Id != keyValue).ToList();
                if (modelsT2 != null && modelsT2.Count > 0)
                {
                    throw new Exception("相同身份证号下证件编号已存在,请重新输入!");
                }
            }
            //ItemsDetailEntity itemsDetailEntity = itemsDetailEntities.Where(m => m.ItemCode == projectType).FirstOrDefault();
            //if (itemsDetailEntity != null && !string.IsNullOrEmpty(itemsDetailEntity.Id))
            //{
            //    certificateEntity.ProjectName = itemsDetailEntity.ItemName;
            //}
            if (!string.IsNullOrEmpty(keyValue))
            {
                certificateEntity.Modify(keyValue);
                service.Update(certificateEntity);
            }
            else
            {
                certificateEntity.Create();
                service.Insert(certificateEntity);
            }
        }
Example #2
0
        public void AddForm(CertificateEntity certificateEntity)
        {
            List <CertificateEntity> models  = GetList();
            List <CertificateEntity> modelsT = models.Where(m => m.IdCard == certificateEntity.IdCard).ToList();

            if (modelsT != null && modelsT.Count > 0)
            {
                List <CertificateEntity> modelsT2 = modelsT.Where(m => m.Number == certificateEntity.Number).ToList();
                if (modelsT2 != null && modelsT2.Count > 0)
                {
                    return;
                }
            }
            certificateEntity.Create();
            service.Insert(certificateEntity);
        }