public async Task <DocumentTypeModel> Init(DocumentTypeModel model)
        {
            var xx = await _documentTypeRepository
                     .GetWhere(x => x.DocumentTypeId == model.Id);

            return(new DocumentTypeModel());
        }
 public void UpdateDocumentType(DocumentTypeModel model)
 {
     using (IDbConnection connection = new NpgsqlConnection(GlobalConfig.getDatabaseConnectionString()))
     {
         connection.ExecuteScalar($"update documenttype set documenttype_id = '{model.documenttype_id}', documenttype_name = '{model.documenttype_name}'");
     }
 }
        public void ToSelectListItemsTests()
        {
            //Arrange
            DocumentTypeModels models = new DocumentTypeModels();
            DocumentTypeModel  model  = new DocumentTypeModel
            {
                Id          = 1,
                Description = "Item1",
                Extension   = "ext1"
            };

            models.DocumentTypes.Add(model);
            model = new DocumentTypeModel
            {
                Id          = 2,
                Description = "Item2",
                Extension   = "ext2"
            };
            models.DocumentTypes.Add(model);

            //Act
            var result = models.ToSelectListItems();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Count == 2);
            Assert.IsTrue(result.Exists(i => i.Value == "1" && i.Text == "Item1 (ext1)"));
            Assert.IsTrue(result.Exists(i => i.Value == "2" && i.Text == "Item2 (ext2)"));
        }
        /// <summary>
        /// Class repository method to get all records from DocumentType table
        /// </summary>
        /// <returns> List of table records </returns>
        public List <DocumentTypeModel> GetAllDocumentType()
        {
            List <DocumentTypeModel> documentTypeModel = new List <DocumentTypeModel>();
            string queryString = "SELECT * FROM develop.DocumentType WHERE state = 1;";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        DocumentTypeModel documentType = new DocumentTypeModel();
                        documentType.Id           = (long)reader[0];
                        documentType.Name         = reader[1].ToString();
                        documentType.Code         = reader[2].ToString();
                        documentType.State        = (bool)reader[3];
                        documentType.CreationDate = (DateTime)reader[4];
                        documentTypeModel.Add(documentType);
                    }
                    reader.Close();
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Error 02: Ocurrió un error consultando la base de datos.");
                }

                return(documentTypeModel);
            }
        }
        public async Task <DocumentTypeModel> SaveAsync(DocumentTypeModel entity)
        {
            var documentTypeModel = await _documentTypeDataAccess.SaveAsync(Mapper.Map <DocumentType>(entity));

            return(new DocumentTypeModel {
                DocumentTypeID = documentTypeModel.DocumentTypeID
            });
        }
        public DocumentTypeModel Update(DocumentTypeModel entity)
        {
            var documentTypeModel = _documentTypeDataAccess.Update(Mapper.Map <DocumentType>(entity));

            return(new DocumentTypeModel {
                DocumentTypeID = documentTypeModel.DocumentTypeID
            });
        }
 public DocumentTypeModel CreateDocumentType(DocumentTypeModel model)
 {
     using (IDbConnection connection = new NpgsqlConnection(GlobalConfig.getDatabaseConnectionString()))
     {
         int id = connection.ExecuteScalar <int>($"insert into documenttype values(default,'{model.documenttype_id}','{model.documenttype_name}')");
         return(model);
     }
 }
