Exemplo n.º 1
0
    public Customer(FilmShowing fs, int ID, Floor f, Controller c, Customer_Controller cc)
    {

        pointsToVisit = new List<Coordinate>();
        theFloor = f;
        mainController = c;
        customerController = cc;

        filmShowing = fs;

        index = ID;

        needsFood = Random.Range(0, 10) >= 5;         
        needsTickets = Random.Range(0, 10) >= 0;      // 3
        needsToilet = Random.Range(0, 10) >= 6;

        if (needsFood)
        {

            if (Controller.foodArea != null)
            {

                int rand = Random.Range(0, 15);
                if (rand < 8) { foodDesired = 0; }
                else if (rand < 13) { foodDesired = 1; }
                else { foodDesired = 2; }
            }
            else
            {
                needsFood = false;
                foodDesired = -1;
                patience -= 150;
            }
        }

        int minutesEarly = Random.Range(35, 95);

        try
        {
            int hourStart = fs.timeH;
            int minuteStart = fs.timeM;


            hourDue = hourStart - (minutesEarly / 60);
            minuteDue = minuteStart - minutesEarly - ((hourDue - hourStart) * 60);

            if (minuteDue < 0)
            {
                minuteDue += 60;
                hourDue--;
            }
        }
        catch (Exception) { }
    }
Exemplo n.º 2
0
        void LoadData()
        {
            try
            {
                Customer_Controller _Customer_Controller = new Customer_Controller();
                List <Customer_Buy_Product_Info> _lst    = _Customer_Controller.Get_Customer_Buy_Product(c_Customer_Info.Customer_Id);
                dgrProduct_Detail.ItemsSource = _lst;

                this.Title = "Thông tin khách hàng " + c_Customer_Info.Customer_Name;
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }
Exemplo n.º 3
0
        int Insert_Customer()
        {
            try
            {
                decimal _kq = 0;

                Customer_Controller  _Customer_Controller = new Customer_Controller();
                List <Customer_Info> _lst = _Customer_Controller.Search_Customer(txtCustomer_Name.Text, txtPhone.Text);

                if (_lst.Count == 0)
                {
                    Customer_Info _Customer_Info = new Customer_Info();
                    _Customer_Info.Customer_Name = txtCustomer_Name.Text;
                    _Customer_Info.Phone         = txtPhone.Text;
                    _Customer_Info.Address       = txtAddress.Text;

                    if (!_Customer_Controller.Customer_Insert(_Customer_Info, ref _kq))
                    {
                        // Thêm mới
                        NoteBox.Show("Lỗi rồi Nắng. Thêm mới khách hàng ko thành công", "", NoteBoxLevel.Error);
                        return(-1);
                    }
                    else
                    {
                        return(Convert.ToInt32(_kq));
                    }
                }
                else if (_lst.Count == 1)
                {
                    return(_lst[0].Customer_Id);
                }

                return(Convert.ToInt32(_kq));
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
                return(-1);
            }
        }
Exemplo n.º 4
0
        void Accept()
        {
            try
            {
                if (!CheckValidate_F())
                {
                    return;
                }
                Customer_Controller _Customer_Controller = new Customer_Controller();

                if (c_type == Convert.ToInt16(Form_Type.Insert))
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn thêm mới khách hàng " + txtName.Text + " hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Customer_Info _Customer_Info = new Customer_Info();
                        _Customer_Info.Customer_Name = txtName.Text;
                        _Customer_Info.Phone         = txtPhone.Text;
                        _Customer_Info.Address       = txtAddress.Text;

                        decimal _id = 0;
                        if (_Customer_Controller.Customer_Insert(_Customer_Info, ref _id))
                        {
                            NoteBox.Show("Thêm mới thành công");
                            c_id_insert = _id;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình thêm mới", "", NoteBoxLevel.Error);
                        }
                    }
                }
                else
                {
                    MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn cập nhật hay không?", "Thông báo", NoteBoxLevel.Question);
                    if (MessageBoxResult.Yes == result)
                    {
                        Customer_Info _Customer_Info = new Customer_Info();
                        _Customer_Info.Customer_Name = txtName.Text;
                        _Customer_Info.Phone         = txtPhone.Text;
                        _Customer_Info.Address       = txtAddress.Text;

                        if (_Customer_Controller.Customer_Update(c_Customer_Info.Customer_Id, _Customer_Info))
                        {
                            NoteBox.Show("Cập nhật dữ liệu thành công");
                            c_id_insert = 1;
                            this.Close();
                        }
                        else
                        {
                            NoteBox.Show("Có lỗi trong quá trình cập nhật dữ liệu", "", NoteBoxLevel.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonData.log.Error(ex.ToString());
            }
        }