Beispiel #1
0
        public void UpdateDeviceInformation(CheckModel model)
        {
            string sql  = "update public.\"Device\" set \"CpuId\" =@cpuId , \"DiskSeriNo\"=@diskSeriNo,\"MacAddress\"=@macAddress where \"Id\"=@id";
            object data = new { id = model.deviceId, macAddress = model.macAddress, diskSeriNo = model.diskVolume, cpuId = model.cpuId };

            _connection.Execute(sql, data);
        }
        public IActionResult ResetToken([FromBody] CheckModel checkModel, int devicePlanId)
        {
            DpOperations db     = new DpOperations();
            var          device = db.Device.GetApiAccessAndSecretKeyDevice(checkModel.apiAccessKey, checkModel.apiSecretKey);

            if (device != null)
            {
                var job = db.DevicePlan.GetDevicePlanById(device.OrganizationId, devicePlanId);


                var planData = db.Plan.GetPlanById(device.OrganizationId, job.PlanId);

                if (planData.Type == Database.Enum.PlanType.GoogleDrive)
                {
                    TokenResponse trp = ResetGoogleDriveToken(planData, job.PlanId, db, device.OrganizationId);
                    return(Ok(trp));
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(Unauthorized());
            }
        }
Beispiel #3
0
        }// end of function

        public CheckModel SaveToSecondaryTable(CheckModel _check)
        {
            string sql = "INSERT INTO captive_database.isla_temptable (BRSTN,AccountNumber,CheckType,ChequeTypeName,Name1,Name2,Quantity,BranchName,StartingSerial,EndingSerial,Address1,Address2,Address3,Address4,Address5,Address6)VALUES(" +
                         "'" + _check.BRSTN + "'," +
                         "'" + _check.AccountNo + "'," +
                         "'" + _check.ChkType + "'," +
                         "'" + _check.ChkTypeName + "'," +
                         "'" + _check.Name1 + "'," +
                         "'" + _check.Name2 + "'," +
                         "'" + _check.Qty + "', " +
                         "'" + _check.BranchName + "'," +
                         "'" + _check.StartSeries + "'," +
                         "'" + _check.EndSeries + "'," +
                         "'" + _check.Address1 + "'," +
                         "'" + _check.Address2 + "'," +
                         "'" + _check.Address3 + "'," +
                         "'" + _check.Address4 + "'," +
                         "'" + _check.Address5 + "'," +
                         "'" + _check.Address6 + "')";


            DBConnect();
            MySqlCommand myCommand = new MySqlCommand(sql, myConnect);

            myCommand.ExecuteNonQuery();
            DBClosed();
            return(_check);
        }// end of function
Beispiel #4
0
        public void FUI_model_value_Should_change_with_Control_value()
        {
            //arrange
            var check = new CheckModel();

            check.Id = "test1";

            txtBox.TextBindTo <CheckModel>(m => m.Id);

            //act
            txtBox.Load <CheckModel>(check);

            //assert
            txtBox.Text.Should()
            .Be.EqualTo("test1");

            //arrange
            txtBox.Text = "test2";

            //act
            check.Get <CheckModel>();

            //arrange
            check.Id
            .Should()
            .Be
            .EqualTo("test2");
        }
