コード例 #1
0
        private async void OnDeleteTypeDocument(TypeDocument typeDocument)
        {
            if (_accessUtility.HasAccess(45))
            {
                var ids = new List <int> {
                    1, 2, 3, 4, 5, 6
                };


                if (Deleting())
                {
                    if (ids.Contains(typeDocument.TypeDocumentId))
                    {
                        Error?.Invoke("امکان حذف وجود ندارد");
                    }
                    else
                    {
                        try
                        {
                            await _typeDocumentsService.DeleteTypeDocumentAsync(typeDocument.TypeDocumentId);

                            TypeDocuments.Remove(typeDocument);
                            Deleted();
                        }
                        catch (Exception ex)
                        {
                            Failed(ex);
                        }
                    }
                }
            }
        }
コード例 #2
0
        public async Task <TypeDocument> AddTypeDocumentAsync(TypeDocument typeDocument)
        {
            _uow.TypeDocuments.Add(typeDocument);
            await _uow.SaveChangesAsync().ConfigureAwait(false);

            return(typeDocument);
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("IdDocumet,TypeDocum")] TypeDocument typeDocument)
        {
            if (id != typeDocument.IdDocumet)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(typeDocument);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeDocumentExists(typeDocument.IdDocumet))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeDocument));
        }
コード例 #4
0
ファイル: SeedDb.cs プロジェクト: jfmejia048/banacolback
        private async Task <User> CheckUserAsync(string document, TypeDocument TypeDocument, string firstName, string lastName, string email, string phone, string address, bool state, TypeUser role)
        {
            var user = await _userHelper.GetUserByEmailAsync(email);

            if (user == null)
            {
                user = new User
                {
                    FirstName    = firstName,
                    TypeDocument = TypeDocument,
                    LastName     = lastName,
                    Email        = email,
                    UserName     = email,
                    PhoneNumber  = phone,
                    Address      = address,
                    Document     = document,
                    TypeUser     = role,
                    State        = state
                };

                await _userHelper.AddUserAsync(user, "123456");

                await _userHelper.AddUserToRoleAsync(user, role.Type);
            }

            return(user);
        }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            TypeDocument typeDocument = db.TypeDocuments.Find(id);

            db.TypeDocuments.Remove(typeDocument);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
 public void ResetAllValues()
 {
     _typeDocument       = null;
     _maskedDocumentDTO  = null;
     _purcharseOrder     = null;
     _enterpriseClient   = null;
     _enterpriseProvider = null;
 }
コード例 #7
0
 public TypeDocument getTypeDocument()
 {
     if (_typeDocument != null)
     {
         return(_typeDocument);
     }
     _typeDocument = _iServiceMasterTables.getTypeDocumentByID(_documentDTO.id_tipo_documento);
     return(_typeDocument);
 }
コード例 #8
0
 public DocumentValidator(IDocumentValidatorService iDocService)
 {
     _iDocService        = iDocService;
     _typeDocument       = _iDocService.TipoDocumento();
     _tempDocument       = new documentDTO();
     _purcharseOrder     = _iDocService.OrdenDeCompraPorID();
     _enterpriseProvider = _iDocService.EmpresaProveedor();
     _enterpriseClient   = _iDocService.EmpresaCliente();
 }
コード例 #9
0
        public async Task <ActionResult> CreateTypDocument(TypeDocument typeDocument)
        {
            if (ModelState.IsValid)
            {
                await typeDocumentRepository.Add(typeDocument);

                return(RedirectToAction("Index", "TypeDocument"));
            }
            return(View(typeDocument));
        }
コード例 #10
0
        public async Task <TypeDocument> UpdateTypeDocumentAsync(TypeDocument typeDocument)
        {
            //    var cmd = $"EXEC TypeDocument_Update @TypeDocumentId = {typeDocument.TypeDocumentId}," +
            //$" @TypeDocumentTitle = N'{typeDocument.TypeDocumentTitle}'";
            //    await _uow.Database.ExecuteSqlCommandAsync(cmd).ConfigureAwait(false);
            _uow.Entry(typeDocument).State = EntityState.Modified;
            await _uow.SaveChangesAsync().ConfigureAwait(false);

            return(typeDocument);
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "Id_TypeDocument,TypeName")] TypeDocument typeDocument)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeDocument).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(typeDocument));
 }
