示例#1
0
        public IEnumerable <SimpleCalendarLibrary> PostLibraryList([FromHeader] string CompanyCode, [FromHeader] long Startdate, [FromHeader] long EndDate, [FromHeader] string DeviceSyncDate)
        {
            string   UpperCaseCC  = CompanyCode.Trim().ToUpper();
            DateTime LastSyncDate = DateTime.Parse(DeviceSyncDate);
            List <SimpleCalendarLibrary> ListOfLibrary = new List <SimpleCalendarLibrary>();

            CreatorEntities db = new CreatorEntities();

            ListOfLibrary = db.ClientCalendarLibrary.Where(cd => cd.ClientCalendarDetails.ClientCalendar.Clients.Code == UpperCaseCC)
                            .Where(ccl => ccl.ClientCalendarDetails.ClientCalendar.Day >= Startdate)
                            .Where(ccl => ccl.ClientCalendarDetails.ClientCalendar.Day <= EndDate)
                            .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                            .Select(itm => new SimpleCalendarLibrary
            {
                ID = itm.ID,
                CalendarDetailsID = (int)itm.ClientCalendarDetailsID,
                Description       = itm.Library.Description,
                FileType          = itm.Library.Type,
                Filename          = itm.Library.Filename,
                Preview           = itm.Library.Preview,
                Updated           = itm.Library.ChangeDate.ToString()
            })
                            .ToList();

            return(ListOfLibrary);
        }
示例#2
0
        public IEnumerable <ActiveList> PostCleanUp([FromHeader] string AppCode, [FromHeader] string CompanyCode)
        {
            string CurrentList = "";
            string UpperCaseCC = CompanyCode.Trim().ToUpper();

            CreatorEntities            db          = new CreatorEntities();
            List <ActiveList>          CleanupList = new List <ActiveList>();
            List <ClientScreenContent> Listcsc     = db.ClientScreenContent.Where(c => c.ClientScreens.ClientApps.Clients.Code == UpperCaseCC)
                                                     .Where(ca => ca.ClientScreens.ClientApps.Apps.AppCode == AppCode)
                                                     .ToList();

            foreach (ClientScreenContent scitem in Listcsc)
            {
                CurrentList = CurrentList + scitem.ID + ",";
            }

            if (Listcsc.Count > 0)
            {
                CurrentList = "(" + CurrentList.Substring(0, CurrentList.Length - 1) + ")";
            }

            ActiveList lib = new ActiveList();

            lib.List = CurrentList;

            CleanupList.Add(lib);

            return(CleanupList);
        }
示例#3
0
        public IEnumerable <SimpleCalendarDetails> PostEventsList([FromHeader] string CompanyCode, [FromHeader] long Startdate, [FromHeader] long EndDate, [FromHeader] string DeviceSyncDate)
        {
            string   UpperCaseCC  = CompanyCode.Trim().ToUpper();
            DateTime LastSyncDate = DateTime.Parse(DeviceSyncDate);
            List <SimpleCalendarDetails> ListOfEvents = new List <SimpleCalendarDetails>();

            CreatorEntities db = new CreatorEntities();

            ListOfEvents = db.ClientCalendarDetails.Where(cd => cd.ClientCalendar.Clients.Code == UpperCaseCC)
                           .Where(ccl => ccl.ClientCalendar.Day >= Startdate)
                           .Where(ccl => ccl.ClientCalendar.Day <= EndDate)
                           .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                           .Select(itm => new SimpleCalendarDetails
            {
                ID = itm.ID,
                ClientCalendarID = (int)itm.ClientCalendarID,
                EventName        = itm.EventName,
                EventDetails     = itm.Event,
                StartTime        = (long)itm.StartTime,
                Endtime          = (long)itm.EndTime,
                DetailsType      = itm.Type,
                Updated          = itm.ChangeDate.ToString()
            })
                           .ToList();

            return(ListOfEvents);
        }