Beispiel #8
0
        public static List <DocumentTypeModel> RequestCountry(string propCode)
        {
            var webAddr        = "https://chartswebintf-fra.chartspms.com.au/json/execute?un=charteuhh&pw=hh246eu";
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);

            httpWebRequest.ContentType = "text/json";
            httpWebRequest.Method      = "POST";

            JavaScriptSerializer js = new JavaScriptSerializer();

            login logindetails = new login();

            logindetails.user = "******";
            logindetails.pasw = "";

            propIdent property = new propIdent();

            property.mesg     = "FieldListFetch";
            property.propcode = propCode;
            property.login    = logindetails;

            fieldListFetch jsonfetch = new fieldListFetch();

            jsonfetch.ident  = property;
            jsonfetch.fldnam = "Country";

            fieldListFetch[] sendarray = { jsonfetch };

            fieldListRequest array = new fieldListRequest();

            array.requests = sendarray;

            string json = JsonConvert.SerializeObject(array);

            using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                streamWriter.Write(json);
                streamWriter.Flush();
            }
            HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            StreamReader    streamReader = new StreamReader(httpResponse.GetResponseStream());

            string            result        = streamReader.ReadToEnd(); //in result is the end data.
            fieldListResponse fetchresponse = JsonConvert.DeserializeObject <fieldListResponse>(result);

            List <DocumentTypeModel> data = new List <DocumentTypeModel>();

            foreach (var item in fetchresponse.responses[0].fldvalues)
            {
                DocumentTypeModel temp = new DocumentTypeModel();
                temp.value = item;
                temp.text  = item;
                data.Add(temp);
            }

            return(data);
        }
        public async Task <DocumentTypeModel> UpdateAsync(DocumentTypeModel entity)
        {
            entity.CreatedDate  = DateTime.Now;
            entity.ModifiedDate = DateTime.Now;
            var documentTypeModel = await _documentTypeDataAccess.UpdateAsync(Mapper.Map <DocumentType>(entity));

            return(new DocumentTypeModel {
                DocumentTypeID = documentTypeModel.DocumentTypeID
            });
        }
Beispiel #10
0
        public static DocumentTypeModel CreateDocumentTypeModelAsync(DocumentType source, bool includeAllFields)
        {
            var model = new DocumentTypeModel()
            {
                DocumentTypeId       = source.DocumentTypeId,
                DocumentTypeName     = source.DocumentTypeName,
                IsDocumentTypeActive = source.IsDocumentTypeActive,
            };

            return(model);
        }
Beispiel #11
0
        public async Task <int> DeleteDocumentTypeAsync(DocumentTypeModel model)
        {
            var documentType = new DocumentType {
                DocumentTypeId = model.DocumentTypeId
            };

            using (var dataService = DataServiceFactory.CreateDataService())
            {
                return(await dataService.DeleteDocumentTypeAsync(documentType));
            }
        }
Beispiel #12
0
 public JsonResult <List <DocumentTypeModel> > GetAllDocumentType(DocumentTypeModel objDocumentTypeModel)
 {
     try
     {
         var record = _documentType.GetAllDocumentType((int)objDocumentTypeModel.DocumentCategoryID, objDocumentTypeModel.PageNo, objDocumentTypeModel.PageSize, objDocumentTypeModel.SortOrder, objDocumentTypeModel.SortColumn);
         return(Json(record));
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(null);
     }
 }
Beispiel #13
0
 public HttpResponseMessage Delete(DocumentTypeModel documentType)
 {
     try
     {
         _documentType.DeleteDocumentType(documentType);
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Delete Error"));
     }
     return(Request.CreateResponse(HttpStatusCode.OK, "Data Updated"));
 }
Beispiel #14
0
 public async Task <HttpResponseMessage> Save(DocumentTypeModel documentTypeModel)
 {
     try
     {
         await _documentType.SaveAsync(documentTypeModel);
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Error"));
     }
     return(Request.CreateResponse(HttpStatusCode.OK, "Data Saved"));
 }
        public async Task <bool> AddDocumentType(DocumentTypeModel model)
        {
            DocumentType entity = new DocumentType()
            {
                DocumentCode = model.DocumentCode,
                DocumentName = model.DocumentName,
                IsRequired   = model.IsRequired
            };

            _dbContext.Set <DocumentType>().Add(entity);
            int count = await _dbContext.SaveChangesAsync();

            return(count > 0);
        }
        public bool DeleteDocumentType(DocumentTypeModel entity)
        {
            bool result    = false;
            var  objentity = _documentTypeDataAccess.GetById(entity.DocumentTypeID);

            if (objentity != null)
            {
                objentity.ISDeleted    = true;
                objentity.ModifiedBy   = entity.ModifiedBy_ID;
                objentity.ModifiedDate = entity.ModifiedDate;
                _documentTypeDataAccess.UpdateAsync(objentity);
                result = true;
            }
            return(result);
        }