コード例 #12
0
        public AjoutTypeDocumentViewModel(INavigation navigation)
        {
            _navigation   = navigation;
            _typeDocument = new TypeDocument();
            _AjouterTypeDocumentValidator = new TypeDocumentValidator();


            ValiderCommand = new Command(async() => await EnregistrementDuType());
            AnnulerCommand = new Command(async() => await Annuler());
        }
コード例 #13
0
        string OutputJson(TypeDocument field)
        {
            if (field == null)
            {
                return("");
            }
            StringBuilder sb = new StringBuilder("");

            OutputJson(field, sb);
            return(sb.ToString());
        }
コード例 #14
0
        public async Task <int> CreateAsync(TypeDocument data)
        {
            var id = await this._repository.CreateAsync(data);

            if (id > 0)
            {
                this._logger.LogInformation("Se creo el registro con el id {0}", id);
            }

            return(id);
        }
コード例 #15
0
        public ActionResult Create([Bind(Include = "Id_TypeDocument,TypeName")] TypeDocument typeDocument)
        {
            if (ModelState.IsValid)
            {
                db.TypeDocuments.Add(typeDocument);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(typeDocument));
        }
        public int HasAcc(DateTime dateTime, TypeDocument typeDocument, StatusEnum statusEnum)
        {
            int hasAccResult = 0;

            //var cc = _uow.GLs.FirstOrDefault(x => x.GLId == id)?.TLs;
            //return _uow.GLs.FirstOrDefault(x => x.GLId == id)?.TLs?.Any() == true;
            if (statusEnum == StatusEnum.End || statusEnum == StatusEnum.Permanent)
            {
                hasAccResult = 2;
                return(hasAccResult);
            }
            else
            {
                if (typeDocument.TypeDocumentId != 2)
                {
                    return(hasAccResult);
                }

                else
                {
                    var result = _uow.TLDocumentHeaders.Any(x => x.TLDocumentHeaderDate == dateTime);
                    if (result == false)
                    {
                        result = _uow.AccDocumentHeaders.Any(x => x.TypeDocumentId != 2 && x.DocumentDate == dateTime);
                        if (result == true)
                        {
                            var type = _uow.AccDocumentHeaders.Where(x => x.TypeDocumentId != 2 && x.DocumentDate == dateTime).Select(x => x.TypeDocumentId).FirstOrDefault();
                            if (type == 1)
                            {
                                hasAccResult = 1;
                            }
                            else if (type == 3)
                            {
                                hasAccResult = 3;
                            }
                            else if (type == 4)
                            {
                                hasAccResult = 4;
                            }
                            else if (type == 6)
                            {
                                hasAccResult = 6;
                            }
                        }
                    }
                    else
                    {
                        hasAccResult = 5;
                    }
                    return(hasAccResult);
                }
            }
            //بررسی کن اگه سندی که هیچ آیتم ندارد را حذف کند
        }
