Example #1
0
        public bool addExecuteQuery(Boxcs x)
        {
            string str = string.Format("insert into Book values(@customer,@allmoney,@phone,@cardid,@rid,@time,@dqtime,@notes)");

            SqlParameter customer = new SqlParameter();

            customer.ParameterName = "@customer";
            customer.SqlDbType     = System.Data.SqlDbType.NVarChar;
            customer.Size          = 20;
            customer.Value         = x.Name;

            SqlParameter allmoney = new SqlParameter();

            allmoney.ParameterName = "@allmoney";
            allmoney.SqlDbType     = System.Data.SqlDbType.Money;
            allmoney.Value         = x.Money;

            SqlParameter phone = new SqlParameter();

            phone.ParameterName = "@phone";
            phone.SqlDbType     = System.Data.SqlDbType.NChar;
            phone.Size          = 10;
            phone.Value         = x.Phone;

            SqlParameter cardid = new SqlParameter();

            cardid.ParameterName = "@cardid";
            cardid.SqlDbType     = System.Data.SqlDbType.NVarChar;
            cardid.Size          = 20;
            cardid.Value         = x.Cardid;

            SqlParameter time = new SqlParameter();

            time.ParameterName = "@time";
            time.SqlDbType     = System.Data.SqlDbType.DateTime;
            time.Value         = x.Yutime;

            SqlParameter dqtime = new SqlParameter();

            dqtime.ParameterName = "@dqtime";
            dqtime.SqlDbType     = System.Data.SqlDbType.DateTime;
            dqtime.Value         = x.Dqtime;

            SqlParameter rid = new SqlParameter();

            rid.ParameterName = "@rid";
            rid.SqlDbType     = System.Data.SqlDbType.Int;
            rid.Size          = 32;
            rid.Value         = x.Roomid;

            SqlParameter notes = new SqlParameter();

            notes.ParameterName = "@notes";
            notes.SqlDbType     = System.Data.SqlDbType.NVarChar;
            notes.Size          = 50;
            notes.Value         = x.Notes;
            return(SqlHelper.B_sqlhelper.ExecuteQuery(str, new SqlParameter[] { customer, allmoney, phone, cardid, rid, time, dqtime, notes }));
        }
Example #2
0
 public bool updateExecuteQuery(Boxcs x)
 {
     return(new DAL.B_dal().updateExecuteQuery(x));
 }
Example #3
0
 public bool addExecuteQuery(Boxcs x)
 {
     return(new DAL.B_dal().addExecuteQuery(x));
 }
Example #4
0
        public bool updateExecuteQuery(Boxcs x)
        {
            string       str      = string.Format("update Book set B_Customer=@customer,B_AllMoney=@allmoney,B_Phone=@phone,B_Cardid=@cardid,R_ID=@rid,B_time=@time,B_daoqitime=@dqtime,B_Notes=@notes  where B_ID=@id");
            SqlParameter customer = new SqlParameter();

            customer.ParameterName = "@customer";
            customer.SqlDbType     = System.Data.SqlDbType.NVarChar;
            customer.Size          = 20;
            customer.Value         = x.Name;

            SqlParameter allmoney = new SqlParameter();

            allmoney.ParameterName = "@allmoney";
            allmoney.SqlDbType     = System.Data.SqlDbType.Money;
            allmoney.Value         = x.Money;

            SqlParameter phone = new SqlParameter();

            phone.ParameterName = "@phone";
            phone.SqlDbType     = System.Data.SqlDbType.NChar;
            phone.Size          = 11;
            phone.Value         = x.Phone;

            SqlParameter cardid = new SqlParameter();

            cardid.ParameterName = "@cardid";
            cardid.SqlDbType     = System.Data.SqlDbType.NVarChar;
            cardid.Size          = 20;
            cardid.Value         = x.Cardid;

            SqlParameter rid = new SqlParameter();

            rid.ParameterName = "@rid";
            rid.SqlDbType     = System.Data.SqlDbType.Int;
            rid.Size          = 32;
            rid.Value         = x.Roomid;

            SqlParameter time = new SqlParameter();

            time.ParameterName = "@time";
            time.SqlDbType     = System.Data.SqlDbType.DateTime;
            time.Value         = x.Yutime;

            SqlParameter dqtime = new SqlParameter();

            dqtime.ParameterName = "@dqtime";
            dqtime.SqlDbType     = System.Data.SqlDbType.DateTime;
            dqtime.Value         = x.Dqtime;

            SqlParameter notes = new SqlParameter();

            notes.ParameterName = "@notes";
            notes.SqlDbType     = System.Data.SqlDbType.NVarChar;
            notes.Size          = 100;
            notes.Value         = x.Notes;


            SqlParameter id = new SqlParameter();

            id.ParameterName = "@id";
            id.SqlDbType     = System.Data.SqlDbType.Int;
            id.Size          = 32;
            id.Value         = x.Id;
            return(SqlHelper.B_sqlhelper.ExecuteQuery(str, new SqlParameter[] { id, customer, allmoney, phone, cardid, rid, time, dqtime, notes }));
        }