Beispiel #5
0
        public void Should_can_get_Controller_method_from_current_Assembly()
        {
            //act
            var asm = Assembly.GetExecutingAssembly();

            var types = from t in asm.GetTypes()
                        where t.IsClass &&
                        t.IsPublic &&
                        t.Name.ToUpper().Contains("MAINCONTROLLER")
                        select t;

            object classInstance = Activator.CreateInstance(types.ElementAt(0), null);

            var method = types.ElementAt(0).GetMethod("Test1", new Type[] { typeof(string), typeof(int) });

            object[]   parametersArray = new object[] { "123", 11 };
            object[]   retvalues       = (object[])method.Invoke(classInstance, parametersArray);
            CheckModel check           = null;

            if (retvalues[0].GetType() == typeof(CheckModel))
            {
                check = (CheckModel)retvalues[0];
            }
            //assert
            check.Id.Should()
            .Be.EqualTo("123");
        }
        public ActionResult DetailCheck(long ma, int id)
        {
            CheckModel model = new CheckModel();

            model = new CheckDao().detail(ma, id);
            if (!model.CO.HasValue)
            {
                model.CO = false;
            }
            if (!model.CQ.HasValue)
            {
                model.CO = false;
            }
            if (!model.MTR.HasValue)
            {
                model.MTR = false;
            }
            if (!model.SN.HasValue)
            {
                model.SN = false;
            }
            if (!model.PN.HasValue)
            {
                model.PN = false;
            }
            if (!model.Other.HasValue)
            {
                model.Other = false;
            }
            if (!model.Result.HasValue)
            {
                model.Result = false;
            }
            return(PartialView("_DetailApproval", model));
        }
Beispiel #7
0
        public void FUI_Should_get_sum_amount_of_checks()
        {
            //arrange
            var checklist = new List <CheckModel>();
            var check1    = new CheckModel();
            var check2    = new CheckModel();

            check1.Amount = check2.Amount = 888;

            checklist.Add(check1);
            checklist.Add(check2);

            txtBox.TextFor <List <CheckModel> >(m =>
            {
                decimal amount = 0;
                int count      = 0;
                foreach (var c in m)
                {
                    amount += c.Amount;
                    count++;
                }
                return(string.Format("{0:C2}[{1}]", amount, count));
            });

            //act
            txtBox.Load <List <CheckModel> >(checklist);

            //assert
            txtBox.Text.Substring(0, 6)
            .Should()
            .Be
            .EqualTo("$1,776");
        }
Beispiel #8
0
        public async Task <CheckModel> CheckNumbersAsync(string numbers)
        {
            Draw lastDraw = await Task.Run(() => _drawRepository.GetAll().OrderBy(d => d.Date).LastOrDefault());

            IEnumerable <Winner> winners = await Task.Run(() => _winnerRepository.GetAll().Where(w => w.SessionId == lastDraw.SessionId));

            if (winners != null)
            {
                IEnumerable <Ticket> tickets = await WinningTicketsASync(winners);

                if (tickets != null)
                {
                    Ticket check = await Task.Run(() => tickets.FirstOrDefault(t => t.Numbers == numbers));

                    if (check != null)
                    {
                        CheckModel result = await CheckThePrizeAsync(check);

                        return(result);
                    }
                }
            }

            return(null);
        }
Beispiel #9
0
        public async Task <IHttpActionResult> GetNew()
        {
            var hubContext  = GlobalHost.ConnectionManager.GetHubContext <MailHub>();
            var currentUser = User.Identity.Name;

            if (currentUser == null)
            {
                return(BadRequest());
            }
            List <Mail> newMessages;

            var timeOfRequest = DateTime.Now;

            var lastUpdate = _check.FindLastCheck(currentUser).Result;

            if (lastUpdate == null)
            {
                var check = new CheckModel {
                    UserName = currentUser, DateOfLastCheck = timeOfRequest
                };
                await _check.CreateAsync(check);

                newMessages = _mail.FindNewEmail(currentUser, timeOfRequest);
            }
            else
            {
                newMessages = _mail.FindNewEmail(currentUser, lastUpdate.DateOfLastCheck);
                lastUpdate.DateOfLastCheck = timeOfRequest;
                await _check.UpdateAsync(lastUpdate);
            }

            hubContext.Clients.Group(currentUser).onMessage(newMessages);

            return(Ok());
        }
