Exemple #1
0
        public void TestValidAMCNumber_Except()
        {
            AMC amc = new AMC();

            amc.amcNumber = null;
            Assert.IsFalse(amc.ValivateAMC());
        }
        public IList <AMC> Get()
        {
            try
            {
                Logger.LogInfo("Get: AMC process start");
                IList <AMC> lstAMC = new List <AMC>();

                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    AMC AMC = convertToAMCObject(dr);
                    lstAMC.Add(AMC);
                }
                Logger.LogInfo("Get: AMC process completed.");
                return(lstAMC);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }
Exemple #3
0
        public void TestValidAMCNumber_Normal()
        {
            AMC amc = new AMC();

            amc.amcNumber = "123456";
            Assert.IsTrue(amc.ValivateAMC());
        }
Exemple #4
0
 public static void Entry(IServiceCollection services, IConfiguration configuration)
 {
     services.AddDbContext <NesopsAuthorizeDbContext>(options => options.UseMySql(configuration.GetConnectionString("NesopsAuthorizeDB")));
     services.AddScoped(typeof(DbContext), typeof(NesopsAuthorizeDbContext));
     services.AddScoped(typeof(NesopsUserManager));
     services.AddIdentity <NesopsUser, NesopsRole>()
     .AddEntityFrameworkStores <NesopsAuthorizeDbContext>();
     services.AddHttpContextAccessor();
     services.AddScoped(typeof(SignInManager <NesopsUser>));
     JWTBuilder.BuildJWTService(services);
     AMC.Configure();
     services.AddScoped(typeof(AuthorizeService));
 }
        private AMC convertToAMCObject(DataRow dr)
        {
            AMC AMC = new AMC();

            AMC.Id                = dr.Field <int>("ID");
            AMC.Name              = dr.Field <string>("Name");
            AMC.UpdatedBy         = dr.Field <int>("UpdatedBy");
            AMC.UpdatedOn         = dr.Field <DateTime>("UpdatedOn");
            AMC.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");
            AMC.CreatedBy         = dr.Field <int>("CreatedBy");
            AMC.CreatedOn         = dr.Field <DateTime>("CreatedOn");
            AMC.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");
            return(AMC);
        }
Exemple #6
0
 private void LoadGrid()
 {
     try
     {
         AMC objAMC = new AMC();
         dataGridView1.DataSource       = objAMC.GetData(@"C:\amc.json");
         dataGridView1.Columns[2].Width = 200;
         dataGridView1.Columns[3].Width = 250;
     }
     catch (Exception ex)
     {
         label1.Text      = ex.Message;
         label1.ForeColor = Color.Red;
     }
 }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            AMC.MediaURL = "http://172.23.49.1/axis-cgi/mjpg/video.cgi";

            AMC.MediaType = "mjpeg";

            AMC.MediaUsername = "******";
            AMC.MediaPassword = "******";

            AMC.Play();
            AMC.StretchToFit = true;

            WebRequest request = WebRequest.Create("http://172.23.49.1//axis-cgi/com/ptz.cgi?continuouspantiltmove=-10,-0");

            requesthandling(request);
        }
 public void Delete(AMC AMC)
 {
     try
     {
         DataBase.DBService.ExecuteCommand(string.Format(DELETE_BY_ID, AMC.Id));
         Activity.ActivitiesService.Add(ActivityType.DeleteAMC, EntryStatus.Success,
                                        Source.Server, AMC.UpdatedByUserName, AMC.Name, AMC.MachineName);
     }
     catch (Exception ex)
     {
         StackTrace st = new StackTrace();
         StackFrame sf = st.GetFrame(0);
         MethodBase currentMethodName = sf.GetMethod();
         LogDebug(currentMethodName.Name, ex);
         throw ex;
     }
 }
