public override async Task <DanhMucHangMucDto> Get(EntityDto <int> input)
        {
            var query = await(from HangMuc in _danhMucHangMucRepository.GetAll().Where(w => w.Id == input.Id)

                              join DichVu in _danhMucDichVuRepository.GetAll() on HangMuc.DichVuId equals DichVu.Id into J1
                              from DichVu in J1.DefaultIfEmpty()

                              join NhomDichVu in _danhMucNhomDichVuRepository.GetAll() on DichVu.NhomDichVuId equals NhomDichVu.Id into J2
                              from NhomDichVu in J2.DefaultIfEmpty()

                              select new
            {
                HangMuc,
                NhomDichVuId = NhomDichVu != null ? NhomDichVu.Id : 0
            }).FirstOrDefaultAsync();

            if (query == null)
            {
                throw new UserFriendlyException("Không tìm thấy Hạng Mục!");
            }

            var GetHangMuc = ObjectMapper.Map <DanhMucHangMucDto>(query.HangMuc);

            if (query.NhomDichVuId > 0)
            {
                GetHangMuc.NhomDichVuId = query.NhomDichVuId;
            }

            return(GetHangMuc);
        }
示例#2
0
        public override void Remove()
        {
            if (!IsRemovable)
            {
                return;
            }
            MicroWorld.Logics.CircuitManager.Wires.Remove(this);
            J1.ConnectedWires.Remove(this);
            J2.ConnectedWires.Remove(this);

            if (J1.ConnectedWires.Count == 0 && J1.ContainingComponents.Count == 0)
            {
                J1.Remove();
            }
            else
            {
                J1.SetComponentOnVisibilityMap();
            }
            if (J2.ConnectedWires.Count == 0 && J2.ContainingComponents.Count == 0)
            {
                J2.Remove();
            }
            else
            {
                J2.SetComponentOnVisibilityMap();
            }

            base.Remove();
        }
示例#3
0
        private void resetForm()
        {
            for (int i = 0; i < jednorozce.Length; i++)
            {
                jednorozce[i].UstawX(5);
            }

            pictureBoxJednorozec1.Location = new Point(J1.PodajX(), 5);
            pictureBoxJednorozec2.Location = new Point(J2.PodajX(), 105);
            pictureBoxJednorozec3.Location = new Point(J3.PodajX(), 205);
            pictureBoxJednorozec4.Location = new Point(J4.PodajX(), 305);

            buttonPodpiszZaklad.Enabled = true;
            buttonStart.Enabled         = true;
            buttonZasady.Enabled        = true;

            for (int i = 0; i < zaklady.Length; i++)
            {
                zaklady[i].ResetujZaglosowanie();
            }

            pula.ResetujPule();
            labelPula.Text = Convert.ToString(pula.StanPuli());

            labelZbychuZaklad.Text   = "Czekam na zakład Zbycha...";
            labelHelgaZaklad.Text    = "Czekam na zakład Helgi...";
            labelEustachyZaklad.Text = "Czekam na zaklad Eustachego...";

            label1.Text = "ma aktualnie " + gracze[comboBoxGracz.SelectedIndex].KasaGracza() + " PLN";
        }
示例#4
0
文件: Button.cs 项目: DiegoCach/UFR
    IEnumerator Restart()
    {
        yield return(new WaitForSeconds(3f));

        GameManager.init.restart();
        J1.SetActive(false);
        J2.SetActive(false);
    }