Beispiel #10
0
        public bool Save(CheckModel model)
        {
            try
            {
                tbl_List_Check tbl = new tbl_List_Check();

                tbl.RequestId = model.RequestId;
                tbl.Ma_NCC    = model.Ma_NCC;
                tbl.Ma_TB     = model.Ma_TB;
                tbl.YC_KT     = model.YC_KT;
                tbl.TT_KT     = model.TT_KT;
                tbl.YC_SL     = model.YC_SL;
                tbl.TT_SL     = model.TT_SL;
                tbl.DonVi     = model.DonVi;
                tbl.User_Nhap = model.User_Nhap;
                tbl.Date_Nhap = DateTime.Now;
                db.tbl_List_Check.Add(tbl);
                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #11
0
            public static void SetCheckResult(CheckModel checkModel)
            {
                try
                {
                    XmlDocument xml = new XmlDocument();

                    if (IsFileReady(checkModel.CheckFilePath))
                    {
                        xml.Load(checkModel.CheckFilePath);
                        XmlNode xmlPortalRun = xml.SelectSingleNode("/GroupChecks/Checks/Check[CheckDescription ='" + checkModel.CheckDescription + "']/CoveredCount");
                        if (checkModel.IsDoneCheckBox)
                        {
                            xmlPortalRun = xml.SelectSingleNode("/GroupChecks/Checks/Check[CheckDescription ='" + checkModel.CheckDescription + "']/CoveredCount");
                        }
                        else
                        {
                            xmlPortalRun = xml.SelectSingleNode("/GroupChecks/Checks/Check[CheckDescription ='" + checkModel.CheckDescription + "']/NotRelevantCount");
                        }

                        if (xmlPortalRun != null)
                        {
                            xmlPortalRun.InnerText = (int.Parse(xmlPortalRun.InnerText) + 1).ToString();
                        }
                        xml.Save(checkModel.CheckFilePath);
                    }
                }
                catch (Exception e)
                {
                    Log.Write("Error was catched in XmlManagerController.SetCheckResult(): " + e);
                    MessageBox.Show("Something went wrong, take a look at the log!");
                    Application.Current.Shutdown();
                }
            }
Beispiel #12
0
        public void Edit(string oldname, string newname, string seats, string rows, int price, string session)
        {
            checks.Clear();
            string[] arStr = File.ReadAllLines(FileWorker.pathToChecks);
            using (FileStream fs = new FileStream(FileWorker.pathToChecks, FileMode.Open))
            {
                using (StreamReader r = new StreamReader(fs, Encoding.Default))
                {
                    for (int i = 0; i < arStr.Length; i++)
                    {
                        var film = JsonConvert.DeserializeObject <CheckModel>(arStr[i]);
                        if (film == null)
                        {
                            continue;
                        }
                        else
                        {
                            if (oldname == film.Name)
                            {
                                CheckModel newfilm = new CheckModel()
                                {
                                    Name = newname, Seats = seats, Rows = rows, Session = session, Price = price
                                };
                                checks.Add(JsonConvert.SerializeObject(newfilm));
                                continue;
                            }
                        }
                        checks.Add(JsonConvert.SerializeObject(film));
                    }
                }

                FileWorker.editFromFile(checks, FileWorker.pathToChecks);
            }
        }
Beispiel #13
0
        }// end of function

        public CheckModel SavedDatatoDatabase(CheckModel _check, string _batch)
        {
            string sql = "INSERT INTO captive_database.master_database_islabank_archive(Date,Time,DeliveryDate,ChkType,ChequeName,BRSTN,AccountNo,Name1,Name2,Address1,Address2,Address3,Address4,Address5,Address6,Batch,StartingSerial, EndingSerial)VALUES(" +

                         "'" + DateTime.Now.ToString("yyyy-MM-dd") + "'," +
                         "'" + DateTime.Now.ToString("HH:mm:ss") + "'," +
                         "'" + _check.DeliveryDate.ToString("yyyy-MM-dd") + "'," +
                         "'" + _check.ChkType + "'," +
                         "'" + _check.ChkTypeName + "'," +
                         "'" + _check.BRSTN + "'," +
                         "'" + _check.AccountNo + "'," +
                         "'" + _check.Name1 + "'," +
                         "'" + _check.Name2 + "'," +
                         "'" + _check.BranchName + "'," +
                         "'" + _check.Address2 + "'," +
                         "'" + _check.Address3 + "'," +
                         "'" + _check.Address4 + "'," +
                         "'" + _check.Address5 + "'," +
                         "'" + _check.Address6 + "'," +
                         "'" + _batch + "'," +
                         "'" + _check.StartSeries + "'," +
                         "'" + _check.EndSeries + "')";



            DBConnect();
            MySqlCommand myCommand = new MySqlCommand(sql, myConnect);

            myCommand.ExecuteNonQuery();
            DBClosed();
            return(_check);
        }// end of function
Beispiel #14
0
        public void FUI_Text_Should_be_validate_failed()
        {
            var check = new CheckModel();

            check.Id  = "change tile";
            check.ABA = "Aba";

            txtBox.TextBindTo <CheckModel>(m => m.Id)
            .ToValidate(m =>
                        m.Id.Length <= 5)
            .ToSuccess((c, m) =>
            {
                c.BackColor = Color.Yellow;
            })
            .ToFail((c, m) =>
            {
                c.BackColor = Color.Red;
            });


            txtBox.Load <CheckModel>(check);

            txtBox.Satisfy <TextBox>(c =>
                                     c.Text == check.Id &&
                                     c.BackColor == Color.Red);
        }
        public HttpResponseMessage CheckOnlineDevice([FromBody] CheckModel data)
        {
            DpOperations db     = new DpOperations();
            var          device = db.Device.GetApiAccessAndSecretKeyDevice(data.apiAccessKey, data.apiSecretKey);

            if (device != null)
            {
                if (String.IsNullOrEmpty(device.CpuId) || String.IsNullOrEmpty(device.MacAddress) || String.IsNullOrEmpty(device.DiskSeriNo))
                {
                    data.deviceId = device.Id;
                    db.Device.UpdateDeviceInformation(data);
                    DevicePlanLog lg = new DevicePlanLog()
                    {
                        CreatedDate    = DateTime.Now,
                        Description    = "Cihaz ekleme başarılı bir şekilde gerçekleşmiştir. Cihaz aktif",
                        DeviceId       = device.Id,
                        OrganizationId = device.OrganizationId
                    };
                    db.Log.InsertLog(lg);

                    HangfireProvider.ScheduleRecurringCheckOnline(DateTime.Now, device.Id, "0 */3 * * *", device.OrganizationId);
                    //HangfireProvider.ScheduleRecurringFileList(DateTime.Now, device.Id, "0 */12 * * *", device.OrganizationId);
                    //HangfireProvider.InsertJobOneTimeFileList(DateTime.Now, device.Id, device.OrganizationId);
                    HangfireProvider.InsertJobOneTimeCheckOnline(DateTime.Now, device.Id, device.OrganizationId);
                }
                else
                {
                    if (data.updateData)
                    {
                        data.deviceId = device.Id;
                        db.Device.UpdateDeviceInformation(data);
                        DevicePlanLog lg = new DevicePlanLog()
                        {
                            CreatedDate    = DateTime.Now,
                            Description    = "Cihaz ekleme başarılı bir şekilde gerçekleşmiştir. Cihaz aktif",
                            DeviceId       = device.Id,
                            OrganizationId = device.OrganizationId
                        };
                        db.Log.InsertLog(lg);
                    }
                    else
                    {
                        DevicePlanLog lg = new DevicePlanLog()
                        {
                            CreatedDate    = DateTime.Now,
                            Description    = "Cihaz kontrolü başarılı bir şekilde gerçekleşmiştir. Cihaz aktif",
                            DeviceId       = device.Id,
                            OrganizationId = device.OrganizationId
                        };
                        db.Log.InsertLog(lg);
                    }
                }
                return(new HttpResponseMessage(System.Net.HttpStatusCode.OK));
            }
            else
            {
                return(new HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized));
            }
        }
Beispiel #16
0
        public object[] Test1(string id, int index)
        {
            var check = new CheckModel();

            check.Id = id.ToString();

            return(new object[] { check });
        }
Beispiel #17
0
        public object[] Test(string id, int index)
        {
            var check = new CheckModel();

            check.Id = id.ToString() + "TestController";

            return(new object[] { check });
        }
Beispiel #18
0
        public object[] TestNull(int id, int index)
        {
            var check = new CheckModel();

            check.Id = id.ToString();

            return(null);
        }
Beispiel #19
0
            public static List <CheckModel> GetChecks()
            {
                var checkList = new List <CheckModel>();

                try
                {
                    foreach (var file in Directory.GetFiles(checkListGroupXmlPath))
                    {
                        string      quest = null;
                        XmlDocument xml   = new XmlDocument();
                        xml.Load(file);
                        XmlNode xmlportalRun = xml.SelectSingleNode("/GroupChecks/Question");
                        if (xmlportalRun != null)
                        {
                            quest = xmlportalRun.InnerText;
                        }
                        bool questIn;


                        if ((dictionaryChecks.TryGetValue(quest, out questIn) && questIn) || (file == defaultCheckListXmlPath))
                        {
                            var matchingElements = xml.SelectNodes("/GroupChecks/Checks/Check/CheckDescription");
                            if (matchingElements != null)
                            {
                                foreach (var matchingElement in matchingElements)
                                {
                                    CheckModel check = new CheckModel();
                                    if (matchingElement != null)
                                    {
                                        check.CheckDescription = (matchingElement as XmlNode)?.InnerText;
                                        var nextSibling = (matchingElement as XmlNode)?.NextSibling;
                                        if (nextSibling != null)
                                        {
                                            check.CheckToolTip = nextSibling?.InnerText;
                                        }

                                        if (check.CheckDescription != String.Empty)
                                        {
                                            check.CheckFilePath = file;
                                            checkList.Add(check);
                                        }
                                    }
                                }
                            }
                        }
                        xml.Save(file);
                    }
                }
                catch (Exception e)
                {
                    Log.Write("Error was catched in XmlManagerController.GetChecks(): " + e);
                    MessageBox.Show("Something went wrong, take a look at the log!");
                    Application.Current.Shutdown();
                }
                return(checkList);
            }