Beispiel #17
0
        public async Task <IActionResult> CreateType(DocumentTypeModel model, bool continueEditing)
        {
            if (ModelState.IsValid)
            {
                var documenttype = model.ToEntity();
                await _documentTypeService.Insert(documenttype);

                //activity log
                await _customerActivityService.InsertActivity("AddNewDocumentType", documenttype.Id, _translationService.GetResource("ActivityLog.AddNewDocumentType"), documenttype.Name);

                Success(_translationService.GetResource("Admin.Documents.Type.Added"));
                return(continueEditing ? RedirectToAction("EditType", new { id = documenttype.Id }) : RedirectToAction("Types"));
            }
            return(View(model));
        }
        public IHttpActionResult CreateDocumentType(DocumentTypeModel model)
        {
            var response = new DataResponse <EntityDocumentTypes>();

            if (ModelState.IsValid)
            {
                var entityDocumentTypes = new EntityDocumentTypes();
                entityDocumentTypes.DocumentType = model.DocumentType;
                entityDocumentTypes.BusinessId   = CurrentBusinessId;
                entityDocumentTypes.CreatedBy    = CurrentUserId;
                entityDocumentTypes.CreatedOn    = DateTime.UtcNow;
                response = repository.Insert(entityDocumentTypes);
            }
            return(Ok <DataResponse>(response));
        }
        public async Task <bool> UpdateDocumentType(DocumentTypeModel model)
        {
            var entity = await _dbContext.Set <DocumentType>().FindAsync(model.Id);

            if (entity == null)
            {
                throw new BadRequestException("Document can not be found");
            }

            entity.DocumentCode = model.DocumentCode;
            entity.DocumentName = model.DocumentName;

            int count = await _dbContext.SaveChangesAsync();

            return(count > 0);
        }
        public IHttpActionResult UpdateDocumentType(DocumentTypeModel model)
        {
            var response = new DataResponse <EntityDocumentTypes>();

            if (ModelState.IsValid)
            {
                var entityDocumentTypes = new EntityDocumentTypes();
                entityDocumentTypes.Id           = model.Id;
                entityDocumentTypes.DocumentType = model.DocumentType;
                entityDocumentTypes.UpdatedBy    = CurrentUserId;
                entityDocumentTypes.UpdatedOn    = System.DateTime.UtcNow;

                response = repository.Update(entityDocumentTypes);
            }
            return(Ok <DataResponse>(response));
        }
Beispiel #21
0
        private void OptionalIdTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DocumentTypeModel selectedModel = (DocumentTypeModel)OptionalIdTypeComboBox.SelectedItem;

            if (selectedModel.documenttype_name == "None")
            {
                OptionalIdDetailsTextBox.Clear();
                OptionalIdDetailsTextBox.IsEnabled  = false;
                SubmitButton.IsEnabled              = true;
                OptionalIdDetailsTextBox.Visibility = Visibility.Hidden;
            }
            else
            {
                OptionalIdDetailsTextBox.IsEnabled  = true;
                OptionalIdDetailsTextBox.Visibility = Visibility.Visible;
            }
        }
Beispiel #22
0
        public async Task <int> AddDocumentTypeAsync(DocumentTypeModel model)
        {
            long id = model.DocumentTypeId;

            using (var dataService = DataServiceFactory.CreateDataService())
            {
                var documentType = new DocumentType();
                if (documentType != null)
                {
                    UpdateDocumentTypeFromModel(documentType, model);

                    await dataService.AddDocumentTypeAsync(documentType);

                    model.Merge(await GetDocumentTypeAsync(dataService, documentType.DocumentTypeId));
                }
                return(0);
            }
        }