示例#5
0
        //Só passar para o próxima página se usuários estiverem cadastrados

        private void button_Play_Click(object sender, EventArgs e)
        {
            string J1, J2;
            bool   jogador1teste = false, jogador2teste = false;

            J1 = textBox_Jogador1.Text;
            J2 = textBox_Jogador2.Text;
            if (File.Exists("ficha.txt"))
            {
                Stream       leitura   = File.Open("ficha.txt", FileMode.Open);
                StreamReader e2        = new StreamReader(leitura);
                string[]     verificar = new string[2];
                while (e2.Peek() >= 0)
                {
                    verificar = e2.ReadLine().Split(':');
                    if (verificar[0].ToUpper() == J1.ToUpper())
                    {
                        Jogador1             = new Player(J1);
                        Jogador1.GetVitorias = Convert.ToInt32(verificar[1]);  //Atualiza vitorias do jogador
                        jogador1teste        = true;
                    }
                    else if (verificar[0].ToUpper() == J2.ToUpper())
                    {
                        Jogador2             = new Player(J2);
                        Jogador2.GetVitorias = Convert.ToInt32(verificar[1]); //Atualiza vitorias do jogador
                        jogador2teste        = true;
                    }
                }
                e2.Close();
                if (jogador1teste == true && jogador2teste == true)
                {
                    this.Hide();
                    Form novo = new Form_Selecao(Jogador1, Jogador2);
                    novo.FormClosed += (s, args) => this.Close();
                    novo.Show();
                }
                else if (jogador1teste == false && jogador2teste == false)
                {
                    MessageBox.Show("jogadores não cadastrado, cadastre um novo jogador.", "Jogadores sem cadastro",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (jogador1teste == false)
                {
                    MessageBox.Show("Jogador 1 não cadastrado, cadastre o jogador 1.", "Jogador sem cadastro",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else if (jogador2teste == false)
                {
                    MessageBox.Show("Jogador 2 não cadastrado, cadastre o jogador 2.", "Jogador sem cadastro",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Nenhum jogador cadastrado.", "Jogadores sem cadastro",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        public override async Task <PagedResultDto <CongViecDto> > GetAll(GetAllCongViecInput input)
        {
            input.Keyword = GlobalFunction.RegexFormat(input.Keyword);

            var query = from CongViec in _congViecRepository.GetAll()
                        .WhereIf(!string.IsNullOrEmpty(input.Keyword), w => w.KhachHangName.Contains(input.Keyword) || w.SoDienThoai.Contains(input.Keyword))
                        .WhereIf(input.TramDichVuId.HasValue, w => w.TramDichVuId == input.TramDichVuId || (input.TramDichVuId == 0 && w.TramDichVuId == null))
                        .WhereIf(input.TrangThaiId.HasValue, w => w.TrangThaiId == input.TrangThaiId)
                        join DichVu in _dichVuRepository.GetAll() on CongViec.DichVuId equals DichVu.Id into J1
                        from DichVu in J1.DefaultIfEmpty()

                        join TramDichVu in _tramDichVuRepository.GetAll() on CongViec.TramDichVuId equals TramDichVu.Id into J5
                        from TramDichVu in J5.DefaultIfEmpty()

                        join NhanVien in _nhanVienRepository.GetAll() on CongViec.NhanVienId equals NhanVien.Id into J2
                        from NhanVien in J2.DefaultIfEmpty()

                        join TinhThanh in _tinhThanhRepository.GetAll() on CongViec.DiaChiTinhThanhId equals TinhThanh.Id into J3
                        from TinhThanh in J3.DefaultIfEmpty()

                        join QuanHuyen in _quanHuyenRepository.GetAll() on CongViec.DiaChiQuanHuyenId equals QuanHuyen.Id into J4
                        from QuanHuyen in J4.DefaultIfEmpty()

                        select new
            {
                CongViec,
                DichVuName     = DichVu.Name,
                TramDichVuName = TramDichVu.Name,
                NhanVienName   = NhanVien.Name,
                TinhThanhName  = TinhThanh.Name,
                QuanHuyenName  = QuanHuyen.Name
            };
            var TotalCount = await query.CountAsync();

            var PagedCongViec = await query.OrderBy(o => o.CongViec.NgayGioHen).PageBy(input).ToListAsync();

            var CongViecs = new List <CongViecDto>();

            foreach (var item in PagedCongViec)
            {
                var CongViec = ObjectMapper.Map <CongViecDto>(item.CongViec);
                CongViec.DichVuName     = item.DichVuName;
                CongViec.TramDichVuName = item.TramDichVuName;
                CongViec.NhanVienName   = item.NhanVienName;
                CongViec.DiaChi        += string.IsNullOrWhiteSpace(item.QuanHuyenName) ? "" : ", " + item.QuanHuyenName;
                CongViec.DiaChi        += string.IsNullOrWhiteSpace(item.TinhThanhName) ? "" : ", " + item.TinhThanhName;
                CongViec.TrangThaiName  = item.CongViec.TrangThaiId >= 0 && GlobalModel.TrangThaiCongViec.ContainsKey((int)item.CongViec.TrangThaiId) ? GlobalModel.TrangThaiCongViec[(int)item.CongViec.TrangThaiId] : "";

                CongViecs.Add(CongViec);
            }

            return(new PagedResultDto <CongViecDto>
            {
                TotalCount = TotalCount,
                Items = CongViecs
            });
        }
示例#7
0
        public SIVB(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass = 106371) // Apollo 8
        // public SIVB(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass = 106830) // Apollo 11
            : base(craftDirectory, position, velocity, 0, propellantMass, "Saturn/SIVB.png")
        {
            StageOffset = new DVector2(0, 3.5);

            Engines = new IEngine[1];
            var offset = new DVector2(0.0, Height * 0.8);
            Engines[0] = new J2(0, this, offset);
        }
示例#8
0
 void drawArms()
 {
     J1.Set(0, -a * Mathf.Sin(theta1 * rad), a * Mathf.Cos(theta1 * rad));
     J1 += D1;
     addLine(D1, J1, arms);
     J2.Set(a * Mathf.Cos(theta2 * rad) * Mathf.Sin(60f * rad), -a * Mathf.Sin(theta2 * rad), -a * Mathf.Cos(60f * rad) * Mathf.Cos(theta2 * rad));
     J2 += D2;
     addLine(D2, J2, arms);
     J3.Set(-a * Mathf.Cos(theta3 * rad) * Mathf.Sin(60f * rad), -a * Mathf.Sin(theta3 * rad), -a * Mathf.Cos(60f * rad) * Mathf.Cos(theta3 * rad));
     J3 += D3;
     addLine(D3, J3, arms);
 }
示例#9
0
        public override void SetComponentOnVisibilityMap()
        {
            if (!Graphics.Visible)
            {
                return;
            }
            var g = Graphics as Graphics.WireGraphics;

            for (int i = 0; i < g.DrawPath.Count - 1; i++)
            {
                ComponentsManager.VisibilityMap.SetLine(this, g.DrawPath[i].X, g.DrawPath[i].Y, g.DrawPath[i + 1].X, g.DrawPath[i + 1].Y);
            }
            J1.SetComponentOnVisibilityMap();
            J2.SetComponentOnVisibilityMap();
        }
示例#10
0
        public SII(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass = 429490) // Apollo 8
        // public SII(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass = 444180) // Apollo 11
            : base(craftDirectory, position, velocity, 0, propellantMass, "Saturn/SII.png")
        {
            StageOffset = new DVector2(0, 22.5);

            Engines = new IEngine[5];

            for (int i = 0; i < 5; i++)
            {
                double theta         = Math.PI / 2.0 + (Math.PI * i) / 2.5;
                double engineOffsetX = Math.Cos(theta);
                var    offset        = new DVector2(engineOffsetX * Width * 0.25, Height * 0.72);
                Engines[i] = new J2(i, this, offset);
            }
        }
示例#11
0
        public void test_itaiji()
        {
            var dic = new Dictionary <string, string> {
                { "菟", "兎" },
                { "菟集", "兎集" },
                { "熙", "煕" },
                { "壱弍", "一二" },
                { "森鷗外", "森鴎外" }
            };
            var j = new J2("H");

            foreach (var kv in dic)
            {
                var re = j.itaiji_conv(kv.Key);
                Assert.Equal(kv.Value, re);
            }
        }
        public override async Task <PagedResultDto <DanhMucHangMucDto> > GetAll(GetAllDanhMucHangMucInput input)
        {
            string Keyword = GlobalFunction.RegexFormat(input.Keyword);

            var query = from HangMuc in _danhMucHangMucRepository.GetAll()
                        .WhereIf(!string.IsNullOrWhiteSpace(Keyword), w => w.Name.Contains(Keyword))
                        .WhereIf(input.DichVuId.HasValue, w => w.DichVuId == input.DichVuId)
                        .WhereIf(input.IsActive.HasValue, w => w.IsActive == input.IsActive)

                        join DichVu in _danhMucDichVuRepository.GetAll() on HangMuc.DichVuId equals DichVu.Id into J1
                        from DichVu in J1.DefaultIfEmpty()

                        join NhomDichVu in _danhMucNhomDichVuRepository.GetAll() on DichVu.NhomDichVuId equals NhomDichVu.Id into J2
                        from NhomDichVu in J2.DefaultIfEmpty()

                        where !input.NhomDichVuId.HasValue || NhomDichVu.Id == input.NhomDichVuId

                        select new
            {
                HangMuc,
                DichVuName     = DichVu != null ? DichVu.Name : "",
                NhomDichVuName = NhomDichVu != null ? NhomDichVu.Name : ""
            };

            var TotalCount = await query.CountAsync();

            var PagedHangMuc = await query.OrderBy(o => o.HangMuc.Name).PageBy(input).ToListAsync();

            List <DanhMucHangMucDto> HangMucs = new List <DanhMucHangMucDto>();

            foreach (var item in PagedHangMuc)
            {
                var HangMuc = ObjectMapper.Map <DanhMucHangMucDto>(item.HangMuc);
                HangMuc.DichVuName     = item.DichVuName;
                HangMuc.NhomDichVuName = item.NhomDichVuName;

                HangMucs.Add(HangMuc);
            }

            return(new PagedResultDto <DanhMucHangMucDto>
            {
                TotalCount = TotalCount,
                Items = HangMucs
            });
        }
示例#13
0
        private void cadastroj2()
        {
            string J2, ficha;

            J2 = textBox_Jogador2.Text;
            bool jogadorexiste = false;

            if (File.Exists("ficha.txt"))
            {
                Stream       leitura   = File.Open("ficha.txt", FileMode.Open);
                StreamReader e2        = new StreamReader(leitura);
                string[]     verificar = new string[2];
                while (e2.Peek() >= 0)
                {
                    verificar = e2.ReadLine().Split(':');
                    if (verificar[0].ToUpper() == J2.ToUpper())
                    {
                        jogadorexiste = true;
                        MessageBox.Show("Insira outro nome.", "Jogador 2 existente",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                e2.Close();
                if (jogadorexiste == false)
                {
                    Stream       escrita = File.Open("ficha.txt", FileMode.Append); //Cria arquivo de entrada
                    StreamWriter e1      = new StreamWriter(escrita);
                    ficha = J2 + ":0:";
                    e1.WriteLine(ficha);
                    e1.Close();
                    MessageBox.Show("Jogador cadastrado com sucesso.", "Jogador 2 cadastrado",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                Stream       escrita = File.Open("ficha.txt", FileMode.Append); //Cria arquivo de entrada
                StreamWriter e1      = new StreamWriter(escrita);
                ficha = J2 + ":0:";
                e1.WriteLine(ficha);
                e1.Close();
                MessageBox.Show("Jogador cadastrado com sucesso.", "Jogador 2 cadastrado",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#14
0
文件: Button.cs 项目: DiegoCach/UFR
    // Update is called once per frame
    void Update()
    {
        if (GameManager.init.player1Hp < GameManager.init.player2Hp)
        {
            winner.text = "Player 2 Wins this round!";
            J2.SetActive(true);
        }
        else if (GameManager.init.player2Hp < GameManager.init.player1Hp)
        {
            winner.text = "Player 1 Wins this round!";
            J1.SetActive(true);
        }

        if (winner.text == "Player 1 Wins this round!" || winner.text == "Player 2 Wins this round!")
        {
            StartCoroutine("Restart");
        }
    }
示例#15
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            J1.UstawX(pictureBoxJednorozec1.Location.X);
            pictureBoxJednorozec1.Location = new Point(J1.PodajX() + J1.PodajPredkosc(), 5);

            J2.UstawX(pictureBoxJednorozec2.Location.X);
            pictureBoxJednorozec2.Location = new Point(J2.PodajX() + J2.PodajPredkosc(), 105);

            J3.UstawX(pictureBoxJednorozec3.Location.X);
            pictureBoxJednorozec3.Location = new Point(J3.PodajX() + J3.PodajPredkosc(), 205);

            J4.UstawX(pictureBoxJednorozec4.Location.X);
            pictureBoxJednorozec4.Location = new Point(J4.PodajX() + J4.PodajPredkosc(), 305);

            if (J1.CzyJuzWygral() == true)
            {
                timer1.Stop();
                pula.UstawIndeksWygrywajacegoJednorozca(0);
                J1.Wygrana();
                zakonczTure();
            }
            else if (J2.CzyJuzWygral() == true)
            {
                timer1.Stop();
                pula.UstawIndeksWygrywajacegoJednorozca(1);
                J2.Wygrana();
                zakonczTure();
            }
            else if (J3.CzyJuzWygral() == true)
            {
                timer1.Stop();
                pula.UstawIndeksWygrywajacegoJednorozca(2);
                J3.Wygrana();
                zakonczTure();
            }
            else if (J4.CzyJuzWygral() == true)
            {
                timer1.Stop();
                pula.UstawIndeksWygrywajacegoJednorozca(3);
                J4.Wygrana();
                zakonczTure();
            }
        }
示例#16
0
        public async Task <PagedResultDto <GetTramDichVuForView> > GetAllNew(GetAllTramDichVuInput input)
        {
            input.Keyword = GlobalFunction.RegexFormat(input.Keyword);

            var query = from TramDV in _tramDichVuRepository.GetAll()
                        .WhereIf(!input.Keyword.IsNullOrWhiteSpace(), w => w.Name.Contains(input.Keyword))
                        join TramTruong in _userRepository.GetAll() on TramDV.TramTruongId equals TramTruong.Id into J1
                        from TramTruong in J1.DefaultIfEmpty()

                        join DmQuanHuyen in _danhMucQuanHuyenRepository.GetAll() on TramDV.DiaChiQuanHuyenId equals DmQuanHuyen.Id into J2
                        from DmQuanHuyen in J2.DefaultIfEmpty()

                        join DmTinhThanh in _danhMucTinhThanhRepository.GetAll() on TramDV.DiaChiTinhThanhId equals DmTinhThanh.Id into J3
                        from DmTinhThanh in J3.DefaultIfEmpty()

                        select new
            {
                TramDV,
                TramTruongName = TramTruong != null ? TramTruong.UserName : "",
                QuanHuyenName  = DmQuanHuyen != null ? ", " + DmQuanHuyen.Name : "",
                TinhThanhName  = DmTinhThanh != null ? ", " + DmTinhThanh.Name : "",
            };

            var TotalCount = await query.CountAsync();

            var PagedDanhMucTram = await query.OrderBy(o => o.TramDV.Name).PageBy(input).ToListAsync();

            var PagedDanhMucTramForView = PagedDanhMucTram.Select(s => new GetTramDichVuForView
            {
                TramDichVu     = ObjectMapper.Map <TramDichVuDto>(s.TramDV),
                TramTruongName = s.TramTruongName,
                DiaChi         = s.TramDV.DiaChi + s.QuanHuyenName + s.TinhThanhName,
            }).ToList();

            return(new PagedResultDto <GetTramDichVuForView> (
                       TotalCount,
                       PagedDanhMucTramForView
                       ));
        }
示例#17
0
 public override string  ToString()
 {
     return('(' + J1.ToString() + ", " + J2.ToString() + ", " + J3.ToString() + ", " + J4.ToString() + ", " + J5.ToString() + ", " + J6.ToString() + ')');
 }
示例#18
0
    // Use this for initialization
    void Start()
    {
        PlayerIcon.GetComponent <SpriteRenderer>().enabled = true;
        A1.GetComponent <SpriteRenderer>().enabled         = false;
        A2.GetComponent <SpriteRenderer>().enabled         = false;
        A3.GetComponent <SpriteRenderer>().enabled         = false;
        A4.GetComponent <SpriteRenderer>().enabled         = false;
        A5.GetComponent <SpriteRenderer>().enabled         = false;
        A6.GetComponent <SpriteRenderer>().enabled         = false;
        A7.GetComponent <SpriteRenderer>().enabled         = false;
        A8.GetComponent <SpriteRenderer>().enabled         = false;
        A9.GetComponent <SpriteRenderer>().enabled         = false;
        A10.GetComponent <SpriteRenderer>().enabled        = false;
        A11.GetComponent <SpriteRenderer>().enabled        = false;
        B1.GetComponent <SpriteRenderer>().enabled         = false;
        B2.GetComponent <SpriteRenderer>().enabled         = false;
        B3.GetComponent <SpriteRenderer>().enabled         = false;
        B4.GetComponent <SpriteRenderer>().enabled         = false;
        B5.GetComponent <SpriteRenderer>().enabled         = false;
        B6.GetComponent <SpriteRenderer>().enabled         = false;
        B7.GetComponent <SpriteRenderer>().enabled         = false;
        B8.GetComponent <SpriteRenderer>().enabled         = false;
        B9.GetComponent <SpriteRenderer>().enabled         = false;
        B10.GetComponent <SpriteRenderer>().enabled        = false;
        B11.GetComponent <SpriteRenderer>().enabled        = false;
        C1.GetComponent <SpriteRenderer>().enabled         = false;
        C2.GetComponent <SpriteRenderer>().enabled         = false;
        C3.GetComponent <SpriteRenderer>().enabled         = false;
        C4.GetComponent <SpriteRenderer>().enabled         = false;
        C5.GetComponent <SpriteRenderer>().enabled         = false;
        C6.GetComponent <SpriteRenderer>().enabled         = false;
        C7.GetComponent <SpriteRenderer>().enabled         = false;
        C8.GetComponent <SpriteRenderer>().enabled         = false;
        C9.GetComponent <SpriteRenderer>().enabled         = false;
        C10.GetComponent <SpriteRenderer>().enabled        = false;
        C11.GetComponent <SpriteRenderer>().enabled        = false;
        D1.GetComponent <SpriteRenderer>().enabled         = false;
        D2.GetComponent <SpriteRenderer>().enabled         = false;
        D3.GetComponent <SpriteRenderer>().enabled         = false;
        D4.GetComponent <SpriteRenderer>().enabled         = false;
        D5.GetComponent <SpriteRenderer>().enabled         = false;
        D6.GetComponent <SpriteRenderer>().enabled         = false;
        D7.GetComponent <SpriteRenderer>().enabled         = false;
        D8.GetComponent <SpriteRenderer>().enabled         = false;
        D9.GetComponent <SpriteRenderer>().enabled         = false;
        D10.GetComponent <SpriteRenderer>().enabled        = false;
        D11.GetComponent <SpriteRenderer>().enabled        = false;
        E1.GetComponent <SpriteRenderer>().enabled         = false;
        E2.GetComponent <SpriteRenderer>().enabled         = false;
        E3.GetComponent <SpriteRenderer>().enabled         = false;
        E4.GetComponent <SpriteRenderer>().enabled         = false;
        E5.GetComponent <SpriteRenderer>().enabled         = false;
        E6.GetComponent <SpriteRenderer>().enabled         = false;
        E7.GetComponent <SpriteRenderer>().enabled         = false;
        E8.GetComponent <SpriteRenderer>().enabled         = false;
        E9.GetComponent <SpriteRenderer>().enabled         = false;
        E10.GetComponent <SpriteRenderer>().enabled        = false;
        E11.GetComponent <SpriteRenderer>().enabled        = false;
        F1.GetComponent <SpriteRenderer>().enabled         = false;
        F2.GetComponent <SpriteRenderer>().enabled         = false;
        F3.GetComponent <SpriteRenderer>().enabled         = false;
        F4.GetComponent <SpriteRenderer>().enabled         = false;
        F5.GetComponent <SpriteRenderer>().enabled         = false;
        F6.GetComponent <SpriteRenderer>().enabled         = false;
        F7.GetComponent <SpriteRenderer>().enabled         = false;
        F8.GetComponent <SpriteRenderer>().enabled         = false;
        F9.GetComponent <SpriteRenderer>().enabled         = false;
        F10.GetComponent <SpriteRenderer>().enabled        = false;
        F11.GetComponent <SpriteRenderer>().enabled        = false;
        G1.GetComponent <SpriteRenderer>().enabled         = false;
        G2.GetComponent <SpriteRenderer>().enabled         = false;
        G3.GetComponent <SpriteRenderer>().enabled         = false;
        G4.GetComponent <SpriteRenderer>().enabled         = false;
        G5.GetComponent <SpriteRenderer>().enabled         = false;
        G6.GetComponent <SpriteRenderer>().enabled         = false;
        G7.GetComponent <SpriteRenderer>().enabled         = false;
        G8.GetComponent <SpriteRenderer>().enabled         = false;
        G9.GetComponent <SpriteRenderer>().enabled         = false;
        G10.GetComponent <SpriteRenderer>().enabled        = false;
        G11.GetComponent <SpriteRenderer>().enabled        = false;
        H1.GetComponent <SpriteRenderer>().enabled         = false;
        H2.GetComponent <SpriteRenderer>().enabled         = false;
        H3.GetComponent <SpriteRenderer>().enabled         = false;
        H4.GetComponent <SpriteRenderer>().enabled         = false;
        H5.GetComponent <SpriteRenderer>().enabled         = false;
        H6.GetComponent <SpriteRenderer>().enabled         = false;
        H7.GetComponent <SpriteRenderer>().enabled         = false;
        H8.GetComponent <SpriteRenderer>().enabled         = false;
        H9.GetComponent <SpriteRenderer>().enabled         = false;
        H10.GetComponent <SpriteRenderer>().enabled        = false;
        H11.GetComponent <SpriteRenderer>().enabled        = false;
        I1.GetComponent <SpriteRenderer>().enabled         = false;
        I2.GetComponent <SpriteRenderer>().enabled         = false;
        I3.GetComponent <SpriteRenderer>().enabled         = false;
        I4.GetComponent <SpriteRenderer>().enabled         = false;
        I5.GetComponent <SpriteRenderer>().enabled         = false;
        I6.GetComponent <SpriteRenderer>().enabled         = false;
        I7.GetComponent <SpriteRenderer>().enabled         = false;
        I8.GetComponent <SpriteRenderer>().enabled         = false;
        I9.GetComponent <SpriteRenderer>().enabled         = false;
        I10.GetComponent <SpriteRenderer>().enabled        = false;
        I11.GetComponent <SpriteRenderer>().enabled        = false;
        J1.GetComponent <SpriteRenderer>().enabled         = false;
        J2.GetComponent <SpriteRenderer>().enabled         = false;
        J3.GetComponent <SpriteRenderer>().enabled         = false;
        J4.GetComponent <SpriteRenderer>().enabled         = false;
        J5.GetComponent <SpriteRenderer>().enabled         = false;
        J6.GetComponent <SpriteRenderer>().enabled         = false;
        J7.GetComponent <SpriteRenderer>().enabled         = false;
        J8.GetComponent <SpriteRenderer>().enabled         = false;
        J9.GetComponent <SpriteRenderer>().enabled         = false;
        J10.GetComponent <SpriteRenderer>().enabled        = false;
        J11.GetComponent <SpriteRenderer>().enabled        = false;
        K1.GetComponent <SpriteRenderer>().enabled         = false;
        K2.GetComponent <SpriteRenderer>().enabled         = false;
        K3.GetComponent <SpriteRenderer>().enabled         = false;
        K4.GetComponent <SpriteRenderer>().enabled         = false;
        K5.GetComponent <SpriteRenderer>().enabled         = false;
        K6.GetComponent <SpriteRenderer>().enabled         = false;
        K7.GetComponent <SpriteRenderer>().enabled         = false;
        K8.GetComponent <SpriteRenderer>().enabled         = false;
        K9.GetComponent <SpriteRenderer>().enabled         = false;
        K10.GetComponent <SpriteRenderer>().enabled        = false;
        K11.GetComponent <SpriteRenderer>().enabled        = false;
        float ratio = Screen.width / Screen.height;

        if (ratio < 2)
        {
            int screenx = 543;
            int screeny = 653;
        }
        else
        {
            int screenx = 743;
            int screeny = 853;
        }
    }
示例#19
0
        public static Results Calcu(List <PValue>[] inputs, CalcuInfo calcuinfo)
        {
            //公用变量
            bool   _errorFlag   = false;
            string _errorInfo   = "";
            bool   _warningFlag = false;
            string _warningInfo = "";
            bool   _fatalFlag   = false;
            string _fatalInfo   = "";



            List <PValue>[] results = new List <PValue> [1];
            try
            {
                string[]      paras     = calcuinfo.fparas.Split(';');
                List <PValue> intValues = new List <PValue>();
                foreach (List <PValue> item in inputs)
                {
                    intValues.Add(item[0]);
                }
                for (int i = 0; i < intValues.Count - 1; i++)
                {
                    double V, M, k, b, A, R1, R2, J1, J2, L;
                    string P = string.Empty;
                    V  = int.Parse(paras[0]);
                    M  = int.Parse(paras[1]);
                    P  = paras[2];
                    k  = double.Parse(paras[3]);
                    b  = double.Parse(paras[4]);
                    A  = int.Parse(paras[5]);
                    R1 = double.Parse(paras[6]);
                    R2 = double.Parse(paras[7]);
                    J1 = int.Parse(paras[8]);
                    J2 = int.Parse(paras[9]);
                    L  = int.Parse(paras[10]);
                    string type = calcuinfo.fsourtagids[i].ToString();

                    double newValue = (A == 0 ? intValues[i].Value : Math.Abs(intValues[i].Value)) * k + b;
                    double x        = 0;
                    if (V == 0)
                    {
                        bool j1Result = false;
                        bool j2Result = false;
                        switch (J1.ToString())
                        {
                        case "0":
                            if (newValue > R1)
                            {
                                j1Result = true;
                            }
                            break;

                        case "1":
                            if (newValue >= R1)
                            {
                                j1Result = true;
                            }
                            break;

                        case "2":
                            if (newValue < R1)
                            {
                                j1Result = true;
                            }
                            break;

                        case "3":
                            if (newValue <= R1)
                            {
                                j1Result = true;
                            }
                            break;

                        default:
                            break;
                        }
                        switch (J2.ToString())
                        {
                        case "0":
                            if (newValue > R2)
                            {
                                j2Result = true;
                            }
                            break;

                        case "1":
                            if (newValue >= R2)
                            {
                                j2Result = true;
                            }
                            break;

                        case "2":
                            if (newValue < R2)
                            {
                                j2Result = true;
                            }
                            break;

                        case "3":
                            if (newValue <= R2)
                            {
                                j2Result = true;
                            }
                            break;

                        default:
                            break;
                        }

                        switch (L.ToString())
                        {
                        case "0":
                            if (j1Result && j2Result)
                            {
                                x = 1;
                            }
                            else
                            {
                                x = 0;
                            }
                            break;

                        case "1":
                            if (j1Result || j2Result)
                            {
                                x = 1;
                            }
                            else
                            {
                                x = 0;
                            }
                            break;

                        case "2":
                            if (!j1Result && !j2Result)
                            {
                                x = 1;
                            }
                            else
                            {
                                x = 0;
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        x = newValue;
                    }

                    string          tableNo = string.Empty;
                    List <DateTime> seDate  = getDateRegion(P, intValues[i].Timestamp);

                    DataTable dt = BLL.AlgorithmBLL.getMHisOpHistory("MHisOp" + type + P, seDate);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        double newX = 0;
                        if (M == 0)
                        {
                            newX = Convert.ToDouble(dt.Rows[0]["tagvalue"].ToString()) + x;
                        }
                        else if (M == 1)
                        {
                            TimeSpan d1   = intValues[i].Timestamp.Subtract(seDate[0]);
                            int      mins = d1.Minutes;
                            newX = Math.Round((Convert.ToDouble(dt.Rows[0]["tagvalue"].ToString()) * mins + x) / (mins + 1), 2);
                        }
                        bool isok = BLL.AlgorithmBLL.UpdateMHisOp("MHisOp" + type + P, newX, seDate);
                        if (!isok)
                        {
                            _errorInfo += "MHisOp" + type + P + " 时间区间:" + seDate[0].ToString("yyyy-MM-dd HH:mm") + "--" + seDate[1].ToString("yyyy-MM-dd HH:mm") + "  时间点:" + intValues[i].Timestamp.ToString("yyyy-MM-dd HH:mm") + "更新报错";
                        }
                    }
                    else
                    {
                        bool isok = BLL.AlgorithmBLL.InsertMHisOp("MHisOp" + type + P, x, seDate);
                        if (!isok)
                        {
                            _errorInfo += "MHisOp" + type + P + " 时间区间:" + seDate[0].ToString("yyyy-MM-dd HH:mm") + "--" + seDate[1].ToString("yyyy-MM-dd HH:mm") + "  时间点:" + intValues[i].Timestamp.ToString("yyyy-MM-dd HH:mm") + "录入报错";
                        }
                    }
                }



                if (string.IsNullOrWhiteSpace(_errorInfo))
                {
                    return(new Results(results, _errorFlag, _errorInfo, _warningFlag, _warningInfo, _fatalFlag, _fatalInfo));
                }
                else
                {
                    _fatalFlag = true;
                    _fatalInfo = "MHisOp算法出错";
                    return(new Results(results, _errorFlag, _errorInfo, _warningFlag, _warningInfo, _fatalFlag, _fatalInfo));
                }
            }
            catch (Exception ex)
            {
                //计算中出任何错误,则需要记录log
                //LogHelper.Write(LogType.Error, "计算模块错误!");
                //记录计算模块的名称、当前标签、起始时间、结束时间
                //string moduleInfo = string.Format("——计算模块的名称是:{0},当前计算源标签是:{1},计算起始时间是:{2},计算结束时间是:{3}。", calcuInfo.fmodulename, calcuInfo.sourcetagname, calcuinfo.fstarttime.ToString(), calcuinfo.fendtime.ToString());
                //LogHelper.Write(LogType.Error, moduleInfo);
                //计算引擎报错具体信息
                //string errInfo = string.Format("——具体报错信息:{0}。", ex.ToString());
                //LogHelper.Write(LogType.Error, errInfo);
                //返回null供计算引擎处理
                _fatalFlag = true;
                _fatalInfo = ex.ToString();
                return(new Results(results, _errorFlag, _errorInfo, _warningFlag, _warningInfo, _fatalFlag, _fatalInfo));
            }
        }
示例#20
0
 public override bool isIn(int x, int y, int w, int h)
 {
     return(J1.isIn(x, y, w, h) || J2.isIn(x, y, w, h));
 }
        public async Task <List <CongViecDto> > GetAll(DanhSachCongViecInput input)
        {
            var UserCache = await _globalCache.GetUserCache((long)AbpSession.UserId);

            if (UserCache.Id == 0)
            {
                return(new List <CongViecDto>());
            }

            var query = from CongViec in _congViecRepository.GetAll()
                        .WhereIf(input.TrangThaiIds.Length > 0, w => input.TrangThaiIds.ToList().Contains(w.TrangThaiId))
                        .WhereIf(UserCache.IsCustomer, w => w.KhachHangId == UserCache.CustomerId)
                        .WhereIf(!UserCache.IsCustomer, w => w.NhanVienId == AbpSession.UserId)
                        join DichVu in _dichVuRepository.GetAll() on CongViec.DichVuId equals DichVu.Id into J1
                        from DichVu in J1.DefaultIfEmpty()
                        join NhomDichVu in _nhomDichVuRepository.GetAll() on DichVu.NhomDichVuId equals NhomDichVu.Id into J6
                        from NhomDichVu in J6.DefaultIfEmpty()

                        join TramDichVu in _tramDichVuRepository.GetAll() on CongViec.TramDichVuId equals TramDichVu.Id into J5
                        from TramDichVu in J5.DefaultIfEmpty()

                        join NhanVien in _nhanVienRepository.GetAll() on CongViec.NhanVienId equals NhanVien.Id into J2
                        from NhanVien in J2.DefaultIfEmpty()

                        join TinhThanh in _tinhThanhRepository.GetAll() on CongViec.DiaChiTinhThanhId equals TinhThanh.Id into J3
                        from TinhThanh in J3.DefaultIfEmpty()

                        join QuanHuyen in _quanHuyenRepository.GetAll() on CongViec.DiaChiQuanHuyenId equals QuanHuyen.Id into J4
                        from QuanHuyen in J4.DefaultIfEmpty()

                        select new
            {
                CongViec,
                NhomDichVuId   = NhomDichVu != null ? NhomDichVu.Id : 0,
                NhomDichVuName = NhomDichVu.Name,
                DichVuName     = DichVu.Name,
                TramDichVuName = TramDichVu.Name,
                NhanVienName   = NhanVien.Name,
                NhanVienPhone  = NhanVien.PhoneNumber,
                TinhThanhName  = TinhThanh.Name,
                QuanHuyenName  = QuanHuyen.Name
            };

            var CongViecs = await query.OrderBy(o => o.CongViec.NgayGioHen).Skip((input.Page - 1) * 10).Take(10).ToListAsync();

            var CongViecDtos = new List <CongViecDto>();

            foreach (var item in CongViecs)
            {
                var CongViec = ObjectMapper.Map <CongViecDto>(item.CongViec);

                if (item.NhomDichVuId > 0)
                {
                    CongViec.NhomDichVuId = item.NhomDichVuId;
                }
                CongViec.NhomDichVuName = item.NhomDichVuName;
                CongViec.DichVuName     = item.DichVuName;
                CongViec.TramDichVuName = item.TramDichVuName;
                CongViec.NhanVienName   = item.NhanVienName;
                CongViec.NhanVienPhone  = item.NhanVienPhone;
                CongViec.DiaChi        += string.IsNullOrWhiteSpace(item.QuanHuyenName) ? "" : ", " + item.QuanHuyenName;
                CongViec.DiaChi        += string.IsNullOrWhiteSpace(item.TinhThanhName) ? "" : ", " + item.TinhThanhName;
                CongViec.TrangThaiName  = item.CongViec.TrangThaiId >= 0 && GlobalModel.TrangThaiCongViec.ContainsKey((int)item.CongViec.TrangThaiId) ? GlobalModel.TrangThaiCongViec[(int)item.CongViec.TrangThaiId] : "";

                CongViec.Image1          = string.IsNullOrWhiteSpace(CongViec.Image1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.Image1);
                CongViec.Image2          = string.IsNullOrWhiteSpace(CongViec.Image2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.Image2);
                CongViec.Image3          = string.IsNullOrWhiteSpace(CongViec.Image3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.Image3);
                CongViec.ImageHoanThanh1 = string.IsNullOrWhiteSpace(CongViec.ImageHoanThanh1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageHoanThanh1);
                CongViec.ImageHoanThanh2 = string.IsNullOrWhiteSpace(CongViec.ImageHoanThanh2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageHoanThanh2);
                CongViec.ImageHoanThanh3 = string.IsNullOrWhiteSpace(CongViec.ImageHoanThanh3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageHoanThanh3);
                CongViec.ImageKhachHang1 = string.IsNullOrWhiteSpace(CongViec.ImageKhachHang1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageKhachHang1);
                CongViec.ImageKhachHang2 = string.IsNullOrWhiteSpace(CongViec.ImageKhachHang2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageKhachHang2);
                CongViec.ImageKhachHang3 = string.IsNullOrWhiteSpace(CongViec.ImageKhachHang3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", item.CongViec.TimeId, CongViec.ImageKhachHang3);

                CongViecDtos.Add(CongViec);
            }

            return(CongViecDtos);
        }
        public async Task <CongViecDto> Get(long Id)
        {
            var UserCache = await _globalCache.GetUserCache((long)AbpSession.UserId);

            if (UserCache.Id == 0)
            {
                throw new UserFriendlyException(L("UserIsNotLogin"));
            }

            var query = await(from CongViec in _congViecRepository.GetAll().Where(w => w.Id == Id)
                              .WhereIf(UserCache.IsCustomer, w => w.KhachHangId == UserCache.CustomerId)
                              .WhereIf(!UserCache.IsCustomer, w => w.NhanVienId == AbpSession.UserId)

                              join DichVu in _dichVuRepository.GetAll() on CongViec.DichVuId equals DichVu.Id into J1
                              from DichVu in J1.DefaultIfEmpty()
                              join NhomDichVu in _nhomDichVuRepository.GetAll() on DichVu.NhomDichVuId equals NhomDichVu.Id into J6
                              from NhomDichVu in J6.DefaultIfEmpty()

                              join TramDichVu in _tramDichVuRepository.GetAll() on CongViec.TramDichVuId equals TramDichVu.Id into J2
                              from TramDichVu in J2.DefaultIfEmpty()

                              join NhanVien in _nhanVienRepository.GetAll() on CongViec.NhanVienId equals NhanVien.Id into J3
                              from NhanVien in J3.DefaultIfEmpty()

                              join TinhThanh in _tinhThanhRepository.GetAll() on CongViec.DiaChiTinhThanhId equals TinhThanh.Id into J4
                              from TinhThanh in J4.DefaultIfEmpty()

                              join QuanHuyen in _quanHuyenRepository.GetAll() on CongViec.DiaChiQuanHuyenId equals QuanHuyen.Id into J5
                              from QuanHuyen in J5.DefaultIfEmpty()

                              select new
            {
                CongViec,
                NhomDichVuId   = NhomDichVu != null ? NhomDichVu.Id : 0,
                NhomDichVuName = NhomDichVu.Name,
                DichVuName     = DichVu.Name,
                TramDichVuName = TramDichVu.Name,
                NhanVienName   = NhanVien.Name,
                NhanVienPhone  = NhanVien.PhoneNumber,
                TinhThanhName  = TinhThanh.Name,
                QuanHuyenName  = QuanHuyen.Name
            }).FirstOrDefaultAsync();

            if (query == null)
            {
                throw new UserFriendlyException(L("CongViecIsNotFound"));
            }

            var result = ObjectMapper.Map <CongViecDto>(query.CongViec);

            if (query.NhomDichVuId > 0)
            {
                result.NhomDichVuId = query.NhomDichVuId;
            }
            result.NhomDichVuName = query.NhomDichVuName;
            result.DichVuName     = query.DichVuName;
            result.TramDichVuName = query.TramDichVuName;
            result.NhanVienName   = query.NhanVienName;
            result.NhanVienPhone  = query.NhanVienPhone;
            result.DiaChi        += string.IsNullOrWhiteSpace(query.QuanHuyenName) ? "" : ", " + query.QuanHuyenName;
            result.DiaChi        += string.IsNullOrWhiteSpace(query.TinhThanhName) ? "" : ", " + query.TinhThanhName;
            result.TrangThaiName  = query.CongViec.TrangThaiId >= 0 && GlobalModel.TrangThaiCongViec.ContainsKey((int)query.CongViec.TrangThaiId) ? GlobalModel.TrangThaiCongViec[(int)query.CongViec.TrangThaiId] : "";

            result.Image1          = string.IsNullOrWhiteSpace(result.Image1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.Image1);
            result.Image2          = string.IsNullOrWhiteSpace(result.Image2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.Image2);
            result.Image3          = string.IsNullOrWhiteSpace(result.Image3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.Image3);
            result.ImageHoanThanh1 = string.IsNullOrWhiteSpace(result.ImageHoanThanh1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageHoanThanh1);
            result.ImageHoanThanh2 = string.IsNullOrWhiteSpace(result.ImageHoanThanh2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageHoanThanh2);
            result.ImageHoanThanh3 = string.IsNullOrWhiteSpace(result.ImageHoanThanh3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageHoanThanh3);
            result.ImageKhachHang1 = string.IsNullOrWhiteSpace(result.ImageKhachHang1) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageKhachHang1);
            result.ImageKhachHang2 = string.IsNullOrWhiteSpace(result.ImageKhachHang2) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageKhachHang2);
            result.ImageKhachHang3 = string.IsNullOrWhiteSpace(result.ImageKhachHang3) ? "" : string.Format("/Common/CongViecs/{0}/{1}", query.CongViec.TimeId, result.ImageKhachHang3);

            // Lấy danh sách hạng mục công việc
            result.DanhSachHangMuc = await(from CongViecHangMuc in _congViecHangMucRepository.GetAll().Where(w => w.CongViecId == query.CongViec.Id)
                                           join DanhMucHangMuc in _hangMucRepository.GetAll() on CongViecHangMuc.HangMucId equals DanhMucHangMuc.Id

                                           select new CongViecHangMucDto
            {
                HangMucId = DanhMucHangMuc.Id,
                Name      = DanhMucHangMuc.Name,
                DonViTinh = DanhMucHangMuc.DonViTinh,
                SoLuong   = CongViecHangMuc.SoLuong,
                DonGia    = CongViecHangMuc.DonGia,
                ThanhTien = CongViecHangMuc.ThanhTien
            }).ToListAsync();

            // Tạm tính thành tiền của công việc bằng cách lấy tổng
            result.ThanhTien = result.PhuPhi ?? 0 + result.DanhSachHangMuc.Sum(s => s.ThanhTien);

            return(result);
        }
示例#23
0
 public override bool Intersects(int x, int y, int w, int h)
 {
     return(J1.Intersects(x, y, w, h) || J2.Intersects(x, y, w, h));
 }