Beispiel #20
0
        public ActionResult FilmEdit(int id)
        {
            FilmEditVM filmvm = new FilmEditVM();

            dbcon.Open();
            filmvm.film        = Film.GetFilmSingle(dbcon, id);
            filmvm.FilmCatList = CheckModel.GetCheckModelList(dbcon, id);
            dbcon.Close();
            return(View(filmvm));
        }
 public static CheckResponse ToCheckResponse(this CheckModel checkModel)
 {
     return(new CheckResponse
     {
         FirstName = checkModel.FirstName,
         LastName = checkModel.LastName,
         DateOfBirth = checkModel.DateOfBirth.ToString("dd-MM-yyyy"),
         SSN = checkModel.SSN.ToString(),
         CrimeRecords = checkModel.CrimeRecords
     });
 }
Beispiel #22
0
        public static List <CheckModel> GetChecks()
        {
            var checkList = new List <CheckModel>();

            foreach (var file in Directory.GetFiles(checkListGroupXmlPath).Where(f => f != excelQuestionsXmlPath))
            {
                string      quest = null;
                XmlDocument xml   = new XmlDocument();
                xml.Load(file);
                XmlNode xmlportalRun = xml.SelectSingleNode("/GroupChecks/Question");
                if (xmlportalRun != null)
                {
                    quest = xmlportalRun.InnerText;
                }
                bool questIn;


                if ((dictionaryChecks.TryGetValue(quest, out questIn) && questIn) || (file == defaultCheckListXmlPath))
                {
                    var matchingElements = xml.SelectNodes("/GroupChecks/Checks/Check/CheckDescription");
                    //var excelColumnNumber = xml.SelectNodes("/GroupChecks/Checks/Check/ExcelColumnNumber");
                    if (matchingElements != null)
                    {
                        foreach (var matchingElement in matchingElements)
                        {
                            CheckModel check = new CheckModel();
                            if (matchingElement != null)
                            {
                                check.CheckDescription = (matchingElement as XmlNode)?.InnerText;
                                var nextSibling = (matchingElement as XmlNode)?.NextSibling;
                                if (nextSibling != null)
                                {
                                    check.CheckToolTip = nextSibling?.InnerText;
                                }
                                //var excelColumnNumberSibling = nextSibling?.NextSibling;
                                //if (excelColumnNumberSibling != null)
                                //{
                                //    check.ExcelColumnNumber = (excelColumnNumberSibling?.InnerText != String.Empty) ? int.Parse(excelColumnNumberSibling?.InnerText) : 0;
                                //}


                                if (check.CheckDescription != String.Empty)
                                {
                                    check.CheckFilePath = file;
                                    checkList.Add(check);
                                }
                            }
                        }
                    }
                }
                xml.Save(file);
            }
            return(checkList);
        }
        public CheckModel ProcceedBackgroundCheck(CheckRequest model)
        {
            var checkModel = new CheckModel(model);

            checkModel.SSN = SSN.FromString(model.SSN);

            checkModel.CrimeRecords = model.LastName.EndsWith("Clear")
                ? new List <string>(0)
                : new List <string>(new string[] { "crime reco 1", "crime reco 2", "crime reco 3", "crime reco 4" });
            return(checkModel);
        }
