예제 #1
0
        private void btnascertaintwo_Click(object sender, EventArgs e)
        {
            AutoId dx         = new AutoId();
            string id         = dx.GetId("C_id", "CashManage");
            string admin      = txtxiaban.Text;
            string jiaobanhou = txtxiabanqian.Text;

            sumone = sumone + double.Parse(jiaobanhou);
            string jiaobanqian = "0";
            string jiebandate  = dateTimetwo.Text;

            //在交班表里添加一天下班记录

            string   sqlone = string.Format("insert into CashManage (C_Id,A_AdminId,C_sum,jiaobanhou,jiebanqian,jiebanDate) values('{0}','{1}','{2}','{3}','{4}','{5}')", id, admin, sumone, jiaobanhou, jiaobanqian, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            DBHelper dr     = new DBHelper();
            int      count  = dr.UpdateDeleteAdd(sqlone);

            if (count > 0)
            {
                MessageBox.Show("下班成功~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                IsAwoke.isExit = true;
                Application.Exit();
            }
            else
            {
                MessageBox.Show("下班成功~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            //关闭数据库
            dr.GetClose();
        }
예제 #2
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            DBHelper db = null;

            try
            {
                AutoId ai = new AutoId();
                rtbAll.Text = rtbAll.Text + "\n" + UserHelper.LoginId + "  " + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "\n" + rtbSelf.Text;

                db = new DBHelper();
                string sql = string.Format("insert into Service values('{0}','{1}','{2}','{3}','{4}','{5}')",
                                           ai.GetId("S_serviceId", "Service"), U_UsersId, UserHelper.LoginId, rtbSelf.Text, "未读", DateTime.Now.ToString("yyyy-MM-dd HH:mm")
                                           );
                //MessageBox.Show(sql);
                if (db.UpdateDeleteAdd(sql) <= 0)
                {
                    MessageBox.Show("发送失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    rtbSelf.Text = "";
                }
                rtbSelf.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #3
0
        private void btnEnsure_Click(object sender, EventArgs e)
        {
            AutoId ai = new AutoId();

            if (ValidateInput())
            {
                string   sql;
                DBHelper db = null;
                try
                {
                    db = new DBHelper();
                    string Room_id = cboNewHouse.Text.Substring(0, cboNewHouse.Text.IndexOf(" "));
                    string R_id    = hh.GetR_id(Room_id);
                    sql = string.Format("Update Guest set R_id='{0}',Bookleave='{1}',comeDate='{3}' where G_GuestId='{2}'", R_id, dtpBookLeave.Text, lblOldDate.Tag, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                    if (db.UpdateDeleteAdd(sql) > 0)
                    {
                        if (hh.IshaveBook(cboOldHouse.Text))
                        {
                            sql = string.Format("update Room set State ='{0}' where R_id='{1}'", "预订", hh.GetR_id(cboOldHouse.Text));
                        }
                        else
                        {
                            sql = string.Format("update Room set State ='{0}' where R_id='{1}'", "空净", hh.GetR_id(cboOldHouse.Text));
                        }
                        db.UpdateDeleteAdd(sql);

                        sql = string.Format("update Room set State='{0}' where R_id='{1}'", "待客", R_id);
                        db.UpdateDeleteAdd(sql);


                        sql = string.Format("insert into Consume values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                                            ai.GetId("C_ConsumeId", "Consume"), lblOldDate.Tag, "换房消费", lblOldPrice.Text, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "房间消费", UserHelper.LoginId, txtRemark.Text
                                            );
                        db.UpdateDeleteAdd(sql);

                        MessageBox.Show("换房成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("换房失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    db.GetClose();
                }
            }
        }
예제 #4
0
        //写入商品消费表中
        private void Consume()
        {
            string      G_GuestId = "";
            AutoId      ai        = new AutoId();      //自动生成id  辅助类
            HouseHelper hh        = new HouseHelper(); //辅助类
            DBHelper    db        = null;              //连数据库类

            db = new DBHelper();
            try
            {
                string sql;
                string C_ConsumeId;
                string R_id = hh.GetR_id(cboRoomId.Text);

                sql = string.Format("select G_GuestId from Guest where R_id='{0}' and faceDate='{1}'", R_id, "");
                SqlDataReader sdr = db.SelectAll(sql);
                if (sdr.Read())
                {
                    G_GuestId = sdr["G_GuestId"].ToString();
                }
                sdr.Close();
                int rows = 0;
                //循环写入
                for (int i = 0; i < lvSelect.Items.Count; i++)
                {
                    C_ConsumeId = ai.GetId("C_ConsumeId", "Consume");
                    sql         = string.Format("insert into Consume values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                                                C_ConsumeId, G_GuestId, lvSelect.Items[i].SubItems[0].Text, lvSelect.Items[i].SubItems[2].Text, lvSelect.Items[i].SubItems[3].Text,
                                                DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "商品消费", UserHelper.LoginId, "");
                    //MessageBox.Show(sql);
                    rows = db.UpdateDeleteAdd(sql);
                }

                if (rows > 0)
                {
                    MessageBox.Show("消费成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("消费失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #5
0
        private void Underwrite()
        {
            AutoId   ai = new AutoId();
            DBHelper db = null;
            string   sql;

            try
            {
                db = new DBHelper();
                if (type == 0)
                {
                    sql = string.Format("insert into Underwrite values('{0}','{1}','{2}')",
                                        ai.GetId("U_Id", "Underwrite"), txtUnderwrite.Text, txtRemark.Text);
                }
                else
                {
                    sql = string.Format("update Underwrite set Underwrite='{0}',Remark='{1}' where U_Id='{2}'", txtUnderwrite.Text, txtRemark.Text, listStr[0]);
                }
                if (db.UpdateDeleteAdd(sql) > 0)
                {
                    if (chkBatch.Checked)
                    {
                        txtUnderwrite.Text = "";
                        txtRemark.Text     = "";
                        txtUnderwrite.Focus();
                    }
                    else
                    {
                        MessageBox.Show("操作成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("添操作失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #6
0
        //添加提醒
        private void AddAwoke()
        {
            AutoId   ai        = new AutoId();
            string   A_AwokeId = ai.GetId("A_AwokeId", "Awoke");
            DBHelper db        = null;
            string   sql;

            try
            {
                //MessageBox.Show(dtpDate.Text);
                db = new DBHelper();
                //如果是0,则是添加语句  //否则是修改
                if (type == 0)
                {
                    sql = string.Format("insert into Awoke values('{0}','{1}','{2}','{3}','{4}')",
                                        A_AwokeId, txtA_content.Text, cboState.Text, dtpDate.Text, txtRemark.Text
                                        );
                }
                else
                {
                    sql = string.Format("update Awoke set A_content='{0}',State='{1}',Date='{2}',Remark='{3}' where A_AwokeId='{4}'",
                                        txtA_content.Text, cboState.Text, dtpDate.Text, txtRemark.Text, listString[0]
                                        );
                }

                if (db.UpdateDeleteAdd(sql) > 0)
                {
                    MessageBox.Show("操作成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("操作失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #7
0
        //ok按钮
        private void btnOk_Click(object sender, EventArgs e)
        {
            //验证输入是否为空
            if (!ValidateInput())
            {
                return;
            }

            //验证总和当中是否有这么多金额
            if (!haveMoney())
            {
                MessageBox.Show("金额小于支出", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            AutoId ai = new AutoId();

            DBHelper db = null;

            try
            {
                db = new DBHelper();
                string sql = string.Format("insert into defray values('{0}','{1}','{2}','{3}','{4}','{5}')", ai.GetId("D_defrayId", "defray"), (0 - Math.Abs(Convert.ToDouble(txtPrice.Text))), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtC_type.Text, UserHelper.LoginId, "");
                //MessageBox.Show(sql);
                int rows = db.UpdateDeleteAdd(sql);
                if (rows > 0)
                {
                    MessageBox.Show("支出成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("支出失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #8
0
        //插入方法
        private void Feedback()
        {
            AutoId   ai = new AutoId();
            DBHelper db = null;

            try
            {
                db = new DBHelper();
                string sql = string.Format("insert into LeaveWord values('{0}','{1}','{2}','{3}','{4}')",
                                           ai.GetId("L_LeaveWordId", "LeaveWord"), txtName.Text, rtbContent.Text, "", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                int rows = db.UpdateDeleteAdd(sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #9
0
        private void lvBookHouse_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                //双击已预定的房间 跳到解除预定中 并更改数据库
                ListViewItem list    = this.lvBookHouse.SelectedItems[0];
                string       listone = list.SubItems[0].Text;
                string       money   = list.Tag.ToString();

                DBHelper db = null;
                db = new DBHelper();
                AutoId ai  = new AutoId();
                string sql = string.Format("insert into Consume values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", ai.GetId("C_ConsumeId", "Consume"), 0000, "房间费用", money, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "房间费用", UserHelper.LoginId, "");
                //string sql = string.Format("insert into Consume values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", ai.GetId("C_ConsumeId",));

                db.UpdateDeleteAdd(sql);

                sql = string.Format("update room set state='空净' where r_roomid='{0}'", listone);
                string   sqlone = string.Format("update book set state='解除预订' where room_id='{0}'", listone);
                DBHelper dx     = new DBHelper();
                dx.UpdateDeleteAdd(sql);

                //关闭数据库
                dx.GetClose();
                DBHelper dr = new DBHelper();
                dr.UpdateDeleteAdd(sqlone);

                //关闭数据库
                dr.GetClose();
                this.lvBookHouse.Items.Remove(list);
                lvUnchainBook.Items.Add(list);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #10
0
        //记录日志
        private void AnnalLog()
        {
            AutoId   ai = new AutoId();
            DBHelper db = null;

            try
            {
                db = new DBHelper();
                string L_LoginLogId = ai.GetId("L_LoginLogId", "LoginLog");
                UserHelper.L_LoginLogId = L_LoginLogId;
                string sql = string.Format("insert into LoginLog (L_LoginLogId,L_AdminId,LoginDate) values('{0}','{1}','{2}')",
                                           L_LoginLogId, txtLoginId.Text.Trim(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                                           );
                db.UpdateDeleteAdd(sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string name = txtName.Text;
            string sex;
            string userid = txtuserid.Text;

            if (userid == "")
            {
                userid = "";
            }
            if (rdoMan.Checked == true)
            {
                sex = "男";
            }
            else
            {
                sex = "女";
            }
            object certificate     = cboCertificate.SelectedItem;
            string certificateid   = txtCertificateId.Text;
            string linkman         = txtContactTel.Text;
            string address         = txtAddress.Text;
            string AdvanceForegift = txtAdvanceForegift.Text;
            string comedate        = Convert.ToDateTime(dtpComeDate.Text).ToString("yyyy-MM-dd HH:mm");
            string bookleave       = dtpBookleave.Text;
            string remark          = txtRemark.Text;
            int    a        = lvSelectHouse.Items.Count;
            string Operator = UserHelper.LoginId;


            //验证数据库是否为空
            if (!ValidateInput())
            {
                return;
            }

            certificate = certificate.ToString();

            //循环添加数据到预定表

            while (a > 0)
            {
                //预定多个房间的时候 钱全放在第一个房间里面` 其余的都为0
                if (a == 1)
                {
                    AdvanceForegift = txtAdvanceForegift.Text;
                }
                else
                {
                    AdvanceForegift = "0.000";
                }
                AutoId       dx      = new AutoId();
                string       id      = dx.GetId("B_bookid", "book");
                ListViewItem list    = lvSelectHouse.Items[a - 1];
                string       listone = list.SubItems[0].Text;

                //通过房间号找房间编号
                string        sqlont = string.Format("select r_id from room where room.R_RoomId={0}", listone);
                DBHelper      dr     = new DBHelper();
                SqlDataReader data   = dr.SelectAll(sqlont);
                data.Read();
                int rid = int.Parse(data[0].ToString());

                //关闭数据库
                dr.GetClose();
                DBHelper du = new DBHelper();

                //添加一条数据到预定表
                string sql = string.Format("insert into  book (B_BookId,r_id,Room_id,State,comeDate,Bookleave,Operator,Uname,CertificateType,CertificateID,Address,Usex,contactTel,remark,AdvanceForegift,U_UserId) values ('{0}',{1},'{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}')", id, rid, listone, "预订", comedate, bookleave, Operator, name, certificate, certificateid, address, sex, linkman, remark, AdvanceForegift, userid);
                du.UpdateDeleteAdd(sql);

                //关闭数据库
                du.GetClose();
                a--;
            }


            MessageBox.Show("预定成功~!");
            //关闭窗口
            this.Close();
        }
예제 #12
0
        //入住酒店
        private void House()
        {
            int count = lvSelectHouse.Items.Count;

            if (IsAwoke.foregiftSmall == "1")
            {
                double money = 0;
                for (int i = 0; i < count; i++)
                {
                    money += Convert.ToDouble(lvSelectHouse.Items[i].SubItems[2].Text);
                }
                if (Convert.ToDouble(txtAdvanceForegift.Text) < money && txtCust.Text == "")
                {
                    MessageBox.Show("押金小于房款!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtAdvanceForegift.Focus();
                    txtAdvanceForegift.SelectAll();
                    return;
                }
            }
            int rows = 0;


            for (int i = 0; i < count; i++)
            {
                AutoId auto = new AutoId();

                string G_GuestId = auto.GetId("G_GuestId", "Guest");
                //MessageBox.Show(G_GuestId);
                string Room_id = lvSelectHouse.Items[i].SubItems[0].Text;

                string R_id = lvSelectHouse.Items[i].Tag.ToString();

                string uName = txtName.Text;
                string sex   = "";
                if (rdoMan.Checked)
                {
                    sex = "男";
                }
                else
                {
                    sex = "女";
                }

                string CertificateType = cboCertificate.Text;
                string CertificateID   = txtCertificateId.Text;
                string CertificatePic  = picName;
                string Address         = txtAddress.Text;
                string contactTel      = txtContactTel.Text;
                string Underwrite      = "";
                string comeDate        = dtpComeDate.Text;
                string Bookleave       = dtpBookleave.Text;
                string faceDate        = "";
                string R_price         = lvSelectHouse.Items[i].SubItems[2].Text;
                string Due             = "";
                string Fact            = "";
                string locate          = "";
                string Operator        = UserHelper.LoginId;
                string remark          = txtRemark.Text;
                string U_UserId        = txtCust.Text;

                string sql = string.Format("insert into Guest values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}')",
                                           G_GuestId, R_id, U_UserId, uName, sex, CertificateType, CertificateID, CertificatePic, Address, contactTel, 0, Underwrite,
                                           comeDate, Bookleave, faceDate, R_price, Due, Fact, locate, Operator, remark
                                           );
                DBHelper db = null;

                try
                {
                    db   = new DBHelper();
                    rows = db.UpdateDeleteAdd(sql);

                    sql = string.Format("update Room set State='{0}', R_Count = R_Count + '{2}'  where R_id ='{1}'", "待客", R_id, 1);
                    //MessageBox.Show(sql);
                    int temp = db.UpdateDeleteAdd(sql);

                    if (cboIsAwoke.Checked)
                    {
                        sql = string.Format("insert into Awoke values('{0}','{1}','{2}','{3}','{4}')",
                                            auto.GetId("A_AwokeId", "Awoke"), lvSelectHouse.Items[i].SubItems[0].Text + "号房到期", "未读", dtpBookleave.Text, txtRemark.Text
                                            );
                        db.UpdateDeleteAdd(sql);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    db.GetClose();
                }
            }
            HouseHelper Uhh = new HouseHelper();

            string URoom_id = lvSelectHouse.Items[0].SubItems[0].Text;

            string R_id2 = Uhh.GetR_id(lvSelectHouse.Items[0].Text);

            DBHelper Udb  = null;
            string   Usql = string.Format("update Guest set AdvanceForegift='{0}' where R_id='{1}'", txtAdvanceForegift.Text, R_id2);

            Udb = new DBHelper();
            Udb.UpdateDeleteAdd(Usql);

            if (rows > 0)
            {
                MessageBox.Show("入住成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("入住失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #13
0
        //合并
        private void Unite()
        {
            string roomId;

            string price;
            string G_GuestId;

            DBHelper    db = null;
            HouseHelper hh = new HouseHelper();
            AutoId      ai = new AutoId(); //自动生成id类

            db = new DBHelper();
            string sql = "";


            //大量申明
            string U_UserId        = "";
            string Uname           = "";
            string Sex             = "";
            string CertificateType = "";
            string CertificateID   = "";
            string CertificatePic  = "";
            string Address         = "";
            string contactTel      = "";
            string Underwrite      = "";
            string comeDate        = "";
            string Bookleave       = "";
            string faceDate        = "";
            string Due             = "";
            string Fact            = "";
            string locate          = "";
            string Operator        = UserHelper.LoginId;
            string remark          = "";

            string R_id = hh.GetR_id(cboNewHouse.Text);

            MessageBox.Show(R_id);
            sql = string.Format("select * from Guest where R_id = '{0}' and faceDate = '{1}' ", R_id, "");
            SqlDataReader sdr = db.SelectAll(sql);

            if (sdr.Read())
            {
                U_UserId        = sdr["U_UserId"].ToString();
                Uname           = sdr["Uname"].ToString();
                Sex             = sdr["Sex"].ToString();
                CertificateType = sdr["CertificateType"].ToString();
                CertificateID   = sdr["CertificateID"].ToString();
                CertificatePic  = sdr["CertificatePic"].ToString();
                Address         = sdr["Address"].ToString();
                contactTel      = sdr["contactTel"].ToString();
                Underwrite      = sdr["Underwrite"].ToString();
                comeDate        = dtpComeDate.Text;
                Bookleave       = dtpBookleave.Text;
                faceDate        = "";
            }

            sdr.Close();
            int rows = 0;

            for (int i = 0; i < lvSelectHouse.Items.Count; i++)
            {
                G_GuestId = ai.GetId("G_GuestId", "Guest");
                roomId    = hh.GetR_id(lvSelectHouse.Items[i].SubItems[0].Text);
                price     = lvSelectHouse.Items[i].SubItems[2].Text;

                //MessageBox.Show(Uname.ToString());

                sql = string.Format("insert into Guest values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}')",
                                    G_GuestId, roomId, U_UserId, Uname, Sex, CertificateType, CertificateID, CertificatePic, Address, contactTel, txtAdvanceForegift.Text, Underwrite,
                                    comeDate, Bookleave, faceDate, price, Due, Fact, locate, Operator, remark
                                    );
                rows = db.UpdateDeleteAdd(sql);
                sql  = string.Format("update Room set State='{0}' where R_id='{1}'", "待客", hh.GetR_id(lvSelectHouse.Items[i].SubItems[0].Text));
                db.UpdateDeleteAdd(sql);
            }

            if (rows > 0)
            {
                MessageBox.Show("合并成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("合并失败!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #14
0
        //显示消费信息
        private void ShowWareInfo()
        {
            double money = 0;

            lblMoney.Text = "0";
            //lblOldPrice.Text = "0";
            SqlDataReader sdr = null;
            DBHelper      db  = null;

            try
            {
                db = new DBHelper();
                //MessageBox.Show(this.lblOldDate.Tag.ToString());

                string sql = string.Format("select * from Consume where G_GuestId = '{0}'", this.lblOldDate.Tag);

                sdr = db.SelectAll(sql);
                while (sdr.Read())
                {
                    money += Convert.ToDouble(sdr["Price"].ToString()) * Convert.ToDouble(sdr["C_Count"].ToString());
                }
                this.lblMoney.Text = money.ToString();

                //计算相差的时间,如果大于忽略时间,则写入消费列表中
                // MessageBox.Show(lblOldDate.Text);
                db  = new DBHelper();
                sql = string.Format("select * from guest where G_GuestId = '{0}'", lblOldDate.Tag);
                sdr = db.SelectAll(sql);
                string oldDate = "";
                if (sdr.Read())
                {
                    oldDate = sdr["comeDate"].ToString();
                }

                TimeSpan ts  = DateTime.Now - Convert.ToDateTime(oldDate);
                int      min = Convert.ToInt32(ts.TotalMinutes);



                AutoId ai = new AutoId();
                if (IsAwoke.IgnoreTime < min)
                {
                    string morn = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    string mornHouse = DateTime.Now.ToString("HH:mm:ss");

                    ts = Convert.ToDateTime(morn) - Convert.ToDateTime(Convert.ToDateTime(lblOldDate.Text).ToString("yyyy-MM-dd HH:mm:ss"));
                    //MessageBox.Show(ts.Days.ToString());
                    double temp = 0;
                    if (ts.Days <= 0)
                    {
                        temp++;
                    }
                    else if (Convert.ToDateTime(mornHouse) > Convert.ToDateTime("12:00:00"))
                    {
                        temp = temp + ts.Days + 1;
                    }
                    if (Convert.ToDateTime(mornHouse) <= Convert.ToDateTime("12:00:00"))
                    {
                        temp = temp + ts.Days;   //相差天数
                    }



                    money += Convert.ToDouble(lblOldPrice.Text) * temp;
                }
                sdr.Close();
                this.lblMoney.Text = money.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #15
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //循环将数据添加到数据库中
            try
            {
                for (int i = 0; i < lvFitoutHouse.Items.Count; i++)
                {
                    AutoId dd     = new AutoId();
                    string id     = dd.GetId("G_GuestId", "guest");
                    string jk     = lvFitoutHouse.Items[i].SubItems[0].Text;
                    string bookid = lvFitoutHouse.Items[i].Tag.ToString();
                    //通过预定的编号查找登陆的id
                    string        sqltwo = string.Format("select U_UserId from book where B_BookId='{0}'", bookid);
                    DBHelper      dk     = new DBHelper();
                    SqlDataReader dl     = dk.SelectAll(sqltwo);
                    string        userid = "";
                    if (dl.Read())
                    {
                        userid = dl["U_UserId"].ToString();
                    }

                    //关闭数据库
                    dk.GetClose();

                    //通过房间号查找房间编号
                    string        sql = string.Format("select r_id from room where r_roomid='{0}'", jk);
                    DBHelper      dx  = new DBHelper();
                    SqlDataReader dr  = dx.SelectAll(sql);
                    dr.Read();
                    string rid = dr[0].ToString();

                    //关闭数据库
                    dx.GetClose();
                    string name            = lvFitoutHouse.Items[i].SubItems[4].Text;
                    string sex             = lvFitoutHouse.Items[i].SubItems[5].Text;
                    string comeDate        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    string Bookleave       = lvFitoutHouse.Items[i].SubItems[2].Text;
                    string AdvanceForegift = lvFitoutHouse.Items[i].SubItems[3].Text;

                    //将数据添加到入住表中
                    string   sqlone = string.Format("insert into guest ( G_GuestId,R_id,Uname,Sex,comeDate,Bookleave,AdvanceForegift,U_UserId) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", id, rid, name, sex, comeDate, Convert.ToDateTime(Bookleave).ToString("yyyy-MM-dd HH:mm:ss"), AdvanceForegift, userid);
                    DBHelper dp     = new DBHelper();
                    dp.UpdateDeleteAdd(sqlone);

                    //关闭数据库
                    dp.GetClose();
                }
                MessageBox.Show("入住成功~!");
            }
            catch (Exception ex)
            {
                //MessageBox.Show("添加数据出错~!");
                MessageBox.Show(ex.Message);
                return;
            }
            finally
            {
                //关闭窗口
                this.Close();
            }
        }
예제 #16
0
        //OK按钮
        private void btnTransact_Click(object sender, EventArgs e)
        {
            if (!ValidateInput())
            {
                return;
            }
            if (lvNeedHouse.Items.Count <= 0)
            {
                MessageBox.Show("您没选任何房间!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            HouseHelper hh    = new HouseHelper();
            AutoId      auto  = new AutoId();
            int         count = lvNeedHouse.Items.Count;

            string   room_id;
            string   type;
            string   r_type;
            double   R_price;
            int      rows = 0;
            DBHelper db   = null;

            try
            {
                db = new DBHelper();
                if (IsAwoke.foregiftSmall == "1")
                {
                    double money = 0;
                    for (int i = 0; i < count; i++)
                    {
                        money += Convert.ToDouble(lvNeedHouse.Items[i].SubItems[2].Text);
                    }
                    if (Convert.ToDouble(txtAdvanceForegift.Text) < money && txtCust.Text == "")
                    {
                        MessageBox.Show("押金小于房款!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }


                for (int i = 0; i < count; i++)
                {
                    string G_GuestId = auto.GetId("G_GuestId", "Guest");
                    room_id = lvNeedHouse.Items[i].SubItems[0].Text;
                    type    = lvNeedHouse.Items[i].SubItems[1].Text;
                    r_type  = lvNeedHouse.Items[i].SubItems[2].Text;
                    R_price = Convert.ToDouble(lvNeedHouse.Items[i].SubItems[2].Text);

                    string R_id = hh.GetR_id(room_id);

                    string cust            = txtCust.Text;
                    string Uname           = txtName.Text;
                    string sex             = rdoMan.Checked ? "南" : "女";
                    string CertificateType = cboCertificate.Text;
                    string CertificateID   = txtCertificateId.Text;
                    string Address         = txtAddress.Text;
                    string contactTel      = txtContactTel.Text;
                    string AdvanceForegift = txtAdvanceForegift.Text;
                    string Underwrite      = "";
                    string comeDate        = dtpComeDate.Text;
                    string Bookleave       = dtpBookleave.Text;
                    string faceDate        = "";
                    string Due             = "";
                    string Fact            = "";
                    string locate          = "";
                    string Operator        = UserHelper.LoginId;
                    string remark          = txtRemark.Text;

                    string sql = string.Format("insert into Guest values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}')",
                                               G_GuestId, R_id, cust, Uname, sex, CertificateType, CertificateID, picName, Address, contactTel, 0, Underwrite, comeDate, Bookleave, faceDate, R_price, Due, Fact, locate, Operator, remark
                                               );


                    rows = db.UpdateDeleteAdd(sql);

                    sql = string.Format("update Room set State='{0}', R_Count = R_Count + '{2}'  where R_id ='{1}'", "待客", R_id, 1);

                    db.UpdateDeleteAdd(sql);


                    if (cboIsAwoke.Checked)
                    {
                        sql = string.Format("insert into Awoke values('{0}','{1}','{2}','{3}','{4}')",
                                            auto.GetId("A_AwokeId", "Awoke"), lvNeedHouse.Items[i].SubItems[0].Text + "号房到期", "未读", dtpBookleave.Text, txtRemark.Text
                                            );
                        db.UpdateDeleteAdd(sql);
                    }
                }



                HouseHelper Uhh      = new HouseHelper();
                string      URoom_id = txtMainHouse.Text;

                string UR_id = lvNeedHouse.Items[0].Tag.ToString();

                DBHelper Udb  = null;
                string   Usql = string.Format("update Guest set AdvanceForegift='{0}' where R_id='{1}'", txtAdvanceForegift.Text, UR_id);
                Udb = new DBHelper();
                Udb.UpdateDeleteAdd(Usql);

                if (rows > 0)
                {
                    MessageBox.Show("入住成功!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.GetClose();
            }
        }
예제 #17
0
        //退房方法
        private void ExitHouse()
        {
            //判断是否签单
            if (!Underwrite && chkCust.Checked == false)
            {
                if (txtSpare.Text == "")
                {
                    MessageBox.Show("金额不能为空!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //金额不足不能退房
                if (Convert.ToDouble(txtSpare.Text) < 0)
                {
                    MessageBox.Show("金额不足!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtPaicl.SelectAll();
                    txtPaicl.Focus();
                    return;
                }
            }

            if (chkCust.Checked == false)
            {
                if (cboUnderwrite.Text == "" && chkUnderwrite.Checked == true)
                {
                    MessageBox.Show("签单单位不能为空!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            if (!isHaveMoney() && chkUnderwrite.Checked == false && chkCust.Checked == true)
            {
                MessageBox.Show("会员余额不足本次消费!请充值!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (chkCust.Checked == true && txtPass.Text == "")
            {
                txtPass.Focus();
                return;
            }

            //辅助类实例化
            HouseHelper hh = new HouseHelper();

            int      rows = 0; //受影响的行数
            DBHelper db   = null;

            db = new DBHelper();
            string sql;

            //循环修改入住状态为空净
            for (int i = 0; i < lvFitout.Items.Count; i++)
            {
                //获得房间的R_Id
                string R_id = lvFitout.Items[i].SubItems[0].Tag.ToString();
                string time = DateTime.Now.ToString();

                if (hh.IshaveBook(R_id))
                {
                    sql = string.Format("update Room set State ='{0}' where R_id='{1}'", "预订", R_id);
                }
                else
                {
                    sql = string.Format("update Room set State ='{0}' where R_id='{1}'", "整理", R_id);
                }

                //return;

                rows = db.UpdateDeleteAdd(sql);



                sql = string.Format("update Guest set faceDate = '{0}' where R_id = '{1}' and  (faceDate = '{2}' or faceDate is null)", time, R_id, "");
                db.UpdateDeleteAdd(sql);

                if (!Underwrite)
                {
                    //sql = string.Format("update Guest set Fact='{0}' where G_GuestId='{1}'", lblDeal.Text, lvFitout.Items[0].SubItems[0].Text);
                    //MessageBox.Show(sql);
                    //db.UpdateDeleteAdd(sql);

                    if (i == 0)
                    {
                        AutoId ai = new AutoId();

                        string money = Convert.ToString(Convert.ToDouble(lblDeal.Text) * IsAwoke.discount);

                        sql = string.Format("insert Consume values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                                            ai.GetId("C_ConsumeId", "Consume"), lvFitout.Items[0].SubItems[0].Text, "房间消费", money.ToString(), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "1", UserHelper.LoginId, ""
                                            );
                        db.UpdateDeleteAdd(sql);
                    }
                }
                else
                {
                    AutoId ai            = new AutoId();
                    string A_Id          = ai.GetId("A_Id", "UnderwriteAnnal");
                    string Room_id       = lvFitout.Items[i].SubItems[1].Text;
                    string G_GuestId     = lvFitout.Items[i].SubItems[0].Text;
                    string Underwritestr = cboUnderwrite.Text;
                    string U_money       = lvFitout.Items[i].SubItems[7].Text;
                    string State         = "未付";
                    sql = string.Format("insert UnderwriteAnnal values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", A_Id, Room_id, G_GuestId, Underwritestr, U_money, 0, 0, 0, State, Room_id + "号房费");
                    db.UpdateDeleteAdd(sql);

                    if (i == 0)
                    {
                        sql = string.Format("update UnderwriteAnnal set U_money = U_money - '{0}' where G_GuestId='{1}'", Convert.ToDouble(lblYaJin.Text), G_GuestId);
                        db.UpdateDeleteAdd(sql);
                    }
                }
            }

            //如果是签单
            if (Underwrite)
            {
                for (int i = 0; i < lvConsume.Items.Count; i++)
                {
                    AutoId ai            = new AutoId();
                    string A_Id          = ai.GetId("A_Id", "UnderwriteAnnal");
                    string Room_id       = lvFitout.Items[0].SubItems[1].Text;
                    string G_GuestId     = lvFitout.Items[0].SubItems[0].Text;
                    string Underwritestr = cboUnderwrite.Text;
                    string U_money       = lvConsume.Items[i].SubItems[4].Text;
                    string State         = "未付";
                    string Remark        = lvConsume.Items[i].SubItems[0].Text;
                    sql = string.Format("insert UnderwriteAnnal values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", A_Id, Room_id, G_GuestId, Underwritestr, U_money, 0, 0, 0, State, Remark);
                    db.UpdateDeleteAdd(sql);
                }
            }

            //判断是否是会员
            if (chkCust.Checked)
            {
                db = new DBHelper();
                double score = Convert.ToDouble(lblDeal.Text) / 100;
                sql = string.Format("update Users set Score = Score + '{0}',U_money = U_money -'{1}' where U_UsersId='{2}' ", score, lblDeal.Text, lblU_UserId.Text);
                db.UpdateDeleteAdd(sql);
            }


            if (rows > 0)
            {
                MessageBox.Show("退房成功", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("退房失败", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #18
0
        private void bntascertainone_Click(object sender, EventArgs e)
        {
            string jieban      = txtid.Text;
            string jiebanpwd   = txtpwd.Text;
            string jiaobanqian = txtjiebanqian.Text;
            string jiebanqian  = txtjiaobanqian.Text;

            //判断控件为非空

            if (jieban == "" || jiaobanqian == "" || jiebanpwd == "")
            {
                MessageBox.Show("接班人帐号、密码与接班金额不能为空``", "温馨提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //验证输入的帐号密码是否正确

            string   sql   = string.Format("select count(*) from admin where A_AdminId='{0}' and Password='******'", jieban, jiebanpwd);
            DBHelper dr    = new DBHelper();
            double   count = dr.SelectOne(sql);

            if (count <= 0)
            {
                MessageBox.Show("请输入正确的接班人帐号与密码~!");
                return;
            }
            dr.GetClose();
            AutoId dx         = new AutoId();
            string id         = dx.GetId("C_id", "CashManage");
            string admin      = txtid.Text;
            string jiaobanhou = txtjiaobanqian.Text;
            string jiebandate = dateTime.Text;

            //判断输入的是否都为数字
            try
            {
                double jiebanqianone = Convert.ToDouble(jiaobanqian);
            }
            catch
            {
                MessageBox.Show("接班金额只能是数字~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }


            // 判断是否为空
            if (double.Parse(jiaobanqian) < 0)
            {
                MessageBox.Show("金额必须为非负数~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //判断交班时的金额是否相等

            if (jiaobanqian != jiebanqian)
            {
                DialogResult result =
                    MessageBox.Show("接班金额与实际应有金额有差异~!是否交易`?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                txtjiebanqian.SelectAll();
                txtjiebanqian.Focus();
                return;
            }

            //在交班表里添加一条交班记录
            string sqlone = string.Format("insert into CashManage (C_Id,A_AdminId,C_sum,jiaobanhou,jiebanqian,jiebanDate) values('{0}','{1}','{2}','{3}','{4}','{5}')", id, admin, sumone, jiaobanhou, jiaobanqian, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            MessageBox.Show(sqlone);
            DBHelper de       = new DBHelper();
            int      countone = de.UpdateDeleteAdd(sqlone);

            if (countone > 0)
            {
                MessageBox.Show("交班成功~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                IsAwoke.isExit = true;
                this.Close();
                mf.Close();
                LoginForm lf = new LoginForm(this.txtid.Text, this.txtpwd.Text);
                lf.Show();
            }
            else
            {
                MessageBox.Show("交班失败~!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }