示例#1
0
        private void btnTimXe_PSC_Click(object sender, EventArgs e)
        {
            dgvXe_PSC.DataSource = XeDAL.Instance.SearchXe(txtXe_PSC.Text);
            int currentRowindex = this.dgvXe_PSC.CurrentCellAddress.Y;

            if (-1 < currentRowindex && currentRowindex < dgvXe_PSC.RowCount)
            {
                XeDTO obj = (XeDTO)dgvXe_PSC.Rows[currentRowindex].DataBoundItem;
                this.txtCarnumber_PSC.Text = obj.Carnumber.ToString();
            }
        }
示例#2
0
        public XeDTO GetListXeById(int carnumber)
        {
            XeDTO     xe   = null;
            DataTable data = DataProvider.Instance.ExecuteQuery("select * from dbo.xe where carnumber =" + carnumber);

            foreach (DataRow item in data.Rows)
            {
                xe = new XeDTO(item);
                return(xe);
            }
            return(xe);
        }
示例#3
0
        public List <XeDTO> GetListXe()
        {
            List <XeDTO> xeList = new List <XeDTO>();
            DataTable    data   = DataProvider.Instance.ExecuteQuery("select * from dbo.xe");

            foreach (DataRow item in data.Rows)
            {
                XeDTO xe = new XeDTO(item);
                xeList.Add(xe);
            }
            return(xeList);
        }
示例#4
0
        public List <XeDTO> listxetheotuyen(string biensoxe)
        {
            List <XeDTO> listxetheotuyen = new List <XeDTO>();
            string       query           = "SELECT Xe.* FROM Xe WHERE BienSoXe = @biensoxe ";
            DataTable    data            = DataProvider.Instance.ExecuteQuery(query, new object[] { biensoxe });

            foreach (DataRow item in data.Rows)
            {
                XeDTO tx = new XeDTO(item);
                listxetheotuyen.Add(tx);
            }
            return(listxetheotuyen);
        }
示例#5
0
        public List <XeDTO> getListXebybienso(string biensoxe)
        {
            List <XeDTO> listxe = new List <XeDTO>();
            string       query  = "SELECT Xe.* FROM Xe WHERE BienSoXe LIKE  @biensoxe ";
            DataTable    data   = DataProvider.Instance.ExecuteQuery(query, new object[] { '%' + biensoxe + '%' });

            foreach (DataRow item in data.Rows)
            {
                XeDTO xe = new XeDTO(item);
                listxe.Add(xe);
            }
            return(listxe);
        }
示例#6
0
        public List <XeDTO> getListXe()
        {
            List <XeDTO> listxe = new List <XeDTO>();
            string       query  = "SELECT Xe.* FROM Xe";
            DataTable    data   = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                XeDTO xe = new XeDTO(item);
                listxe.Add(xe);
            }
            return(listxe);
        }
示例#7
0
        //Tìm xe theo bien so
        public static void FindCarByID(XeDTO xe)
        {
            MySqlConnection Conn = DatabaseConnectionDAO.connectionDatabase();
            MySqlCommand    cmd  = new MySqlCommand("FindCar", Conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@_BienSo", MySqlDbType.VarChar, 10);

            cmd.Parameters["@_BienSo"].Value = xe.BienSo;


            Conn.Open();
            cmd.ExecuteNonQuery();
            Conn.Close();
        }
示例#8
0
        public List <XeDTO> SearchXe(string text)
        {
            List <XeDTO> xeList = new List <XeDTO>();
            string       query  = string.Format("select * from dbo.xe where dbo.GetUnsignString(carbrand) like N'%' + dbo.GetUnsignString(N'{0}') + '%'", text);

            query += string.Format(" or carnumber like N'%' + N'{0}' + '%'", text);

            DataTable data = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                XeDTO xe = new XeDTO(item);
                xeList.Add(xe);
            }

            return(xeList);
        }