Beispiel #23
0
        private void WireUpFinancialForm()
        {
            //Aadhar and Pan
            AadharNumberTextBox.Text = model.documentModel.document_aadhar;
            PanNumberTextBox.Text    = model.documentModel.document_pan;

            //Cibil Score
            CibilScoreTextBox.Text = model.documentModel.document_cibil.ToString();

            //Optional ID
            foreach (DocumentTypeModel document in Search.documentModels)
            {
                if (document.documenttype_id == model.documentModel.document_id)
                {
                    OptionalIdTypeComboBox.SelectedItem = document;
                }
            }

            DocumentTypeModel x = (DocumentTypeModel)OptionalIdTypeComboBox.SelectedItem;

            if (x.documenttype_name != "None")
            {
                OptionalIdDetailsTextBox.Text = model.documentModel.document_optional;
            }

            //In hand Income
            InHandMonthlyIcomeTextBox.Text = model.accountModel.account_inhandsalary.ToString();

            //Bank Name
            BankNameTextBox.Text = model.accountModel.account_bankname;

            //IFSC
            IFSCTextBox.Text = model.accountModel.account_ifsc;

            //Accounnt Number
            AccountNumberTextBox.Text = model.accountModel.account_number;

            //Loans
            foreach (LoanModel loan in model.loanModel)
            {
                createLoan(loan);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Return the Document Type for the specified Document Type ID
        /// </summary>
        /// <param name="documentTypeId"></param>
        /// <param name="documentTypes"></param>
        /// <returns></returns>
        public DocumentTypeModel GetDocumentTypeForDocument(int documentTypeId, DocumentTypeModels documentTypes)
        {
            DocumentTypeModel result = null;

            if (documentTypes?.DocumentTypes == null || !documentTypes.DocumentTypes.Any() || documentTypeId <= 0)
            {
                return(null);
            }
            result = new DocumentTypeModel();
            foreach (var documentType in documentTypes.DocumentTypes)
            {
                if (documentType.Id != documentTypeId)
                {
                    continue;
                }
                result = documentType;
                break;
            }
            return(result);
        }
        private void SaveFinancialForm()
        {
            SaveLoanDetails();
            //Aadhar and Pan
            model.documentModel.document_aadhar = AadharNumberTextBox.Text;
            model.documentModel.document_pan    = PanNumberTextBox.Text;

            model.applicantModel.applicant_aadhar = AadharNumberTextBox.Text;
            model.applicantModel.applicant_pan    = PanNumberTextBox.Text;

            model.gurantorModel.gurantor_realtedaadhar = AadharNumberTextBox.Text;
            model.gurantorModel.gurantor_realtedpan    = PanNumberTextBox.Text;

            model.accountModel.account_realtedaadhar = AadharNumberTextBox.Text;
            model.accountModel.account_realtedpan    = PanNumberTextBox.Text;

            //Cibil Score
            model.documentModel.document_cibil = int.Parse(CibilScoreTextBox.Text);

            //Optional ID
            DocumentTypeModel documentType = (DocumentTypeModel)OptionalIdTypeComboBox.SelectedItem;

            model.documentModel.document_id       = documentType.documenttype_id;
            model.documentModel.document_optional = OptionalIdDetailsTextBox.Text;

            //In hand Income
            model.accountModel.account_inhandsalary = int.Parse(InHandMonthlyIcomeTextBox.Text);

            //Bank Name
            model.accountModel.account_bankname = BankNameTextBox.Text;

            //IFSC
            model.accountModel.account_ifsc = IFSCTextBox.Text;

            //Accounnt Number
            model.accountModel.account_number = AccountNumberTextBox.Text;

            //Loans
            model.loanModel = loanModels;
        }
Beispiel #26
0
        public ActionResult SaveDocType(DocumentTypeModel model)
        {
            var sessionUser = (LoginModel)Session[CommonConstants.UserSession];

            if (model.Action == "Create")
            {
                List <DocumentType> lst = OracleHelper.ExecuteStoreProcedure <DocumentType>(ConnectionString, "sp_insert_doc_type", model.Name, model.ParentId, sessionUser.Username);
                return(Json(lst[0].MenuUserId, JsonRequestBehavior.AllowGet));
            }
            if (model.Action == "Edit")
            {
                List <DocumentType> lst = OracleHelper.ExecuteStoreProcedure <DocumentType>(ConnectionString, "sp_update_doc_type", model.Id, model.Name, model.ParentId, sessionUser.Username);
                return(Json(lst[0].MenuUserId, JsonRequestBehavior.AllowGet));
            }
            if (model.Action == "Delete")
            {
                string sql = "UPDATE apec_docs_doctype SET IS_DELETED = 'Y' WHERE MENUUSERID = :0";
                OracleHelper.ExecuteCommandText(ConnectionString, sql, model.Id);
                return(Json(0, JsonRequestBehavior.AllowGet));
            }
            throw new NotImplementedException();
        }
        public async Task <IActionResult> EditType(DocumentTypeModel model, bool continueEditing)
        {
            var documentType = await _documentTypeService.GetById(model.Id);

            if (documentType == null)
            {
                return(RedirectToAction("Types"));
            }

            if (ModelState.IsValid)
            {
                documentType = model.ToEntity(documentType);
                await _documentTypeService.Update(documentType);

                //activity log
                await _customerActivityService.InsertActivity("EditDocumentType", documentType.Id, _localizationService.GetResource("ActivityLog.EditDocumentType"), documentType.Name);

                SuccessNotification(_localizationService.GetResource("Admin.Documents.Type.Updated"));
                return(continueEditing ? RedirectToAction("EditType", new { id = documentType.Id }) : RedirectToAction("Types"));
            }

            return(View(model));
        }
        /// <summary>
        /// Método para obtener los registros de la tabla DocumentType
        /// </summary>
        /// <returns> Lista de los registros de la entidad DocumentType </returns>
        List <DocumentTypeModel> IDocumentTypeRepository.GetListDocumentType()
        {
            List <DocumentTypeModel> listDocumentTypeModel = new List <DocumentTypeModel>();
            string queryString = "SELECT * FROM develop.Document_Type WHERE Registration_Status = 'Activo';";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                SqlCommand command = new SqlCommand(queryString, connection);
                try
                {
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        DocumentTypeModel documentType = new DocumentTypeModel();
                        documentType.Id            = (int)reader[0];
                        documentType.Name          = reader[1].ToString();
                        documentType.Code          = reader[2].ToString();
                        documentType.Description   = (reader[3] == System.DBNull.Value) ? string.Empty : reader[3].ToString();
                        documentType.CreationDate  = (DateTime)reader[4];
                        documentType.CreatorPerson = (int)reader[5];

                        documentType.ModifierDate = (reader[6] == System.DBNull.Value) ? default : (DateTime)reader[6];

                                                    documentType.ModifiesPerson = (reader[7] == System.DBNull.Value) ? default : (int)reader[7];
                                                                                  documentType.RegistrationStatus = reader[8].ToString();
                                                                                  listDocumentTypeModel.Add(documentType);
                    }
                    reader.Close();
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Error 01: Ocurrió un error consultando la base de datos.");
                }
                return(listDocumentTypeModel);
            }
        }
Beispiel #29
0
 public static DocumentType ToEntity(this DocumentTypeModel model, DocumentType destination)
 {
     return(model.MapTo(destination));
 }
Beispiel #30
0
 public static DocumentType ToEntity(this DocumentTypeModel model)
 {
     return(model.MapTo <DocumentTypeModel, DocumentType>());
 }