Example #5
0
        private void bbutadd_Click(object sender, EventArgs e)
        {
            if (btxtname.Text != "" && Btxtmoney.Text != null && btxtcardid.Text != "" && btxtphone.Text != "" && bcomroomid.Text != "" && bcomroomtype.Text != "")
            {
                if (this.bcomroomtype.Text == "Single Room".Trim() || bcomroomtype.Text == "Double Room".Trim() || bcomroomtype.Text == "Luxury Room ".Trim() || bcomroomtype.Text == "Three-Bedroom".Trim() || bcomroomtype.Text == "Presidential Room".Trim())
                {
                    string flag2 = BLL.B_bll.selectRoomid(this.bcomroomid.Text);
                    if (flag2 == "Empty")
                    {
                        if (Regex.IsMatch(this.btxtphone.Text, rgphone))
                        {
                            if (Regex.IsMatch(this.btxtcardid.Text, rgcardid) || Regex.IsMatch(this.btxtcardid.Text, rgcardid1))
                            {
                                if (this.bdqtime.Value > this.btxttime.Value)
                                {
                                    bool flag1 = BLL.B_bll.selectcarid(this.btxtcardid.Text.ToString());
                                    if (!flag1)
                                    {
                                        Boxcs bx = new Boxcs();
                                        bx.Name   = this.btxtname.Text.ToString();
                                        bx.Money  = double.Parse(this.Btxtmoney.Text);
                                        bx.Phone  = this.btxtphone.Text.ToString();
                                        bx.Cardid = this.btxtcardid.Text.ToString();
                                        bx.Yutime = this.btxttime.Text.ToString();
                                        bx.Dqtime = this.bdqtime.Text.ToString();
                                        bx.Roomid = int.Parse(bcomroomid.Text);
                                        bx.Notes  = this.btxtnotes.Text.ToString();
                                        bool flag = new BLL.B_bll().addExecuteQuery(bx);
                                        if (!flag)
                                        {
                                            MessageBox.Show("Add Failed");
                                        }
                                        else
                                        {
                                            MessageBox.Show("Add Successful");
                                            bool bflag = new BLL.B_bll().updataR_status(int.Parse(bcomroomid.Text.ToString()));
                                            clear();
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("IC No repeated!!!");
                                        this.btxtcardid.Text = "";
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Ceeck out must greater than Check in!!");
                                }
                            }
                            else
                            {
                                MessageBox.Show("IC Wrong!!!");
                                this.btxtcardid.Text = "";
                            }
                        }
                        else
                        {
                            MessageBox.Show("Contact No Wrong!!!!");
                            this.btxtphone.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Room No Wrong!");
                    }
                }



                else
                {
                    MessageBox.Show("Room Type Wrong!!");
                    this.bcomroomtype.Text = "";
                }
            }

            else
            {
                MessageBox.Show("No Empty Field!!");
            }
            dataGridView1.Columns.Clear();
            DataSet ds = new DataSet();

            ds = BLL.B_bll.dataread();
            dgv();
            dataGridView1.DataSource = ds.Tables[0];
        }
Example #6
0
        private void bbutupdate_Click(object sender, EventArgs e)
        {
            if (this.btxtcardid.Text != "")
            {
                if (btxtname.Text != "" && Btxtmoney.Text != null && btxtcardid.Text != "" && btxtphone.Text != "" && bcomroomid.Text != "" && bcomroomtype.Text != "")
                {
                    if (this.bcomroomtype.Text == "Single Room".Trim() || bcomroomtype.Text == "Double Room".Trim() || bcomroomtype.Text == "Luxury Room ".Trim() || bcomroomtype.Text == "three-Bedroom".Trim() || bcomroomtype.Text == "Presidential Room".Trim())
                    {
                        string flag2 = BLL.B_bll.selectRoomid(this.bcomroomid.Text);
                        if (flag2 == "Empty Room    ")
                        {
                            if (Regex.IsMatch(this.btxtphone.Text, rgphone))
                            {
                                if (Regex.IsMatch(this.btxtcardid.Text, rgcardid) || Regex.IsMatch(this.btxtcardid.Text, rgcardid1))
                                {
                                    if (this.bdqtime.Value > this.btxttime.Value)
                                    {
                                        Boxcs bx = new Boxcs();
                                        bx.Id     = int.Parse(this.Btxtid.Text);
                                        bx.Name   = this.btxtname.Text.ToString();
                                        bx.Money  = double.Parse(this.Btxtmoney.Text);
                                        bx.Phone  = this.btxtphone.Text.ToString();
                                        bx.Cardid = this.btxtcardid.Text.ToString();
                                        bx.Yutime = this.btxttime.Text.ToString();
                                        bx.Dqtime = this.bdqtime.Text.ToString();
                                        bx.Roomid = int.Parse(bcomroomid.Text);
                                        bx.Notes  = this.btxtnotes.Text.ToString();
                                        DialogResult dr = MessageBox.Show("Confirm Change!!!", "Remind", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                                        if (dr == DialogResult.Yes)
                                        {
                                            bool flag = new BLL.B_bll().updateExecuteQuery(bx);
                                            if (!flag)
                                            {
                                                MessageBox.Show("Change Failed");
                                            }
                                            else
                                            {
                                                MessageBox.Show("Change Successful");
                                            }
                                            clear();
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("Validation data must Greater than Booking date!!");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("IC No Wrong!!!");
                                    this.btxtcardid.Text = "";
                                }
                            }
                            else
                            {
                                MessageBox.Show("Contact No Wrong");
                                this.btxtphone.Text = "";
                            }
                        }
                        else
                        {
                            MessageBox.Show("Room No Wrong!");
                        }
                    }

                    else
                    {
                        MessageBox.Show("Room Type Wrong!!!");
                        this.bcomroomtype.Text = "";
                    }
                }
                else
                {
                    MessageBox.Show("No Empty Field!!!!");
                }
                dataGridView1.Columns.Clear();
                DataSet ds = new DataSet();
                ds = BLL.B_bll.dataread();
                dgv();
                dataGridView1.DataSource = ds.Tables[0];
            }
            else
            {
                MessageBox.Show("Pls select to change !!!!");
            }
        }