Beispiel #24
0
        public void Add(string Name, string seats, string rows, int price, string session)
        {
            checks.Clear();
            CheckModel check = new CheckModel()
            {
                Name = Name, Seats = seats, Rows = rows, Session = session, Price = price
            };

            checks.Add(JsonConvert.SerializeObject(check));
            FileWorker.saveToFile(checks, FileWorker.pathToChecks);
        }
Beispiel #25
0
        private async Task <CheckModel> CheckThePrizeAsync(Ticket ticket)
        {
            Winner winner = await Task.Run(() => _winnerRepository.GetAll().FirstOrDefault(w => w.TicketId == ticket.TicketId));

            Prize prize = await Task.Run(() => _prizeRepository.GetById(winner.PrizeId));

            CheckModel result = new CheckModel {
                Prize = prize.Name, WinningNumbers = winner.WinningNumbers
            };

            return(result);
        }
Beispiel #26
0
        public async Task <JsonResult> GetAllOrdersForObserver(CheckModel model)
        {
            var results = new List <ValidationResult>();
            var context = new ValidationContext(model);

            if (!Validator.TryValidateObject(model, context, results, true))
            {
                return(Json("Bad data"));
            }

            ApplicationUserDTO checkUser = new ApplicationUserDTO
            {
                Email         = model.Email,
                SecurityStamp = model.SecurityStamp
            };

            try
            {
                ApplicationUserDTO user = await userService.GetUserByEmailAndSecurityStamp(checkUser);

                if (user.Role != "user")
                {
                    return(Json("Only User can get sensors"));
                }
                else
                {
                    try
                    {
                        List <OrderDTO>         orders         = orderService.GetOrdersDelivering().ToList();
                        List <GetDeliveryOrder> deliveryOrders = new List <GetDeliveryOrder>();
                        foreach (var order in orders)
                        {
                            GetDeliveryOrder deliveryOrder = new GetDeliveryOrder
                            {
                                DeliveryAddress = order.DeliveryAddress,
                                DeliveryDate    = order.DeliveryDate.ToString(),
                                Price           = order.Price
                            };
                            deliveryOrders.Add(deliveryOrder);
                        }
                        return(Json(deliveryOrders, JsonRequestBehavior.AllowGet));
                    }
                    catch
                    {
                        return(Json("Bad with get orders"));
                    }
                }
            }
            catch
            {
                return(Json("Email or Token is wrong"));
            }
        }
        private void btnBrowserFile_Click(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new Microsoft.Win32.OpenFileDialog()
            {
                Filter           = "Excel Files|*.xls;*.xlsx",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };
            var result = openFileDialog.ShowDialog();

            if (result == true)
            {
                this.txtFilePath.Text = openFileDialog.FileName;
            }

            dataSource.Clear();
            using (var stream = File.Open(txtFilePath.Text, FileMode.Open, FileAccess.Read))
            {
                using (var reader = ExcelReaderFactory.CreateReader(stream))
                {
                    var dataSet = reader.AsDataSet(new ExcelDataSetConfiguration()
                    {
                        ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                        {
                            UseHeaderRow = true
                        }
                    });

                    DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
                    dtFormat.ShortDatePattern = "yy/MM/dd";
                    foreach (DataTable item in dataSet.Tables)
                    {
                        foreach (DataRow row in item.Rows)
                        {
                            var job = new CheckModel
                            {
                                Name      = row[0].ToString(),
                                Job       = row[1].ToString(),
                                DingId    = row[2].ToString(),
                                CheckDate = Convert.ToInt32(Convert.ToDateTime(row[3].ToString().Substring(0, 8), dtFormat).ToString("yyyyMMdd")),
                                CheckIn   = row[4].ToString().Length > 6 ? ParseTime(row[4].ToString()) : row[4].ToString(),
                                CheckOut  = row[5].ToString().Length > 6 ? ParseTime(row[5].ToString()) : row[5].ToString(),
                            };
                            dataSource.Add(job);
                        }
                    }
                }
            }

            checkList            = dataSource;
            dgResult.ItemsSource = checkList;
        }