コード例 #17
0
        void OutputJson(TypeDocument par, StringBuilder sb, int level = 0)
        {
            sb.AppendLine();
            sb.Append(' ', level * 4);
            sb.Append('{');
            bool first = true;

            foreach (var field in par.fields.Values)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.Append(",");
                }
                sb.AppendLine();
                sb.Append(' ', level * 4);

                sb.Append($@"""{field.JsonName ?? field.Name}"" : ");
                if (field.fields == null || field.fields.Count == 0)
                {
                    switch (field.TypeName)
                    {
                    case "string":
                        sb.Append($@"""{field.Example ?? field.Caption ?? field.Name}""");
                        break;

                    case "DateTime":
                        sb.Append($@"""{field.Example ?? "2018-01-01T12:00:00:00"}""");
                        break;

                    case "bool":
                        sb.Append(field.Example ?? "false");
                        break;

                    default:
                        sb.Append(field.Example ?? "0");
                        break;
                    }
                    continue;
                }
                if (field.IsEnum)
                {
                    sb.Append(field.fields.Values.FirstOrDefault()?.Value ?? "0");
                    continue;
                }
                OutputJson(field, sb, level + 1);
            }
            sb.AppendLine();
            sb.Append(' ', level * 4);
            sb.Append('}');
        }
コード例 #18
0
        public async Task <IActionResult> Create([Bind("IdDocumet,TypeDocum")] TypeDocument typeDocument)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typeDocument);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(typeDocument));
        }
コード例 #19
0
        /// <summary>
        /// 读取类型说明
        /// </summary>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static TypeDocument ReadEntity(Type type, string name)
        {
            var typeDocument = new TypeDocument
            {
                Name      = name,
                TypeName  = ReflectionHelper.GetTypeName(type),
                ClassName = ReflectionHelper.GetTypeName(type),
            };

            ReadEntity(ref typeDocument, type);
            return(typeDocument);
        }
コード例 #20
0
ファイル: MasterTables.uow.cs プロジェクト: jcrodrigh/ISP_REP
        public TypeDocument getTypeDocumentByID(string id_document)
        {
            var temp = _dbContext.tipo_documento
                       .Where(td => td.id_tipo_documento.Equals(id_document))
                       .FirstOrDefault();

            TypeDocument typeDoc = new TypeDocument();

            _mapper.Map(temp, typeDoc);

            return(typeDoc);
        }
コード例 #21
0
        // GET: TypeDocuments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypeDocument typeDocument = db.TypeDocuments.Find(id);

            if (typeDocument == null)
            {
                return(HttpNotFound());
            }
            return(View(typeDocument));
        }
コード例 #22
0
        public EnregistrementDocumentViewModel(INavigation navigation)
        {
            _navigation        = navigation;
            _document          = new Document();
            _typeDocument      = new TypeDocument();
            _documentValidator = new DocumentValidator();


            AjouterDocument = new Command(async() => await AjoutDocDuDocument());

            EnregistrementCommand = new Command(async() => await EnregistrementDuDocument());
            AnnulerCommand        = new Command(async() => await Annuler());

            FetchTypeDocument();
        }
コード例 #23
0
        public EnregistrementDocumentViewModel(INavigation navigation)
        {
            _navigation               = navigation;
            _document                 = new Document();
            TypeDocument              = new TypeDocument();
            _documentValidator        = new DocumentValidator();
            baseParametresViewModel   = new BaseParametresViewModel();
            _localNotificationService = DependencyService.Get <ILocalNotificationService>();

            AjouterDocument = new Command(async() => await AjoutDocDuDocument());

            EnregistrementCommand = new Command(async() => await EnregistrementDuDocument());
            AnnulerCommand        = new Command(async() => await Annuler());

            FetchTypeDocument();
        }
コード例 #24
0
        static string JsonExample(TypeDocument type, HashSet <TypeDocument> hashSet, bool isRoot)
        {
            if (hashSet.Contains(type))
            {
                return(null);
            }
            hashSet.Add(type);
            var code = new StringBuilder();

            if (type.IsArray)
            {
                code.Append("[");
            }
            if (type.IsBaseType)
            {
                code.Append(type.DocExample);
            }
            else
            {
                code.Append("{");
                bool first = true;
                foreach (var field in type.Fields.Values)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        code.Append(",");
                    }

                    code.AppendLine();
                    code.Append($"    '{field.DocName}' : {JsonExample(field, hashSet, false)}");
                }
                code.AppendLine();
                code.Append("}");
            }
            if (type.IsArray)
            {
                code.Append("]");
            }

            var json = code.ToString();

            return(isRoot ? json : json.SpaceLine(4).Trim());
        }
コード例 #25
0
        public DetailsDocumentViewModel(INavigation navigation, int selectedDocumentID)
        {
            _navigation   = navigation;
            _document     = new Document();
            _document.Id  = selectedDocumentID;
            _typeDocument = new TypeDocument
            {
                IdTypeDocument = selectedDocumentID
            };

            SelectLienCommand = new Command(() => PickAndShowFile());
            DeleteCommand     = new Command(async() => await DeleteDocument());

            MiseAjourPageCommand = new Command(async() => await ModificationDesInfos());

            FetchDocumentDetailsAsync();
        }
コード例 #26
0
        public ListFilActualiteViewModel(INavigation navigation)
        {
            _navigation     = navigation;
            _document       = new Document();
            _membre         = new Membre();
            _evenement      = new Evenement();
            _patrimoine     = new Patrimoine();
            _typeMembre     = new TypeMembre();
            _typePatrimoine = new TypePatrimoine();
            _typeDocument   = new TypeDocument();



            AjoutEvenementCommand       = new Command(async() => await AjouterUnEvenement());
            DeleteEvenementCommand      = new Command(async() => await SupprimerUnEvenement());
            AllerAListeEvenementCommand = new Command(async() => await AllerAlaListeDesEvenements());

            AjouterDocumentCommand     = new Command(async() => await AjouterUnDocument());
            SupprimerDocumentCommand   = new Command(async() => await SupprimerUnDocument());
            AllerAListeDocumentCommand = new Command(async() => await AllerAlaListeDesDocuments());

            AjouterMembreCommand     = new Command(async() => await AjouterUnMembre());
            SupprimerMembreCommand   = new Command(async() => await SupprimerUnMembre());
            AllerAListeMembreCommand = new Command(async() => await AllerAlaListeDesMembres());

            AjouterBienCommand           = new Command(async() => await AjouterBien());
            SupprimerPatrimoineCommand   = new Command(async() => await SupprimerPatrimoine());
            AllerAListePatrimoineCommand = new Command(async() => await AllerAListePatrimoine());


            MessagingCenter.Subscribe <App>((App)Application.Current, "ActualiserListe", (sender) =>
            {
                FetchPatrimoine();
                FetchEvenements();
                FetchMembre();
                FetchDocumentsAsync();
            });



            FetchPatrimoine();
            FetchEvenements();
            FetchMembre();
            FetchDocumentsAsync();
        }
コード例 #27
0
        private void OnEditTypeDocument(TypeDocument typeDocument)
        {
            if (_accessUtility.HasAccess(44))
            {
                var ids = new List <int> {
                    1, 2, 3, 4, 5, 6
                };

                if (ids.Contains(typeDocument.TypeDocumentId))
                {
                    Error?.Invoke("امکان ویرایش وجود ندارد");
                }
                else
                {
                    EditTypeDocumentRequested(typeDocument);
                }
            }
        }
コード例 #28
0
 private void FormAltaReserva_Load(object sender, EventArgs e)
 {
     TypeDocument.fillComboBox(comboTypeDocument);
     this.ControlBox  = false;
     cmbHotel.Text    = "";
     this.WindowState = FormWindowState.Maximized;
     ReservaHelper.search_regimen(VarGlobal.usuario.hotel, dgvRegimen);
     ReservaHelper.search_tipo_hab(VarGlobal.usuario.hotel, dgvTipoHabitacion);
     if (VarGlobal.usuario.id == "guest")
     {
         ReservaHelper.fillHotel(cmbHotel);
     }
     else
     {
         cmbHotel.Visible = false;
         lblHotel.Visible = false;
     }
 }
コード例 #29
0
        public static string GetMessageBodyCompaniesCancelAndRefund(Payment valPayment)
        {
            string htmlBody         = "";
            string vLanguageGeneral = string.Empty;

            switch (valPayment.LanguageInitials)
            {
            case "ES":
                vLanguageGeneral = @"\Templates\NotifyCompaniesCancelRefund" + valPayment.LanguageInitials + ".html";
                break;

            case "EN":
                vLanguageGeneral = @"\Templates\NotifyCompaniesCancelRefund" + valPayment.LanguageInitials + ".html";
                break;

            case "PO":
                vLanguageGeneral = @"\Templates\NotifyCompaniesCancelRefund" + valPayment.LanguageInitials + ".html";
                break;
            }

            try {
                htmlBody = FileHelper.ReadFile(vLanguageGeneral);
            } catch (Exception) {
                htmlBody = string.Empty;
            }

            htmlBody = htmlBody.Replace("@@RESERVENUMBER", valPayment.Id.ToString().Substring(0, 8))
                       .Replace("@@TRANSACTIONNUMBER", valPayment.IdTransaction.ToString())
                       .Replace("@@DOCUMENTNUMBERTYPE", TypeDocument.GetList(valPayment.LanguageInitials).FirstOrDefault().Name)
                       .Replace("@@DOCUMENTNUMBER", valPayment.NumberDocument)
                       .Replace("@@FULLNAME", valPayment.FirstName + " " + valPayment.LastName)
                       .Replace("@@TOURNAME", valPayment.Name)
                       .Replace("@@PERSONS", valPayment.Persons.ToString())
                       .Replace("@@COMPANYNAME", valPayment.NameCompany)
                       .Replace("@@MOUNT", valPayment.Mount.ToString())
                       .Replace("@@CURRENCYSYMBOL", valPayment.Symbol)
                       .Replace("@@DATE", valPayment.DateCreate.ToString("dd/MM/yyyy hh:mm tt", CultureInfo.InvariantCulture))
                       .Replace("@@STATEREFUND", valPayment.GetNameStateRefund(valPayment.LanguageInitials, "APPROVED"));


            return(htmlBody);
        }
コード例 #30
0
        public MiseAjourDocumentViewModel(INavigation navigation, int selectedDocumentID)
        {
            _navigation        = navigation;
            _documentValidator = new DocumentValidator();
            _document          = new Document();
            _document.Id       = selectedDocumentID;

            TypeDocument = new TypeDocument
            {
                IdTypeDocument = selectedDocumentID
            };
            baseParametresViewModel   = new BaseParametresViewModel();
            _localNotificationService = DependencyService.Get <ILocalNotificationService>();

            DeleteDocumentCommand  = new Command(async() => await DeleteDocument());
            JoindreDocumentCommand = new Command(async() => await JoindreDocument());
            ModificationCommand    = new Command(async() => await ModificationDesInfos());
            AnnulerCommand         = new Command(async() => await retourDePage());

            FetchDocumentDetailsAsync();

            FetchTypeDocument();
        }
コード例 #31
0
 public static IEnumerable<TypeDocument> GetTypeDocument()
 {
     try
     {
         if (LesTypesDocumentCharges == null)
         {
             var ctx = SharepointContextFactory.GetContext();
             var maListe = ctx.Web.Lists.GetByTitle("TYPEDOCUMENT");
             string cquery = @"<View/>";
             var camlQuery = new CamlQuery()
             {
                 ViewXml = cquery
             };
             var resultat = maListe.GetItems(camlQuery);
             ctx.Load(resultat);
             ctx.ExecuteQuery();
             List<TypeDocument> lesTypeDocuments = new List<TypeDocument>();
             TypeDocument t = null;
             if (resultat.Count > 0)
             {
                 foreach (var item in resultat)
                 {
                     t = new TypeDocument();
                     t.Code = item.FieldValues["Code"] != null ? item.FieldValues["Code"].ToString() : string.Empty;
                     t.Libelle = item.FieldValues["Libelle"] != null ? item.FieldValues["Libelle"].ToString() : string.Empty;
                     lesTypeDocuments.Add(t);
                 }//fin foreach
             }
             LesTypesDocumentCharges = lesTypeDocuments;
         }
         return LesTypesDocumentCharges;
     }
     catch (Exception ex)
     {
         throw new Exception("Erreur lors de la connexion de l'utilisateur", ex);
     }
 }