예제 #1
0
        public async Task <string> DocumentCreate([FromBody]   string value)
        {
            string NewInsertionID = "0";

            try
            {
                dynamic PurchaseOrdersToUpdate = JsonConvert.DeserializeObject <JObject>(value);

                int    ref_id       = PurchaseOrdersToUpdate.ref_id;
                string document_url = PurchaseOrdersToUpdate.url;
                int    doc_type     = PurchaseOrdersToUpdate.doc_type;
                int    created_by   = PurchaseOrdersToUpdate.created_by;
                double created_at   = _common.GetTimeStemp();

                NewInsertionID = await _NotesAndDoc.GenericPostDoc <string>(ref_id, doc_type, document_url, "", created_by, created_at);

                var eventModel = new EventModel(poEventTableName)
                {
                    EntityId    = ref_id,
                    EventName   = po_document_create,
                    RefrenceId  = Int32.Parse(NewInsertionID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(NewInsertionID)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EntityId    = created_by,
                    EventName   = po_document_create,
                    RefrenceId  = Convert.ToInt32(NewInsertionID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(NewInsertionID)
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new Purchase Order Document create with message" + ex.Message);
            }
            return(NewInsertionID);
        }
예제 #2
0
        public async Task <string> DocumentCreate([FromBody]   string value)
        {
            string newDocID = "0";

            try
            {
                dynamic newVendorDoc = JsonConvert.DeserializeObject <Object>(value);
                int     ref_id       = newVendorDoc.ref_id;
                string  url          = newVendorDoc.url;
                double  created_at   = _common.GetTimeStemp();
                int     created_by   = newVendorDoc.created_by;
                newDocID = await _NotesAndDoc.GenericPostDoc <string>(ref_id, note_type, url, "", created_by, created_at);

                var eventModel = new EventModel(vendorEventTableName)
                {
                    EventName   = create_vendor_document,
                    EntityId    = ref_id,
                    RefrenceId  = Int32.Parse(newDocID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(newDocID)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EventName   = create_vendor_document,
                    EntityId    = created_by,
                    RefrenceId  = Convert.ToInt32(newDocID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(newDocID)
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new vendor with message" + ex.Message);
            }
            return(newDocID);
        }