Exemple #9
0
        public Result Delete(AMC AMC)
        {
            var result = new Result();

            try
            {
                AMCService AMCService = new AMCService();
                AMCService.Delete(AMC);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
Exemple #10
0
        private async void CAM_Controll()
        {
            AMC.MediaUsername = data.ser_cam_id;
            AMC.MediaPassword = data.ser_cam_pw;
            AMC.MediaURL      = data.ser_cam_url;
            await Task.Delay(1000);

            while (true)
            {
                if (!camController.isCamOn)
                {
                    AMC.Play();
                }
                await Task.Run(new Action(imgStatusCam));

                await Task.Delay(6000);
            }
            ;
        }
        public void Update(AMC AMC)
        {
            try
            {
                string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, 0));

                DataBase.DBService.ExecuteCommand(string.Format(UPDATE_QUERY,
                                                                AMC.Name,
                                                                AMC.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), AMC.UpdatedBy,
                                                                AMC.Id));

                Activity.ActivitiesService.Add(ActivityType.UpdateAMC, EntryStatus.Success,
                                               Source.Server, AMC.UpdatedByUserName, AMC.Name, AMC.MachineName);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                throw ex;
            }
        }
Exemple #12
0
        public async Task <bool> AddAMCSAsync(AMC amc)
        {
            bool vResult = false;

            try
            {
                if (_ctx.AMCs.Where(e => e.AMCTitle == amc.AMCTitle).Count() == 0)
                {
                    _ctx.Add(amc);
                    var i = await _ctx.SaveChangesAsync();

                    if (i == 0)
                    {
                        vResult = true;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                throw;
            }
            return(vResult);
        }
Exemple #13
0
 public void TestPush_Normal()
 {
     Assert.AreEqual("Successfully pushed to Marvel.", AMC.Push());
 }
Exemple #14
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("SQLite CodeFrist Approach");

            try
            {
                var newAMC = new AMC()
                {
                    AMCTitle = "Parag Parikh long term equity fund"
                };

                /* To read configuration from json file, add Package: Microsoft.Extensions.Configuration.Json */
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("AppConfig.json", optional: false, reloadOnChange: true);


                var configuration = builder.Build();
                Debug.WriteLine(configuration.GetConnectionString("SqliteDB"));

                /*Using Repository Pattern to Fetch data from DB*/
                var services = new ServiceCollection();

                services.AddDbContext <AMCDBContext>(options => options.UseSqlite(configuration.GetConnectionString("SqliteDB"), options => options.MaxBatchSize(512)));
                services.AddDbContext <AMCDBContext>(options => options.EnableSensitiveDataLogging());

                /*Adding AMC implementation to Dependency Injection*/
                services.AddTransient <Data.Services.IAMCData, Data.Services.AMCData>();

                /*Fetching AMC implementation from DI*/
                var provider = services.BuildServiceProvider();
                var quary    = provider.GetService <Data.Services.IAMCData>();

                /*Write Data from Database*/
                var IsDone = quary.AddAMCSAsync(newAMC);

                /*Read Data from Database*/
                var rec = await quary.GetAMCSAsync();

                foreach (var item in rec)
                {
                    Console.WriteLine($"{item.AMCId}  -  {item.AMCTitle}  -  {item.InDate}");
                }

                /* Direct fetching data from DBContext */
                //var mf_amc = new Data.Services.AMCData();
                //var amc = await mf_amc.GetAMCSAsync();
                //foreach (var item in amc)
                //{
                //    Console.WriteLine(item.AMCName);
                //}

                //using (var db = new AMCDBContext(configuration.GetConnectionString("SqliteDB")))
                //{
                //    var o = await db.AMCs.ToListAsync();

                //    foreach (var item in o)
                //    {
                //        Console.WriteLine($"{item.AMCId}  -  {item.AMCTitle}");
                //    }
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadKey();
        }
Exemple #15
0
        public void TestData_Except()
        {
            AMC amc = new AMC();

            Assert.Throws <System.IO.FileNotFoundException>(() => amc.GetData(@"C:\amc1.json"));
        }
Exemple #16
0
        public void TestData_Normal()
        {
            AMC amc = new AMC();

            Assert.IsNotNull(amc.GetData(@"C:\amc.json"));
        }
Exemple #17
0
 public void TestPull_Normal()
 {
     Assert.AreEqual("Successfully pulled data from CACAO.", AMC.Pull());
 }
Exemple #18
0
 private void BtnStop_Click(object sender, EventArgs e)
 {
     AMC.Stop();
 }
Exemple #19
0
 private void button2_Click(object sender, EventArgs e)
 {
     label1.Text      = AMC.Push();
     label1.ForeColor = Color.Yellow;
 }
Exemple #20
0
 private void button4_Click(object sender, EventArgs e)
 {
     label1.Text      = AMC.Pull();
     label1.ForeColor = Color.Green;
 }