Beispiel #28
0
        public void Setup()
        {
            // init and set up mocks
            _checkServiceMock = new Mock <ICheckService>();
            var checkRequest = GetCheckRequest();
            var checkModel   = new CheckModel(checkRequest);

            checkModel.SSN = SSN.FromString(checkRequest.SSN);
            _checkServiceMock
            .Setup(x => x.ProcceedBackgroundCheck(It.IsAny <CheckRequest>()))
            .Returns(checkModel);

            _controller = new CheckController(_checkServiceMock.Object);
        }
        //[Authorize(Roles = "Cashier, Admin")]
        public ActionResult Index(int id)
        {
            var bets     = Unit.PokerBetSrvc.GetGameBet(id);
            var firstBet = bets.First();

            var    margin  = "";
            double sum     = 0;
            var    eachSum = (firstBet.Sum / bets.Count()).ToString();

            for (int i = 0; i < bets.Length; i++)
            {
                sum += (firstBet.Sum / bets.Count()) * bets[i].Index;
                if (i != bets.Length - 1)
                {
                    margin += eachSum + " x " + bets[i].Index + " + ";
                }
                else
                {
                    margin += eachSum + " x " + bets[i].Index + " = " + sum;
                }
            }

            var games = new GameBet[bets.Count()];

            for (int i = 0; i < games.Count(); i++)
            {
                games[i] = new GameBet()
                {
                    Index       = bets[i].Index,
                    Winner      = bets[i].Winner,
                    TableNumber = bets[i].TableNumber,
                    TableCode   = bets[i].TableCode,
                    Event       = bets[i].Event,
                    StartDate   = bets[i].StartDate
                };
            }

            var model = new CheckModel()
            {
                ContractNumber = "978" + firstBet.ContractNumber,
                CurrentDate    = DateTime.Now,
                Games          = games,
                Margin         = margin,
                ContractSum    = firstBet.Sum,
            };


            return(View(model));
        }
Beispiel #30
0
        public void FUI_Add_image_to_picturebox()
        {
            var check = new CheckModel();

            check.FrontImage = Image.FromFile("ImageData\\image_front.jpg");

            picBox.ImageBindTo <CheckModel>(m => m.FrontImage);

            picBox.Load <CheckModel>(check);

            picBox.Image
            .Should()
            .Be
            .InstanceOf <Image>();
        }