示例#9
0
        private void txtIDPSC_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (dgvPSC.SelectedCells.Count > 0)
                {
                    int carnumber = (int)dgvPSC.SelectedCells[0].OwningRow.Cells["Carnumber"].Value;
                    int iditem    = (int)dgvPSC.SelectedCells[0].OwningRow.Cells["iditem"].Value;

                    XeDTO      xe  = XeDAL.Instance.GetListXeById(carnumber);
                    VatLieuDTO kho = VatLieuDAL.Instance.GetListKhoById(iditem);
                    //cbHieuXe.SelectedItem = xe;
                    cbVatLieu.SelectedItem = kho;
                    int indexcar = -1;
                    int indexkho = -1;
                    int i1       = 0;
                    int i2       = 0;
                    //foreach (XeDTO item in cbHieuXe.Items)
                    //{
                    //    if (item.Carnumber == xe.Carnumber)
                    //    {
                    //        indexcar = i1;
                    //        break;
                    //    }
                    //    i1++;
                    //}
                    foreach (VatLieuDTO item in cbVatLieu.Items)
                    {
                        if (item.Iditem == kho.Iditem)
                        {
                            indexkho = i2;
                            break;
                        }
                        i2++;
                    }
                    //cbHieuXe.SelectedIndex = indexcar;
                    cbVatLieu.SelectedIndex = indexkho;
                }
            }
            catch { }
        }
示例#10
0
        public XeDTO getSchemaCar1(string carID, string tripID)
        {
            XeDTO xeDTO = new XeDTO();

            xeDTO.floor1 = new List <GheDTO>();
            xeDTO.floor2 = new List <GheDTO>();
            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@maxe", carID)
            };
            DataTable dt = new DataTable();

            dt = DataProvider.Instance.GetData("sp_getSechemaCar", parameters);

            //init defalut value
            int sohang = 7;
            int soghe  = 35;
            int socot  = 5;

            foreach (DataRow dr in dt.Rows)
            {
                GheDTO gheDTO = new GheDTO();
                gheDTO.maghe    = dr["maghe"].ToString();
                gheDTO.vitriX   = int.Parse(dr["vitriX"].ToString());
                gheDTO.vitriY   = int.Parse(dr["vitriY"].ToString());
                gheDTO.tang     = int.Parse(dr["tang"].ToString());
                gheDTO.isActive = bool.Parse(dr["active"].ToString());
                gheDTO.tenghe   = dr["tenghe"].ToString();
                gheDTO.status   = 0;
                ////////////////
                ///

                int.TryParse(dr["sohang"].ToString(), out sohang);

                int.TryParse(dr["socot"].ToString(), out socot);
                xeDTO.socot  = socot;
                xeDTO.sohang = sohang;
                xeDTO.maxe   = carID;

                int.TryParse(dr["soghe"].ToString(), out soghe);
                xeDTO.soghe = soghe;
                if (gheDTO.tang == 1)
                {
                    xeDTO.floor1.Add(gheDTO);
                }
                else if (gheDTO.tang == 2)
                {
                    xeDTO.floor2.Add(gheDTO);
                }
            }
            List <GheDTO> listTrangThaiGhe = getGheStatusByTripID(tripID);

            foreach (GheDTO ghe in listTrangThaiGhe)
            {
                if (ghe.status == 1)
                {
                    GheDTO ghe1 = xeDTO.floor1.SingleOrDefault(p => p.maghe == ghe.maghe);
                    GheDTO ghe2 = xeDTO.floor2.SingleOrDefault(p => p.maghe == ghe.maghe);
                    if (ghe1 != null)
                    {
                        xeDTO.floor1.Single(p => p.maghe == ghe.maghe).status = 1;
                    }
                    else if (ghe2 != null)
                    {
                        xeDTO.floor2.Single(p => p.maghe == ghe.maghe).status = 1;
                    }
                }
            }
            return(xeDTO);
        }