示例#4
0
        public IEnumerable <SimpleScreen> PostScreenList([FromHeader] string AppCode, [FromHeader] string CompanyCode, [FromHeader] string DeviceSyncDate)
        {
            List <SimpleScreen> ListOfScreens = new List <SimpleScreen>();

            CreatorEntities db        = new CreatorEntities();
            Clients         client    = db.Clients.Single(c => c.Code == CompanyCode);
            ClientApps      clientapp = client.ClientApps.Single(ca => ca.Apps.AppCode == AppCode);

            ListOfScreens = clientapp.ClientScreens.Where(app => app.ClientApps.Apps.AppCode == AppCode)
                            .Select(itm => new SimpleScreen
            {
                ID             = itm.ID,
                Design         = itm.Design,
                FontFamily     = itm.InstalledFonts.Name,
                FontRed        = itm.Colours.FontRed.ToString(),
                FontGreen      = itm.Colours.FontGreen.ToString(),
                FontBlue       = itm.Colours.FontBlue.ToString(),
                LineRed        = itm.Colours.LineRed.ToString(),
                LineGreen      = itm.Colours.LineGreen.ToString(),
                LineBlue       = itm.Colours.LineBlue.ToString(),
                BackgroundRed  = itm.Colours.BackgroundRed.ToString(),
                BackgroudGreen = itm.Colours.BackgroundGreen.ToString(),
                BackgroundBlue = itm.Colours.BackgroundBlue.ToString(),
                Description    = itm.Description
            })
                            .ToList();

            return(ListOfScreens);
        }
