Пример #1
0
        public async Task <Users> Authenticate([FromBody]   string value)
        {
            Users _user = new Users();

            try
            {
                LogiDetails logiDetails = JsonConvert.DeserializeObject <LogiDetails>(value);
                _user = await _UserRepo.AuthenticateUser(logiDetails);

                var userEvent = new EventModel("user_events")
                {
                    EventName   = user_login,
                    EntityId    = _user.user_id,
                    RefrenceId  = _user.user_id,
                    UserId      = _user.user_id,
                    EventNoteId = _user.user_id
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in authenticating user for login attempt with message" + ex.Message);
            }
            return(_user);
        }
Пример #2
0
        public async Task <ResponseModel> PostAsync([FromBody]   string value)
        {
            string        NewInsertionID = "0";
            ResponseModel response;
            Vendor        newVendor  = JsonConvert.DeserializeObject <Vendor>(value);
            int           created_by = newVendor.created_by;

            NewInsertionID = await _VendorRepo.Create(newVendor);

            response = new ResponseModel {
                Data = NewInsertionID, Status = System.Net.HttpStatusCode.OK, Message = "Success"
            };
            var eventModel = new EventModel(vendorEventTableName)
            {
                EventName   = create_vendor,
                EntityId    = Int32.Parse(NewInsertionID),
                RefrenceId  = 0,
                UserId      = created_by,
                EventNoteId = Int32.Parse(NewInsertionID)
            };
            await _eventRepo.AddEventAsync(eventModel);

            var userEvent = new EventModel(userEventTableName)
            {
                EventName   = create_vendor,
                EntityId    = created_by,
                RefrenceId  = Convert.ToInt32(NewInsertionID),
                UserId      = created_by,
                EventNoteId = Int32.Parse(NewInsertionID)
            };
            await _eventRepo.AddEventAsync(userEvent);

            return(response);
        }
Пример #3
0
        public async Task <string> NoteCreate([FromBody]   string value)
        {
            string newNoteID = "0";

            try
            {
                dynamic productNote = JsonConvert.DeserializeObject <Object>(value);
                int     ref_id      = productNote.ref_id;
                string  note        = productNote.note;
                int     created_by  = productNote.created_by;
                double  created_at  = _common.GetTimeStemp();
                newNoteID = await _NotesAndDoc.GenericPostNote <string>(ref_id, note_type, note, created_by, created_at);

                int userId = productNote.created_by;

                event_product_note_create = event_product_note_create.Replace("%%userid%%", userId.ToString());
                event_product_note_create = event_product_note_create.Replace("%%pid%%", ref_id.ToString());
                await _eventRepo.AddPhotoshootAsync(ref_id, event_product_note_create_id, ref_id, event_product_note_create, userId, _common.GetTimeStemp(), table_name);

                await _eventRepo.AddEventAsync(event_product_note_create_id, userId, ref_id, event_product_note_create, _common.GetTimeStemp(), user_event_table_name);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new Photoshoot Note with message" + ex.Message);
            }
            return(newNoteID);
        }
        public async Task <string> NoteCreate([FromBody]   string value)
        {
            string newNoteID = "0";

            try
            {
                dynamic newItemNote = JsonConvert.DeserializeObject <Object>(value);
                int     ref_id      = newItemNote.ref_id;
                string  note        = newItemNote.note;
                int     created_by  = newItemNote.created_by;
                double  created_at  = _common.GetTimeStemp();
                newNoteID = await _NotesAndDoc.GenericPostNote <string>(ref_id, note_type, note, created_by, created_at);

                var item_note_create = "item_note_create";
                var eventModel       = new EventModel(tableName)
                {
                    EntityId    = ref_id,
                    EventName   = item_note_create,
                    RefrenceId  = Int32.Parse(newNoteID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(newNoteID)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EntityId    = created_by,
                    EventName   = item_note_create,
                    RefrenceId  = Int32.Parse(newNoteID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(newNoteID)
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new Item Note with message" + ex.Message);
            }
            return(newNoteID);
        }
        public async Task <string> PostAsync([FromBody]   string value)
        {
            string NewInsertionID = "0";

            try
            {
                VendorAddress newVendorAddress = JsonConvert.DeserializeObject <VendorAddress>(value);
                int           created_by       = newVendorAddress.created_by;
                NewInsertionID = await _VendorAddressRepo.Create(newVendorAddress);

                int vendor_id  = newVendorAddress.vendor_id;
                var eventModel = new EventModel(vendorEventTableName)
                {
                    EventName   = vendor_address_created,
                    EntityId    = vendor_id,
                    RefrenceId  = Int32.Parse(NewInsertionID),
                    UserId      = created_by,
                    EventNoteId = Int32.Parse(NewInsertionID)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EventName   = vendor_address_created,
                    EntityId    = created_by,
                    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 vendor address with message" + ex.Message);
            }
            return(NewInsertionID);
        }
        public async Task <string> PostAsync([FromBody]   string value)
        {
            string NewInsertionID = "0";

            try
            {
                PurchaseOrdersTracking newPurchaseOrderTracking = JsonConvert.DeserializeObject <PurchaseOrdersTracking>(value);
                NewInsertionID = await _PurchaseOrdersTrackingRepo.Create(newPurchaseOrderTracking);

                var eventModel = new EventModel(tableName)
                {
                    EntityId    = newPurchaseOrderTracking.po_id,
                    EventName   = tracking_create,
                    RefrenceId  = Int32.Parse(NewInsertionID),
                    UserId      = newPurchaseOrderTracking.created_by,
                    EventNoteId = Int32.Parse(NewInsertionID)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EntityId    = newPurchaseOrderTracking.created_by,
                    EventName   = tracking_create,
                    RefrenceId  = Convert.ToInt32(NewInsertionID),
                    UserId      = newPurchaseOrderTracking.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 new Purchase Order Tracking create with message" + ex.Message);
            }
            return(NewInsertionID);
        }
Пример #7
0
        public async Task <string> PostAsync([FromBody] string value)
        {
            string newPOId = "0";

            try
            {
                PurchaseOrders newPurchaseOrder = JsonConvert.DeserializeObject <PurchaseOrders>(value);
                newPOId = await _PurchaseOrdersRepo.Create(newPurchaseOrder);

                var eventModel = new EventModel(poEventTableName)
                {
                    EventName   = po_created,
                    EntityId    = Int32.Parse(newPOId),
                    RefrenceId  = 0,
                    UserId      = newPurchaseOrder.created_by,
                    EventNoteId = Int32.Parse(newPOId)
                };
                await _eventRepo.AddEventAsync(eventModel);

                var userEvent = new EventModel(userEventTableName)
                {
                    EventName   = po_created,
                    EntityId    = newPurchaseOrder.created_by,
                    RefrenceId  = Convert.ToInt32(newPOId),
                    UserId      = newPurchaseOrder.created_by,
                    EventNoteId = Int32.Parse(newPOId)
                };
                await _eventRepo.AddEventAsync(userEvent);
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new purchaseorders create with message" + ex.Message);
            }
            return(newPOId);
        }
Пример #8
0
        public async Task <ResponseModel> PostAsync([FromBody] Photoshoots photoshoot)
        {
            string NewInsertionID = "0";

            try
            {
                NewInsertionID = _PhotoshootRepo.Create(photoshoot);
                int userId = photoshoot.created_by;

                foreach (var product_id in photoshoot.products.Select(x => x.product_id))
                {
                    int prodId = product_id;
                    await _eventRepo.AddEventAsync(new EventModel(product_event_table_name) { EventName = photoshoot_created, EntityId = prodId, RefrenceId = Int32.Parse(NewInsertionID), UserId = userId });

                    await _eventRepo.AddEventAsync(new EventModel(user_event_table_name) { EventName = photoshoot_created, EntityId = userId, RefrenceId = prodId, UserId = userId, EventNoteId = prodId });
                }
            }
            catch (Exception ex)
            {
                var logger = _loggerFactory.CreateLogger("internal_error_log");
                logger.LogInformation("Problem happened in making new Photoshoots with message" + ex.Message);
            }
            return(ResponseHelper.GetResponse(NewInsertionID));
        }