示例#5
0
        public IEnumerable <SimpleContent> PostSubContentList([FromHeader] string AppCode, [FromHeader] string CompanyCode, [FromHeader] string DeviceSyncDate = "1900-01-01 00:00:00")
        {
            string               UpperCaseCC   = CompanyCode.Trim().ToUpper();
            DateTime             LastSyncDate  = DateTime.Parse(DeviceSyncDate);
            List <SimpleContent> ListOfContent = new List <SimpleContent>();

            CreatorEntities db = new CreatorEntities();

            ListOfContent = db.ClientSubContent.Where(c => c.ClientSubSubMenus.ClientSubMenuMenus.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                            .Where(ca => ca.ClientSubSubMenus.ClientSubMenuMenus.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                            .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                            .Select(itm => new SimpleContent
            {
                ID           = itm.ClientSubContentID,
                SubMenuID    = itm.ClientSubSubMenus.ID,
                CategoryName = itm.Categories.Name,
                Description  = itm.Library.Description,
                FileType     = itm.Library.Type,
                Filename     = itm.Library.Filename,
                Preview      = itm.Library.Preview,
                Updated      = itm.ChangeDate.ToString()
            })
                            .ToList();
            return(ListOfContent);
        }
示例#6
0
        public IEnumerable <ActiveList> PostCleanUp()
        {
            string CurrentList = "'";

            CreatorEntities   db          = new CreatorEntities();
            List <ActiveList> CleanupList = new List <ActiveList>();
            List <Library>    library     = db.Library.ToList();

            foreach (Library libraryitem in library)
            {
                CurrentList = CurrentList + libraryitem.Filename + "','";
            }

            if (library.Count > 0)
            {
                CurrentList = "(" + CurrentList.Substring(0, CurrentList.Length - 2) + ")";
            }

            ActiveList lib = new ActiveList();

            lib.List = CurrentList;

            CleanupList.Add(lib);

            return(CleanupList);
        }
示例#7
0
        public ProcessingResult PostUpdatePassword([FromHeader] string Request)
        {
            ProcessingResult result = new ProcessingResult();

            IncubitoCryptoGraphy.IncubitoCrypto EncryptedRequest = new IncubitoCryptoGraphy.IncubitoCrypto(Request, true);
            string DecryptedRequest = EncryptedRequest.StringToStringDecryption();

            JObject JSON = JObject.Parse(DecryptedRequest);

            string UUID     = JSON["UUID"].ToString().Trim();
            string Password = JSON["Password"].ToString().Trim();

            try
            {
                ICASCrypto EncryptedPassword = new ICASCrypto(Password.Trim(), true);

                CreatorEntities   db = new CreatorEntities();
                MobileConnections mobileconnection = db.MobileConnections.Single(mc => mc.UUID == UUID.Trim().ToUpper());
                mobileconnection.Password = EncryptedPassword.StringToStringEncryption();
                db.SaveChanges();

                result.Status  = "Mobile Users";
                result.Message = "Sucessfully Updated Password";
            }
            catch (Exception ex)
            {
                result.Status  = "Mobile Users";
                result.Message = ex.Message;
            }

            return(result);
        }
示例#8
0
        public IEnumerable <SimpleMenu> PostMenuListV2([FromHeader] string AppCode, [FromHeader] string CompanyCode, [FromHeader] string DeviceSyncDate = "1900-01-01 00:00:00")
        {
            string            UpperCaseCC  = CompanyCode.Trim().ToUpper();
            DateTime          LastSyncDate = DateTime.Parse(DeviceSyncDate);
            List <SimpleMenu> ListOfMenus  = new List <SimpleMenu>();

            CreatorEntities    db     = new CreatorEntities();
            List <ClientMenus> Listcm = db.ClientMenus.Where(c => c.ClientApps.Clients.Code == UpperCaseCC)
                                        .Where(ca => ca.ClientApps.Apps.AppCode == AppCode)
                                        .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                                        .ToList();

            foreach (ClientMenus cmitem in Listcm)
            {
                SimpleMenu cm = new SimpleMenu();
                cm.ID     = cmitem.ID;
                cm.Name   = cmitem.Name;
                cm.Side   = (bool)cmitem.SideMenu;
                cm.Bottom = (bool)cmitem.BottomMenu;
                cm.Slide  = (bool)cmitem.ScrollPage;
                cm.Action = cmitem.MenuAction;
                cm.Order  = (int)cmitem.MenuOrder;

                if ((cmitem.ImageReference != null) && (cmitem.HeadingReference != null))
                {
                    if ((cmitem.ImageReference != "") && (File.Exists(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.ImageReference) == false))
                    {
                        int    StartIndex       = cmitem.ImageReference.IndexOf("_") + 1;
                        int    CopyLenght       = cmitem.ImageReference.Length - (StartIndex);
                        string OriginalFilename = cmitem.ImageReference.Substring(StartIndex, CopyLenght);
                        File.Copy(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + OriginalFilename, CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.ImageReference);
                    }

                    cm.Icon = Convert.ToBase64String(File.ReadAllBytes(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.ImageReference));

                    if ((cmitem.HeadingReference != "") && (File.Exists(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.HeadingReference) == false))
                    {
                        int    StartIndex       = cmitem.HeadingReference.IndexOf("_") + 1;
                        int    CopyLenght       = cmitem.HeadingReference.Length - (StartIndex);
                        string OriginalFilename = cmitem.HeadingReference.Substring(StartIndex, CopyLenght);
                        File.Copy(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + OriginalFilename, CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.HeadingReference);
                    }

                    cm.Header = Convert.ToBase64String(File.ReadAllBytes(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cmitem.HeadingReference));
                }
                else
                {
                    cm.Icon   = "";
                    cm.Header = "";
                }

                cm.Updated = ((DateTime)cmitem.ChangeDate).ToString("yyyy-MM-dd HH:mm:ss");

                ListOfMenus.Add(cm);
            }

            return(ListOfMenus);
        }
示例#9
0
        public IEnumerable <ActiveContentList> PostCleanup([FromHeader] string AppCode, [FromHeader] string CompanyCode)
        {
            //Containts Cleanup Instruction for bot ClientContent and ClientSubContent
            string CurrentContentList    = "";
            string CurrentSubContentList = "";
            string UpperCaseCC           = CompanyCode.Trim().ToUpper();

            CreatorEntities          db          = new CreatorEntities();
            List <ActiveContentList> CleanupList = new List <ActiveContentList>();

            //ClientContent
            List <ClientContent> Listc = db.ClientContent.Where(c => c.ClientSubMenus.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                                         .Where(ca => ca.ClientSubMenus.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                                         .ToList();

            foreach (ClientContent c in Listc)
            {
                CurrentContentList = CurrentContentList + c.ID + ",";
            }

            if (Listc.Count > 0)
            {
                CurrentContentList = "(" + CurrentContentList.Substring(0, CurrentContentList.Length - 1) + ")";
            }

            //ClientSubContent
            List <ClientSubContent> Listsc = db.ClientSubContent.Where(c => c.ClientSubSubMenus.ClientSubMenuMenus.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                                             .Where(ca => ca.ClientSubSubMenus.ClientSubMenuMenus.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                                             .ToList();

            foreach (ClientSubContent sc in Listsc)
            {
                CurrentSubContentList = CurrentSubContentList + sc.ClientSubContentID + ",";
            }

            if (Listsc.Count > 0)
            {
                CurrentSubContentList = "(" + CurrentSubContentList.Substring(0, CurrentSubContentList.Length - 1) + ")";
            }

            ActiveContentList list = new ActiveContentList();

            list.Content    = CurrentContentList;
            list.SubContent = CurrentSubContentList;

            CleanupList.Add(list);

            return(CleanupList);
        }
示例#10
0
        public IEnumerable <SimpleHelplineNr> PostGetHelplineNr([FromHeader] string ClientCode)
        {
            List <SimpleHelplineNr> ClientHelpLineList = new List <SimpleHelplineNr>();
            string UpperCaseCC = ClientCode.Trim().ToUpper();

            CreatorEntities creatordb = new CreatorEntities();
            Clients         client    = creatordb.Clients.Single(c => c.Code == UpperCaseCC);

            SimpleHelplineNr ClientHelpLine = new SimpleHelplineNr();

            ClientHelpLine.Helpline = client.Helpline;

            ClientHelpLineList.Add(ClientHelpLine);

            return(ClientHelpLineList);
        }
示例#11
0
        public IEnumerable <ActiveCalList> PostCleanUpV2([FromHeader] string CompanyCode)
        {
            string CurrentCalList        = "";
            string CurrentCalDetailsList = "";
            string CurrentCalLibraryList = "";
            string UpperCaseCC           = CompanyCode.Trim().ToUpper();

            List <ActiveCalList> CleanupList = new List <ActiveCalList>();
            CreatorEntities      db          = new CreatorEntities();

            List <ClientCalendarDetails> caldetailslist = db.ClientCalendarDetails.Where(ccl => ccl.ClientCalendar.Clients.Code == UpperCaseCC)
                                                          .ToList();

            foreach (ClientCalendarDetails caldetailsitem in caldetailslist)
            {
                CurrentCalDetailsList = CurrentCalDetailsList + caldetailsitem.ID + ",";
            }

            if (caldetailslist.Count > 0)
            {
                CurrentCalDetailsList = "(" + CurrentCalDetailsList.Substring(0, CurrentCalDetailsList.Length - 1) + ")";
            }

            List <ClientCalendarLibrary> callibrarylist = db.ClientCalendarLibrary.Where(ccl => ccl.ClientCalendarDetails.ClientCalendar.Clients.Code == UpperCaseCC)
                                                          .ToList();

            foreach (ClientCalendarLibrary callibraryitem in callibrarylist)
            {
                CurrentCalLibraryList = CurrentCalLibraryList + callibraryitem.ID + ",";
            }

            if (caldetailslist.Count > 0)
            {
                CurrentCalLibraryList = "(" + CurrentCalLibraryList.Substring(0, CurrentCalLibraryList.Length - 1) + ")";
            }

            ActiveCalList calactivelist = new ActiveCalList();

            calactivelist.CalList        = CurrentCalList;
            calactivelist.CalDetailsList = CurrentCalDetailsList;
            calactivelist.CalLibraryList = CurrentCalLibraryList;

            CleanupList.Add(calactivelist);

            return(CleanupList);
        }
示例#12
0
        public IEnumerable <SimpleLibrary> PostList([FromHeader] string DeviceSyncDate)
        {
            DateTime             LastSyncDate          = DateTime.Parse(DeviceSyncDate);
            List <SimpleLibrary> RequestedLibraryItems = new List <SimpleLibrary>();

            CreatorEntities db = new CreatorEntities();

            RequestedLibraryItems = db.Library.Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                                    .Select(itm => new SimpleLibrary
            {
                Description = itm.Description,
                Type        = itm.Type,
                Keywords    = itm.Keywords,
                Filename    = itm.Filename,
                Updated     = itm.ChangeDate.ToString()
            })
                                    .ToList();

            return(RequestedLibraryItems);
        }
示例#13
0
        public List <SimplePN> PostMessages([FromHeader] string ClientCode, [FromHeader] string DeviceSyncDate = "1900-01-01 00:00:00")
        {
            DateTime LastSyncDate = DateTime.Parse(DeviceSyncDate);
            string   UpperCaseCC  = ClientCode.Trim().ToUpper();

            List <SimplePN> ListOfPNs = new List <SimplePN>();
            CreatorEntities creatordb = new CreatorEntities();

            ListOfPNs = creatordb.BulkPushNotifications.Where(s => s.Clients.Code == UpperCaseCC)
                        .Where(s => s.Status == "Sent")
                        .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.DateSent, LastSyncDate) < 0)
                        .Select(itm => new SimplePN
            {
                Title    = itm.Title,
                Message  = itm.Message,
                DateSent = (DateTime)itm.DateSent
            })
                        .ToList();

            return(ListOfPNs);
        }
示例#14
0
        public List <SimpleSettings> PostConfiguration([FromHeader] string ClientCode, [FromHeader] string DeviceSyncDate = "1900-01-01 00:00:00")
        {
            DateTime LastSyncDate = DateTime.Parse(DeviceSyncDate);
            string   UpperCaseCC  = ClientCode.Trim().ToUpper();

            List <SimpleSettings> ListOfSettings = new List <SimpleSettings>();
            List <ActiveList>     CleanupList    = new List <ActiveList>();
            CreatorEntities       creatordb      = new CreatorEntities();

            ListOfSettings = creatordb.ClientSettings.Where(s => s.Clients.Code == UpperCaseCC)
                             .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                             .Select(itm => new SimpleSettings
            {
                SettingKey   = itm.SettingKey,
                SettingValue = itm.SettingValue,
                Updated      = itm.ChangeDate.ToString()
            })
                             .ToList();

            return(ListOfSettings);
        }
示例#15
0
        public IEnumerable <SimpleCalendar> PostDayList([FromHeader] string CompanyCode, [FromHeader] long Startdate, [FromHeader] long EndDate, [FromHeader] string DeviceSyncDate)
        {
            string   UpperCaseCC             = CompanyCode.Trim().ToUpper();
            DateTime LastSyncDate            = DateTime.Parse(DeviceSyncDate);
            List <SimpleCalendar> ListOfDays = new List <SimpleCalendar>();

            CreatorEntities db = new CreatorEntities();

            ListOfDays = db.ClientCalendar.Where(cd => cd.Clients.Code == UpperCaseCC)
                         .Where(ccl => ccl.Day >= Startdate)
                         .Where(ccl => ccl.Day <= EndDate)
                         .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                         .Select(itm => new SimpleCalendar
            {
                ID      = itm.ID,
                Day     = (long)itm.Day,
                Updated = itm.ChangeDate.ToString()
            })
                         .ToList();

            return(ListOfDays);
        }
示例#16
0
        public ProcessingResult PostFDARequest([FromHeader] string CompanyCode, [FromHeader] string RequestContents)
        {
            ProcessingResult result;

            try
            {
                CreatorEntities db     = new CreatorEntities();
                Clients         client = db.Clients.Single(c => c.Code == CompanyCode);

                byte[] FDAData    = Convert.FromBase64String(RequestContents);
                string FDADecoded = System.Text.Encoding.UTF8.GetString(FDAData);

                FDADecoded = FDADecoded.Replace(CompanyCode, client.Name);

                FDAData = System.Text.Encoding.UTF8.GetBytes(FDADecoded);
                string FDAEncoded = System.Text.Encoding.UTF8.GetString(FDAData);

                ClientRequests newrequest = new ClientRequests();
                newrequest.Clients  = client;
                newrequest.Type     = "FDA";
                newrequest.Contents = FDAEncoded;
                newrequest.Status   = "Submit";
                client.ClientRequests.Add(newrequest);

                db.SaveChanges();

                result         = new ProcessingResult();
                result.Status  = "Sucessfully submitted";
                result.Message = "";
            }
            catch (Exception ex)
            {
                result         = new ProcessingResult();
                result.Status  = "Error Occured";
                result.Message = ex.Message;
            }

            return(result);
        }
示例#17
0
        public ProcessingResult PostRx([FromHeader] string UsageDetails)
        {
            ProcessingResult result = new ProcessingResult();

            try
            {
                JObject       JSON     = JObject.Parse(UsageDetails);
                List <JToken> JSONList = JSON.SelectToken("Usage").ToList();

                foreach (JToken Token in JSONList)
                {
                    string UUID        = Token["UUID"].ToString();
                    string Timestamp   = Token["Timestamp"].ToString();
                    string Description = Token["Description"].ToString();

                    CreatorEntities   db = new CreatorEntities();
                    MobileConnections mobileconnection = db.MobileConnections.Single(mc => mc.UUID == UUID);

                    UsageTracker newusage = new UsageTracker();
                    newusage.MobileConnections = mobileconnection;
                    newusage.Timestamp         = DateTime.Parse(Timestamp);
                    newusage.Description       = Description;

                    db.UsageTracker.Add(newusage);
                    db.SaveChanges();
                }

                result.Message = "Sucessfully added";
                result.Status  = "Usage Tracking";
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.Status  = "Usage Tracking";
            }

            return(result);
        }
示例#18
0
        public IEnumerable <SimpleScreenContent> PostScreenContentList([FromHeader] string AppCode, [FromHeader] string CompanyCode, [FromHeader] string DeviceSyncDate)
        {
            string   UpperCaseCC  = CompanyCode.Trim().ToUpper();
            DateTime LastSyncDate = DateTime.Parse(DeviceSyncDate);
            List <SimpleScreenContent> ListOfScreenContent = new List <SimpleScreenContent>();

            CreatorEntities            db      = new CreatorEntities();
            List <ClientScreenContent> Listcsc = db.ClientScreenContent.Where(c => c.ClientScreens.ClientApps.Clients.Code == UpperCaseCC)
                                                 .Where(ca => ca.ClientScreens.ClientApps.Apps.AppCode == AppCode)
                                                 .Where(csc => System.Data.Entity.SqlServer.SqlFunctions.DateDiff("MINUTE", csc.ChangeDate, LastSyncDate) < 0)
                                                 .ToList();

            foreach (ClientScreenContent cscitem in Listcsc)
            {
                SimpleScreenContent ss = new SimpleScreenContent();
                ss.ID       = cscitem.ID;
                ss.ScreenID = cscitem.ClientScreens.ID;
                ss.Name     = cscitem.Name;
                ss.SCType   = cscitem.Type;

                if ((cscitem.ImageReference != "") && (File.Exists(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cscitem.ImageReference) == false))
                {
                    int    StartIndex       = cscitem.ImageReference.IndexOf("_") + 1;
                    int    CopyLenght       = cscitem.ImageReference.Length - (StartIndex);
                    string OriginalFilename = cscitem.ImageReference.Substring(StartIndex, CopyLenght);
                    File.Copy(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + OriginalFilename, CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cscitem.ImageReference);
                }

                ss.Contents = Convert.ToBase64String(File.ReadAllBytes(CreatorAPI.Properties.Settings.Default.ServerPath + "\\" + cscitem.ImageReference));
                ss.Updated  = ((DateTime)cscitem.ChangeDate).ToString("yyyy-MM-dd HH:mm:ss");

                ListOfScreenContent.Add(ss);
            }

            return(ListOfScreenContent);
        }
示例#19
0
        public string PostAddCandidate([FromHeader] string Firstname, [FromHeader] string Surname, [FromHeader] string Idnumber, [FromHeader] string CompanyName, [FromHeader] string IDVerification, [FromHeader] string CrimCheck)
        {
            string result = "";

            try
            {
                CreatorEntities creatordb = new CreatorEntities();

                VALINFOEntities valinfodb = new VALINFOEntities();
                string          username  = User.Identity.GetUserName().ToString();
                Client          client    = valinfodb.Clients.Single(x => x.CompanyName == CompanyName);
                Candidate       candidate = valinfodb.Candidates.Where(x => x.IDNumber == Idnumber && x.ClientID == client.ClientID && x.AppUserID == username).SingleOrDefault();
                if (candidate == null)
                {
                    candidate.Firstname = Firstname;
                    candidate.Surname   = Surname;
                    candidate.IDNumber  = Idnumber;
                    candidate.Cellphone = "0760619183";
                    candidate.ClientID  = client.ClientID;
                    candidate.AppUserID = User.Identity.GetUserName();
                    valinfodb.Candidates.Add(candidate);
                    valinfodb.SaveChanges();
                }

                var localRequest = new MieRequest()
                {
                    CandidateID = candidate.CandidateID,
                    ClientID    = candidate.ClientID,
                    Date        = DateTime.Now,
                    RequestType = 0,
                    UserID      = "433a858b-3b33-4c65-92df-b8eea190ecf9"
                };
                valinfodb.MieRequests.Add(localRequest);
                valinfodb.SaveChanges();
                if (candidate != null && Convert.ToBoolean(IDVerification))
                {
                    ItemTypeViewModel itemTypeViewModel = new ItemTypeViewModel();
                    itemTypeViewModel.Code     = "IDALG";
                    itemTypeViewModel.Name     = "MIE ID Validation";
                    itemTypeViewModel.IsActive = true;

                    List <ItemTypeViewModel> itemTypeViewModelList = new List <ItemTypeViewModel>();
                    itemTypeViewModelList.Add(itemTypeViewModel);
                    var items = new List <ItemType>();
                    items = Services.ItemTypes.Join(itemTypeViewModelList, x => x.Code, i => i.Code, (x, i) => x).Distinct().ToList();
                    var requestModel = new MieRequestModel();
                    requestModel.Request = new Models.Request()
                    {
                        ClientKey             = Services.Client.Key,
                        AgentKey              = Services.Agent.Key,
                        AgentClient           = Services.Agent.ClientKey,
                        FirstNames            = candidate.Firstname,
                        Surname               = candidate.Surname,
                        KnownAs               = candidate.Firstname,
                        IdNumber              = !string.IsNullOrWhiteSpace(candidate.IDNumber) ? candidate.IDNumber : "",
                        Passport              = !string.IsNullOrWhiteSpace(candidate.Passport) ? candidate.Passport : "",
                        DateOfBirth           = candidate.BirthDate.HasValue ? candidate.BirthDate.Value.ToString("s") : IdNumberToDateOfBirth(candidate.IDNumber),
                        Source                = Constants.MieRequestSource,
                        RemoteCaptureDate     = DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK"),
                        RemoteSendDate        = DateTime.Now.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK"),
                        ContactNumber         = "",
                        RemoteRequest         = localRequest.RequestID.ToString(),
                        PrerequisiteGroupList = new PrerequisiteGroupList(),
                        ItemList              = new ItemList()
                        {
                            Item = new List <MieItem>()
                        }
                    };
                    foreach (var item in items.Select((value, i) => new { i, value }))
                    {
                        var requestItem = new MieRequestItem
                        {
                            IsPackageItem = false,
                            Amount        = GetProductAmount(item.value.Code, client.Category, client.ClientID, null),
                            ClientID      = candidate.ClientID,
                            ItemCode      = item.value.Code,
                            RequestID     = localRequest.RequestID
                        };
                        valinfodb.MieRequestItems.Add(requestItem);
                        valinfodb.SaveChanges();

                        requestModel.Request.ItemList.Item.Add(new MieItem
                        {
                            RemoteItemKey = requestItem.RequestItemID.ToString(),
                            ItemTypeCode  = item.value.Code,
                            Indemnity     = (!string.IsNullOrEmpty(item.value.IndemnityType) && !item.value.IndemnityType.Equals("none", StringComparison.InvariantCultureIgnoreCase)) ? "true" : "false",

                            // Handle Input groups and attributes
                            ItemInputGroupList = GetInputGroupList(item.value, itemTypeViewModelList)
                        });
                    }
                    try
                    {
                        // Post request
                        var data = Services.PutRequest(requestModel);

                        // Create user action
                        if (data != null && data.Status != null && data.Status.Code == "0")
                        {
                            if (data.Request != null)
                            {
                                localRequest.Status       = (int)MieRequestStatus.NoResult; // No results returned yet.
                                localRequest.MieRequestID = Convert.ToInt64(data.Request.RequestKey);
                                valinfodb.SaveChanges();
                            }


                            candidate.VettingStatus = 1;

                            candidate.DateModified = DateTime.UtcNow.AddHours(2);

                            valinfodb.SaveChanges();
                        }
                        else
                        {
                            var itemsToDelete = valinfodb.MieRequestItems.Where(x => x.RequestID == localRequest.RequestID);
                            valinfodb.MieRequestItems.RemoveRange(itemsToDelete);
                            valinfodb.MieRequests.Remove(localRequest);
                            valinfodb.SaveChanges();
                            return(data.Status.Description);
                        }
                    }
                    catch (Exception ex)
                    {
                        var itemsToDelete = valinfodb.MieRequestItems.Where(x => x.RequestID == localRequest.RequestID);
                        valinfodb.MieRequestItems.RemoveRange(itemsToDelete);
                        valinfodb.MieRequests.Remove(localRequest);
                        valinfodb.SaveChanges();
                        return("Request failed, please try again.");
                    }
                }
                if (candidate != null && Convert.ToBoolean(CrimCheck))
                {
                }
                result = "success";
            }
            catch (Exception ex)
            {
                result = "Error: " + ex.Message;
            }
            return(result);
        }
示例#20
0
        public ProcessingResult PostRx([FromHeader] string TakenAssessment)
        {
            ProcessingResult RxAssessments = new ProcessingResult();

            try
            {
                JObject JSON = JObject.Parse(TakenAssessment);

                string TakenBy   = JSON["TakenBy"].ToString();
                string TakenAt   = JSON["TakenAt"].ToString();
                string Question1 = JSON["Question1"].ToString();
                string Question2 = JSON["Question2"].ToString();
                string Question3 = JSON["Question3"].ToString();
                string Question4 = JSON["Question4"].ToString();
                string Question5 = JSON["Question5"].ToString();
                string Question6 = JSON["Question6"].ToString();
                string Question7 = JSON["Question7"].ToString();

                CreatorEntities   db = new CreatorEntities();
                MobileConnections mobileconnection = db.MobileConnections.Single(mc => mc.UUID == TakenBy);

                //Question 1
                Assessments NAQ1 = new Assessments();
                NAQ1.MobileConnections = mobileconnection;
                NAQ1.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ1.Question          = 1;
                NAQ1.Answer            = Convert.ToInt16(Question1);

                db.Assessments.Add(NAQ1);

                ////Question 2
                Assessments NAQ2 = new Assessments();
                NAQ2.MobileConnections = mobileconnection;
                NAQ2.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ2.Question          = 2;
                NAQ2.Answer            = Convert.ToInt16(Question2);

                db.Assessments.Add(NAQ2);

                ////Question 3
                Assessments NAQ3 = new Assessments();
                NAQ3.MobileConnections = mobileconnection;
                NAQ3.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ3.Question          = 3;
                NAQ3.Answer            = Convert.ToInt16(Question3);

                db.Assessments.Add(NAQ3);

                ////Question 4
                Assessments NAQ4 = new Assessments();
                NAQ4.MobileConnections = mobileconnection;
                NAQ4.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ4.Question          = 4;
                NAQ4.Answer            = Convert.ToInt16(Question4);

                db.Assessments.Add(NAQ4);

                ////Question 5
                Assessments NAQ5 = new Assessments();
                NAQ5.MobileConnections = mobileconnection;
                NAQ5.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ5.Question          = 5;
                NAQ5.Answer            = Convert.ToInt16(Question5);

                db.Assessments.Add(NAQ5);

                ////Question 6
                Assessments NAQ6 = new Assessments();
                NAQ6.MobileConnections = mobileconnection;
                NAQ6.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ6.Question          = 6;
                NAQ6.Answer            = Convert.ToInt16(Question6);

                db.Assessments.Add(NAQ6);

                ////Question 7
                Assessments NAQ7 = new Assessments();
                NAQ7.MobileConnections = mobileconnection;
                NAQ7.AssessmentDate    = DateTime.Parse(TakenAt);
                NAQ7.Question          = 7;
                NAQ7.Answer            = Convert.ToInt16(Question7);

                db.Assessments.Add(NAQ7);

                db.SaveChanges();

                RxAssessments.Message = "Sucessfully Saved";
                RxAssessments.Status  = "Assessments";
            }
            catch (Exception ex)
            {
                RxAssessments.Message = ex.Message;
                RxAssessments.Status  = "Assessments";
            }

            return(RxAssessments);
        }
示例#21
0
        public IEnumerable <ActiveSubList> PostCleanup([FromHeader] string AppCode, [FromHeader] string CompanyCode)
        {
            //Legacy
            string CurrentSubMenuList     = "";
            string CurrentSubMenuMenuList = "";
            string CurrentSubSubMenuList  = "";
            string UpperCaseCC            = CompanyCode.Trim().ToUpper();

            CreatorEntities      db          = new CreatorEntities();
            List <ActiveSubList> CleanupList = new List <ActiveSubList>();

            //SubMenus
            List <ClientSubMenus> Listcsm = db.ClientSubMenus.Where(c => c.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                                            .Where(ca => ca.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                                            .ToList();

            foreach (ClientSubMenus csm in Listcsm)
            {
                CurrentSubMenuList = CurrentSubMenuList + csm.ID + ",";
            }

            if (Listcsm.Count > 0)
            {
                CurrentSubMenuList = "(" + CurrentSubMenuList.Substring(0, CurrentSubMenuList.Length - 1) + ")";
            }

            //SubMenuMenus
            List <ClientSubMenuMenus> Listcsmm = db.ClientSubMenuMenus.Where(c => c.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                                                 .Where(ca => ca.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                                                 .ToList();

            foreach (ClientSubMenuMenus csmm in Listcsmm)
            {
                CurrentSubMenuMenuList = CurrentSubMenuMenuList + csmm.ID + ",";
            }

            if (Listcsmm.Count > 0)
            {
                CurrentSubMenuMenuList = "(" + CurrentSubMenuMenuList.Substring(0, CurrentSubMenuMenuList.Length - 1) + ")";
            }

            //SubSubMenus
            List <ClientSubSubMenus> Listcssm = db.ClientSubSubMenus.Where(c => c.ClientSubMenuMenus.ClientMenus.ClientApps.Clients.Code == UpperCaseCC)
                                                .Where(ca => ca.ClientSubMenuMenus.ClientMenus.ClientApps.Apps.AppCode == AppCode)
                                                .ToList();

            foreach (ClientSubSubMenus cssm in Listcssm)
            {
                CurrentSubSubMenuList = CurrentSubSubMenuList + cssm.ID + ",";
            }

            if (Listcssm.Count > 0)
            {
                CurrentSubSubMenuList = "(" + CurrentSubSubMenuList.Substring(0, CurrentSubSubMenuList.Length - 1) + ")";
            }

            ActiveSubList list = new ActiveSubList();

            list.SubMenus     = CurrentSubMenuList;
            list.SubMenuMenus = CurrentSubMenuMenuList;
            list.SubSubMenus  = CurrentSubSubMenuList;

            CleanupList.Add(list);

            return(CleanupList);
        }