Example #1
0
        //创建技师列表
        private void createTechnicianPanel(BathDBDataContext db)
        {
            var tLst = db.Employee.Where(x => db.Job.FirstOrDefault(y => y.id == x.jobId).name.Contains("技师")).ToList();

            if (techTypes.Text != "所有技师")
            {
                tLst = db.Employee.Where(x => db.Job.FirstOrDefault(y => y.id == x.jobId).name == techTypes.Text).ToList();
            }
            tPanel.Controls.Clear();
            int row   = 0;
            int col   = 0;
            int index = 0;
            int count = tLst.Count;

            while (index < count)
            {
                while ((col + 1) * 160 < tPanel.Size.Width && index < count)
                {
                    int x = col * 140 + 20 * (col + 1);
                    int y = row * 110 + 20 * (row + 1);
                    createButton(x, y, tLst[index], tPanel);
                    col++;
                    index++;
                }
                col = 0;
                row++;
            }
        }
Example #2
0
        //添加备注
        private void CtxAddNote_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db_new, LogIn.m_User, "添加备注"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }

            Seat seat = getContextSenderSeat(db_new, sender);

            if (seat.status != 2 && seat.status != 6)
            {
                BathClass.printErrorMsg("手牌未使用,不能添加备注");
                return;
            }

            NoteForm noteForm = new NoteForm();

            if (noteForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            seat.note = noteForm.note;
            db_new.SubmitChanges();
        }
Example #3
0
        private void setStatus()
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db_new, LogIn.m_User, "营业信息查看"))
            {
                statusStrip2.Visible = false;
                return;
            }

            seatTotal.Text = db_new.Seat.Count().ToString();
            seatAvi.Text   = db_new.Seat.Where(x => x.status == 1).Count().ToString();

            DateTime st = DateTime.Parse("2013-1-1 00:00:00");

            if (db_new.ClearTable.Count() != 0)
            {
                st = db_new.ClearTable.ToList().Last().clearTime;
            }
            int    count = 0;
            double pm    = BathClass.get_paid_expense(db_new, st, ref count);

            seatPaid.Text  = count.ToString();
            moneyPaid.Text = pm.ToString();

            seatUnpaid.Text = db_new.Seat.Where(x => x.status == 2 || x.status == 6 || x.status == 7 || x.status == 8).Count().ToString();
            double upm = BathClass.get_unpaid_expense(db_new, LogIn.connectionString);

            moneyUnpaid.Text = upm.ToString();

            moneyTotal.Text = (pm + upm).ToString();
        }
Example #4
0
        //消费录入
        private void orderTool_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db_new, LogIn.m_User, "完整点单") &&
                !BathClass.getAuthority(db_new, LogIn.m_User, "可见本人点单"))
            {
                BathClass.printErrorMsg("权限不够!");
                return;
            }
            List <int> sLst = new List <int>();

            sLst.Add(2);
            sLst.Add(6);

            var inputSeatForm = new InputRoomForm(sLst);

            if (inputSeatForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var seat = db_new.HotelRoom.FirstOrDefault(x => x.text == inputSeatForm.m_Seat.text);

            seat.ordering = true;
            db_new.SubmitChanges();

            var orderForm = new HotelRoomOrderForm(inputSeatForm.m_Seat);

            orderForm.ShowDialog();

            seat.ordering = false;
            db_new.SubmitChanges();
        }
Example #5
0
        private void BtnOk_Click(object sender, EventArgs e)
        {
            bool checkDianLun = CheckerLunDian.Checked;
            bool checkerPaid  = CheckerPaid.Checked;

            var db  = new BathDBDataContext(LogIn.connectionString);
            var ops = db.Options.FirstOrDefault();

            if (checkDianLun && checkerPaid)
            {
                ops.提成报表格式 = FORMAT_ALL_DIANLUN;
            }
            else if (!checkDianLun && !checkerPaid)
            {
                ops.提成报表格式 = FORMAT_INPUTTIME_NODIANLUN;
            }
            else if (checkDianLun && !checkerPaid)
            {
                ops.提成报表格式 = FORMAT_INPUTTIME_DIANLUN;
            }
            else if (!checkDianLun && checkerPaid)
            {
                ops.提成报表格式 = FORMAT_ALL_NODIANLUN;
            }

            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #6
0
 //构造函数
 public MemberPromotionForm(List <HotelRoom> seat, string systemid)
 {
     m_systemId = systemid;
     db         = new BathDBDataContext(LogIn.connectionString);
     m_Seats.AddRange(db.HotelRoom.Where(x => seat.Contains(x)));
     InitializeComponent();
 }
Example #7
0
        //对话框载入
        private void OrderMainForm_Load(object sender, EventArgs e)
        {
            connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP);
            if (connectionIP == "")
            {
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
                connectionIP = pCListForm.ip;
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
            }

            db = new BathDBDataContext(connectionString);

            if (!db.DatabaseExists())
            {
                BathClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                connectionIP = "";
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
                this.Close();
                return;
            }
        }
        //监控台位数据库改变

        /*private void watchSeat()
         * {
         *  if (m_connection == null)
         *      m_connection = new SqlConnection(LogIn.connectionString);
         *
         *  if (m_connection.State != ConnectionState.Open)
         *      m_connection.Open();
         *
         *  SqlCommand cmd = m_connection.CreateCommand();
         *  cmd.Notification = null;//清除
         *  cmd.CommandText = "select id, oId, text, typeId, systemId, openTime, openEmployee, payTime, payEmployee, chainId, status From dbo.Seat";
         *
         *  //监控台位数据库
         *  SqlDependency dependency = new SqlDependency(cmd);
         *  dependency.OnChange += new OnChangeEventHandler(seat_OnChange);
         *
         *  //SqlDependency绑定的SqlCommand对象必须要执行一下,才能将SqlDependency对象的HasChange属性设为true
         *  SqlDataAdapter thisAdapter = new SqlDataAdapter(cmd);
         *  DataSet posDataSet = new DataSet();
         *  thisAdapter.Fill(posDataSet, "Seat");
         *
         *  //刷新台位信息
         *  if (this.WindowState != FormWindowState.Minimized)
         *      update_seats();
         *  //刷新状态栏
         *  setStatus();
         * }
         *
         * private delegate void watchSeatDelegate();
         *
         * //监控台位数据库改变
         * private void seat_OnChange(object sender, SqlNotificationEventArgs e)
         * {
         *  //因为是子线程,需要用invoke方法更新ui
         *  if (this.InvokeRequired)
         *  {
         *      this.Invoke(new watchSeatDelegate(watchSeat), null);
         *  }
         *  else
         *  {
         *      watchSeat();
         *  }
         *
         *  SqlDependency dependency = (SqlDependency)sender;
         *  //通知之后,当前dependency失效,需要重新设置通知
         *  dependency.OnChange -= seat_OnChange;
         * }*/

        //点击台位按钮
        private void btn_Click(object sender, EventArgs e)
        {
            var    db_new = new BathDBDataContext(LogIn.connectionString);
            Button btn    = sender as Button;

            btn.Enabled = false;
            btn.Enabled = true;

            var seat = db_new.Seat.FirstOrDefault(x => x.text == btn.Text);

            switch (seat.status)
            {
            case 2:    //正在使用
            case 6:    //警告
            case 7:    //押金离场
            case 8:    //重新结账
                var            dao       = new DAO(LogIn.connectionString);
                var            s         = dao.get_seat("text='" + seat.text + "'");
                OrderCheckForm orderForm = new OrderCheckForm(s, LogIn.connectionString, LogIn.options);
                orderForm.ShowDialog();
                break;

            default:
                break;
            }
        }
Example #9
0
 //构造函数
 public TableOrderTableForm(string con_str, Employee user)
 {
     m_con_str = con_str;
     m_user    = user;
     db        = new BathDBDataContext(m_con_str);
     InitializeComponent();
 }
Example #10
0
        //刷新线程
        private void update_ui()
        {
            while (true)
            {
                try
                {
                    var db_new = new BathDBDataContext(m_connectionString);
                    var Techs  = db_new.Employee.Where(x => db_new.Job.FirstOrDefault(y => y.id == x.jobId).name.Contains("技师"));
                    if (techTypes.Text != "所有技师")
                    {
                        Techs = db_new.Employee.Where(x => db_new.Job.FirstOrDefault(y => y.id == x.jobId).name == techTypes.Text);
                    }
                    var tech_ids    = Techs.Select(x => x.id).ToList();
                    var tech_status = Techs.Select(x => x.techStatus).ToList();

                    for (int i = 0; i < tech_ids.Count; i++)
                    {
                        var tech = db_new.Employee.FirstOrDefault(x => x.id == tech_ids[i]);
                        var btn  = (Button)tPanel.Controls.Find(tech_ids[i], false).FirstOrDefault();
                        if (btn == null || tech == null)
                        {
                            continue;
                        }
                        var ts = tech_status[i];
                        if ((ts == null || ts == "空闲") && btn.BackColor != avi_color)
                        {
                            this.Invoke(new delegate_change_btn_status(change_btn_status),
                                        new object[] { tech, btn, avi_color });
                        }
                        else if (ts == "下班" && btn.BackColor != off_color)
                        {
                            this.Invoke(new delegate_change_btn_status(change_btn_status),
                                        new object[] { tech, btn, off_color });
                        }
                        else if (ts == "点钟" || ts == "上钟" || ts == "加钟")
                        {
                            Color color = off_color;
                            if (ts == "点钟")
                            {
                                color = order_color;
                            }
                            else if (ts == "上钟")
                            {
                                color = on_color;
                            }
                            else if (ts == "加钟")
                            {
                                color = plus_color;
                            }
                            this.Invoke(new delegate_change_btn_status(change_btn_status),
                                        new object[] { tech, btn, color });
                        }
                    }
                    this.Invoke(new delegate_set_status(set_status), new object[] { db_new });
                }
                catch
                {
                }
            }
        }
Example #11
0
        public static int get_member_balance(BathDBDataContext db, string card_no)
        {
            var cc = db.CardCharge.Where(x => x.CC_CardNo == card_no);

            if (cc.Any())
            {
                double debit    = 0;
                double lend     = 0;
                var    cc_debit = cc.Where(x => x.CC_DebitSum != null);
                if (cc_debit.Any())
                {
                    debit = cc_debit.Sum(x => x.CC_DebitSum).Value;
                }

                var cc_lend = cc.Where(x => x.CC_LenderSum != null);
                if (cc_lend.Any())
                {
                    lend = cc_lend.Sum(x => x.CC_LenderSum).Value;
                }

                return((int)(debit - lend));
            }
            else
            {
                return(0);
            }
        }
Example #12
0
        //全部重排
        private void reArrange_all_techs(BathDBDataContext dc)
        {
            dc.ExecuteCommand("truncate table techindex");
            dc.SubmitChanges();

            var job_ids = dc.Job.Where(x => x.name.Contains("技师")).Select(x => x.id);

            foreach (var job_id in job_ids)
            {
                var techs = dc.Employee.Where(x => x.jobId == job_id);

                techs = techs.Where(x => x.techStatus == null || x.techStatus == "空闲" || x.techStatus == "待钟");

                var techs_male = techs.Where(x => x.gender == "男");
                var techIndex  = new TechIndex();
                techIndex.dutyid = job_id;
                techIndex.gender = "男";
                techIndex.ids    = string.Join("%", techs_male.OrderBy(x => x.id).Select(x => x.id + "=T").ToArray());
                dc.TechIndex.InsertOnSubmit(techIndex);

                var techs_female = techs.Where(x => x.gender == "女");
                techIndex        = new TechIndex();
                techIndex.dutyid = job_id;
                techIndex.gender = "女";
                techIndex.ids    = string.Join("%", techs_female.OrderBy(x => x.id).Select(x => x.id + "=T").ToArray());
                dc.TechIndex.InsertOnSubmit(techIndex);
            }
            dc.SubmitChanges();
        }
Example #13
0
        //重载构造函数
        public InputSeatForm(List <int> ss, string connectionString)
        {
            db           = new BathDBDataContext(connectionString);
            m_StatusList = ss;

            InitializeComponent();
        }
Example #14
0
        public void start()
        {
            var db = new BathDBDataContext(connectionString);
            company_code = db.Options.FirstOrDefault().companyCode;
            if (StringUtil.isEmpty(company_code))
            {
                MessageBox.Show("没有注册公司代码,请联系连客科技注册!");
                return;
            }

            if (thread_clearTable == null)
            {
                thread_clearTable = new Thread(run_clearTable);
                thread_clearTable.IsBackground = true;
            }
            thread_clearTable.Start();

            if (thread_cardsale == null)
            {
                thread_cardsale = new Thread(run_cardSale);
                thread_cardsale.IsBackground = true;
            }
            thread_cardsale.Start();

            if (thread_account == null)
            {
                thread_account = new Thread(run_account);
                thread_account.IsBackground = true;
            }
            thread_account.Start();
        }
Example #15
0
        //设置营业信息状态栏
        private void setStatus()
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db_new, LogIn.m_User, "营业信息查看"))
            {
                statusStrip2.Visible = false;
                return;
            }

            seatTotal.Text = db_new.HotelRoom.Count().ToString();
            seatAvi.Text   = db_new.HotelRoom.Where(x => x.status == 1).Count().ToString();

            int    count = 0;
            double pm    = BathClass.get_paid_expense(db_new, thisTime, ref count);

            seatPaid.Text  = count.ToString();
            moneyPaid.Text = pm.ToString();

            seatUnpaid.Text = db_new.HotelRoom.Where(x => x.status == 2 || x.status == 6 || x.status == 7 || x.status == 8).Count().ToString();
            double upm = BathClass.get_unpaid_expense(db_new, LogIn.connectionString);

            moneyUnpaid.Text = upm.ToString();

            moneyTotal.Text = (pm + upm).ToString();
        }
Example #16
0
        //获取手牌列表消费
        public static double get_seats_expenses(BathDBDataContext db, List <Seat> seats, string connectionString)
        {
            if (seats == null)
            {
                return(0);
            }

            double money = 0;

            var ids    = seats.Select(x => x.systemId);
            var orders = db.Orders.Where(x => ids.Contains(x.systemId) && x.deleteEmployee == null && !x.paid);

            var tmp_orders = orders.Where(x => x.priceType == null || x.priceType == "停止消费");

            if (tmp_orders.Any())
            {
                money = tmp_orders.Sum(x => x.money);
            }

            tmp_orders = orders.Where(x => x.priceType == "每小时");
            if (tmp_orders.Any())
            {
                DateTime now = BathClass.Now(connectionString);
                money += tmp_orders.Sum(x => x.money * Math.Ceiling((now - x.inputTime).TotalHours));
            }

            return(Math.Round(money, 0));
        }
Example #17
0
        //刷新线程
        private void updateTimer_Elapsed(object sender, EventArgs e)
        {
            updateTimer.Stop();
            var db_new    = new BathDBDataContext(LogIn.connectionString);
            var rooms_tmp = db_new.Room.Select(x => x.status).ToList();

            bool changed = false;

            for (int i = 0; i < rooms_tmp.Count; i++)
            {
                if (rooms_tmp[i] != all_rooms[i])
                {
                    var btn  = pr.Controls.Find(all_rooms_id[i].ToString(), false).FirstOrDefault();
                    var btns = btn as Button;

                    var room_tmp = db_new.Room.FirstOrDefault(x => x.id == all_rooms_id[i]);
                    btn.Text = getBtnString(room_tmp);
                    changed  = true;
                }
            }

            if (changed)
            {
                all_rooms = rooms_tmp;
            }

            updateTimer.Start();
        }
Example #18
0
        //开单个牌,用于以刷卡方式
        private void open_one_seat(Seat seat, BathDBDataContext dc)
        {
            if (seat.status == 3)
            {
                BathClass.reset_seat(seat);
                dc.SubmitChanges();
            }

            seat.openEmployee = LogIn.m_User.id.ToString();
            seat.openTime     = BathClass.Now(LogIn.connectionString);
            seat.systemId     = BathClass.systemId(dc, LogIn.connectionString);
            //seat.chainId = chainId;
            seat.status = 2;

            //SeatType seatType = db.SeatType.FirstOrDefault(x => x.id == seat.typeId);
            //var menu = db.Menu.FirstOrDefault(x => x.id == seatType.menuId);

            //if (menu != null)
            //{
            //    Orders order = new Orders();
            //    order.menu = menu.name;
            //    order.text = seat.text;
            //    order.systemId = seat.systemId;
            //    order.number = 1;
            //    order.money = menu.price;
            //    order.inputTime = BathClass.Now(LogIn.connectionString);
            //    order.inputEmployee = LogIn.m_User.id.ToString();
            //    order.paid = false;
            //    dc.Orders.InsertOnSubmit(order);
            //}

            dc.SubmitChanges();
        }
Example #19
0
        //打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                dgv_show();

                var dc = new BathDBDataContext(LogIn.connectionString);
                string companyName = dc.Options.FirstOrDefault().companyName;
                List<string> printColumns = new List<string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

                if (ptTimeList.SelectedIndex == 0)
                {
                    CashPrintTime cpt = new CashPrintTime();
                    cpt.macAdd = macAdd;
                    cpt.time = GeneralClass.Now;
                    dc.CashPrintTime.InsertOnSubmit(cpt);
                    dc.SubmitChanges();
                }

                PrintReceipt.Print_DataGridView(dgv, lastTime.ToString("yyyy-MM-dd HH:mm:ss"), thisTime.ToString("yyyy-MM-dd HH:mm:ss"), companyName);
                BathClass.set_dgv_fit(dgv);
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Example #20
0
        //打印标题
        public static void print_title(System.Drawing.Printing.PrintPageEventArgs e)
        {
            //打印标题
            var    db          = new BathDBDataContext(LogIn.connectionString);
            string companyName = db.Options.FirstOrDefault().companyName;

            int cLeft = (e.PageBounds.Width - str_w(e, 13F, companyName)) / 2;

            print_str(e, companyName, 13F, cLeft, tmpTop);
            tmpTop += str_h(e, 13F, companyName);

            cLeft = (e.PageBounds.Width - str_w(e, 18F, PrintTitle)) / 2;
            e.Graphics.DrawString(PrintTitle, new Font("SimSun", 18F, FontStyle.Bold),
                                  Brushes.Black, cLeft, tmpTop);
            tmpTop += str_h(e, 18F, PrintTitle);

            //打印副标题
            string subTitle = BathClass.Now(LogIn.connectionString).ToString();

            print_str(e, "打印时间:" + subTitle, 10F, e.MarginBounds.Left, tmpTop);

            cLeft = (e.PageBounds.Width - str_w(e, 10F, m_subtitle)) / 2;
            print_str(e, m_subtitle, 10F, cLeft, tmpTop);

            subTitle = "打印员工:" + LogIn.m_User.id + "  " + LogIn.m_User.name;
            int fsize = str_w(e, 10F, subTitle);

            print_str(e, subTitle, 10F, e.MarginBounds.Right - fsize, tmpTop);
            tmpTop += str_h(e, 10F, subTitle);
        }
Example #21
0
        //打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.Rows.Count == 0)
                {
                    dgv_show();
                }

                var           dc           = new BathDBDataContext(LogIn.connectionString);
                string        companyName  = dc.Options.FirstOrDefault().companyName;
                List <string> printColumns = new List <string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;


                PrintReceipt.Print_DataGridView("技师对账单汇总", dgv, lastTime.ToString("yyyy-MM-dd HH:mm:ss"), thisTime.ToString("yyyy-MM-dd HH:mm:ss"), companyName);
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Example #22
0
        //获取夜审时间
        private bool get_clear_table_time()
        {
            var db  = new BathDBDataContext(LogIn.connectionString);
            var lct = db.ClearTable.FirstOrDefault(x => x.clearTime.Date == startDate.Value.Date);

            if (lct == null)
            {
                lct = db.ClearTable.Where(x => x.clearTime < startDate.Value).OrderByDescending(x => x.clearTime).FirstOrDefault();
                if (lct == null)
                {
                    lastTime = DateTime.Parse("2013-01-01");
                }
                else
                {
                    lastTime = lct.clearTime;
                }
            }
            else
            {
                lastTime = lct.clearTime;
            }

            var ct = db.ClearTable.Where(x => x.clearTime.Date >= endDate.Value.AddDays(1).Date).FirstOrDefault();

            if (ct == null)
            {
                thisTime = DateTime.Now;
            }
            else
            {
                thisTime = ct.clearTime;
            }

            return(true);
        }
Example #23
0
        //查询
        private void dgv_show()
        {
            dgv.Rows.Clear();

            var dc             = new BathDBDataContext(LogIn.connectionString);
            var all_his_orders = dc.HisOrders.Where(x => x.inputTime >= lastTime && x.inputTime <= thisTime && x.deleteEmployee == null);
            var orderLst       = dc.Orders.Where(x => x.inputTime >= lastTime && x.inputTime <= thisTime && x.deleteEmployee == null);

            all_his_orders = all_his_orders.Where(x => x.technician != null);
            orderLst       = orderLst.Where(x => x.technician != null);

            if (catgory.Text != "所有类别")
            {
                var catgoryId = dc.Catgory.FirstOrDefault(x => x.name == catgory.Text).id;
                var menus     = dc.Menu.Where(x => x.technician && x.catgoryId == catgoryId).Select(x => x.name);
                orderLst       = orderLst.Where(x => menus.Contains(x.menu));
                all_his_orders = all_his_orders.Where(x => menus.Contains(x.menu));
            }
            foreach (var order in all_his_orders)
            {
                dgv.Rows.Add(order.technician, order.text, order.menu, order.number, order.inputTime.ToString("MM-dd HH:mm"));
            }

            foreach (var order in orderLst)
            {
                dgv.Rows.Add(order.technician, order.text, order.menu, order.number, order.inputTime.ToString("MM-dd HH:mm"));
            }
            BathClass.set_dgv_fit(dgv);
        }
        public EmployeeAuthorityForm(BathDBDataContext dc, Employee employee)
        {
            db         = dc;
            m_Employee = employee;

            InitializeComponent();
        }
Example #25
0
        //对话框载入
        private void BonusTableForm_Load(object sender, EventArgs e)
        {
            db = new BathDBDataContext(LogIn.connectionString);
            var format = db.Options.FirstOrDefault().提成报表格式;

            if (format == null)
            {
                format = FORMAT_ALL_DIANLUN;
                db.SubmitChanges();
            }

            if (format == FORMAT_ALL_DIANLUN)
            {
                CheckerLunDian.Checked = true;
                CheckerPaid.Checked    = true;
            }
            else if (format == FORMAT_ALL_NODIANLUN)
            {
                CheckerLunDian.Checked = false;
                CheckerPaid.Checked    = true;
            }
            else if (format == FORMAT_INPUTTIME_DIANLUN)
            {
                CheckerLunDian.Checked = true;
                CheckerPaid.Checked    = false;
            }
            else if (format == FORMAT_INPUTTIME_NODIANLUN)
            {
                CheckerLunDian.Checked = false;
                CheckerPaid.Checked    = false;
            }
        }
Example #26
0
        //取消开牌
        private void CtxCancelOpen_Click(object sender, EventArgs e)
        {
            BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString);
            HotelRoom         seat   = getContextSenderSeat(db_new, sender);

            cancel_open(db_new, seat);
        }
Example #27
0
        //对话框载入
        private void ReceptionSeatForm_Load(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            this.Text        = "咱家店小二-吧台V2.1 欢迎使用:" + LogIn.m_User.id;
            currentUser.Text = "当前用户:" + LogIn.m_User.id + "  " + LogIn.m_User.name;
            ops = db.Options.FirstOrDefault();
            createRooms(db, roomPanel);

            roomL.Visible   = false;
            btnRoom.Visible = false;

            callL.Visible    = false;
            toolCall.Visible = false;

            toolMsg.Visible = false;
            msgL.Visible    = false;

            toolWarn.Visible = false;
            all_rooms        = db.HotelRoom.Select(x => x.status).ToList();
            all_rooms_id     = db.HotelRoom.Select(x => x.id).ToList();

            m_thread_update_room = new Thread(new ThreadStart(update_rooms_ui));
            m_thread_update_room.Start();
        }
Example #28
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            all_seats    = db.Seat.Select(x => x.status).ToList();
            all_seats_id = db.Seat.Select(x => x.id).ToList();

            this.Text        = "咱家店小二-酒店客房开房系统V2.1 欢迎使用:" + LogIn.m_User.id;
            currentUser.Text = "当前用户:" + LogIn.m_User.id + "  " + LogIn.m_User.name;

            var ops = db.Options.FirstOrDefault();

            seatLock    = ops.启用手牌锁.Value;
            lock_type   = ops.手牌锁类型;
            companyName = ops.companyName;

            get_clear_table_time(db);
            seatPanel = sp.Panel1;
            createSeat(seatPanel);
            setStatus();

            dgv_shoe_show();

            m_thread = new Thread(new ThreadStart(update_seats_ui));
            m_thread.Start();
        }
Example #29
0
        //打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.Rows.Count == 0)
                {
                    dgv_show();
                }

                var           dc           = new BathDBDataContext(LogIn.connectionString);
                string        companyName  = LogIn.options.companyName;
                List <string> printColumns = new List <string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

                string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                PrintReceipt.Print_DataGridView("客房押金表", dgv, now, now, companyName);
                //BathClass.set_dgv_fit(dgv);
                dgv.Rows.Clear();
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Example #30
0
 public static void SubmitChanges(BathDBDataContext db)
 {
     try
     {
         db.SubmitChanges();
     }
     catch
     {
         try
         {
             db.SubmitChanges();
         }
         catch
         {
             try
             {
                 db.SubmitChanges();
             }
             catch
             {
                 db.SubmitChanges();
             }
         }
     }
 }
Example #31
0
 //构造函数
 public CheckForm(Employee user)
 {
     m_User = user;
     db     = new BathDBDataContext(MainForm.connectionString);
     InitializeComponent();
     btnPwd.Text = "修改\n密码";
 }
Example #32
0
        //检测客房催钟消息
        public static string detect_room_call(string roomId, string seatId)
        {
            var db = new BathDBDataContext(connectionString);
            var call = db.RoomCall.FirstOrDefault(x => x.roomId == roomId && x.seatId.Contains(seatId) && !x.read);

            if (call != null && call.msg == "催钟")
                return "true";
            else
                return "false";
        }
Example #33
0
        //检测客房预警信息
        public static string detect_room_warn(string roomId)
        {
            var db = new BathDBDataContext(connectionString);
            if (!db.RoomWarn.Any())
                return "false";

            var warn = db.RoomWarn.Any(x => x.room == null || (x.room != null && !x.room.Contains(roomId)));

            if (warn)
                return "true";
            else
                return "false";
        }
Example #34
0
        //上钟时如果有预约,删除预约
        public static string del_reservation(string roomId, string seatId)
        {
            try
            {
                var db = new BathDBDataContext(connectionString);

                var info = new List<string>();
                var t = db.TechReservation.FirstOrDefault(x => x.roomId == roomId && x.seatId == seatId && !x.proceeded.Value);
                if (t == null)
                    return "null";

                db.TechReservation.DeleteOnSubmit(t);
                db.SubmitChanges();

                return "true";
            }
            catch (System.Exception e)
            {
                return "false";
            }
        }
Example #35
0
        public static string detect_seat(string seatId)
        {
            var db = new BathDBDataContext(connectionString);
            var seat = db.Seat.FirstOrDefault(x => x.text == seatId);
            if (seat == null)
                return "手牌不存在";

            if (seat.status != 2 && seat.status != 6 && seat.status != 7)
                return "手牌不在使用中";

            Room room = null;
            var rooms = db.Room.Where(x => x.seat.Contains(seatId));
            foreach (var r in rooms)
            {
                try
                {
                    var seatIds = r.seat.Split('|').ToList();
                    var status = r.status.Split('|').ToList();
                    int i = seatIds.IndexOf(seatId);
                    if (i != -1 && status[i] != "空闲" && status[i] != "null" && status[i] != "等待清洁")
                    {
                        room = r;
                        break;
                    }
                }
                catch (System.Exception e)
                {

                }
            }

            if (room != null)
                return "房间:" + room.name;

            return "Avilable";
        }
Example #36
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            connectionIP = IOUtil.get_config_by_key(ConfigKeys.KEY_CONNECTION_IP);
            if (connectionIP == "")
            {
                PCListForm pCListForm = new PCListForm();
                if (pCListForm.ShowDialog() != DialogResult.OK)
                {
                    this.Close();
                    return;
                }
                connectionIP = pCListForm.ip;
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
            }

            db = new BathDBDataContext(connectionString);
            if (!db.DatabaseExists())
            {
                GeneralClass.printErrorMsg("连接IP不对或者网络不通,请重试!");
                connectionIP = "";
                IOUtil.set_config_by_key(ConfigKeys.KEY_CONNECTION_IP, connectionIP);
                this.Close();
                return;
            }

            dir = IOUtil.get_config_by_key(ConfigKeys.KEY_VIDEO_SAVE_DIR);
            if (dir == "")
                set_dir();

            if (dir == "")
            {
                this.Close();
                return;
            }
            if (!dir.EndsWith("\\"))
                dir += "\\";

            serverIp.Text = connectionIP;
            cacheDir.Text = dir;
            string pvs = IOUtil.get_config_by_key(ConfigKeys.KEY_VIDEO_TIMESPAN);
            if (pvs != "")
            {
                seconds.Text = pvs;
                ts = TimeSpan.Parse("00:00:" + pvs);
            }
            else
            {
                pvs = "30";
                seconds.Text = pvs;
                ts = TimeSpan.Parse("00:00:" + pvs);
                IOUtil.set_config_by_key(ConfigKeys.KEY_VIDEO_TIMESPAN, pvs);
            }

            db.PayMsg.DeleteAllOnSubmit(db.PayMsg.ToArray());
            db.SubmitChanges();
            video = new cVideo(panel1.Handle, panel1.Width, panel1.Height);
            if (video.StartWebCam())
            {
                video.get();
                video.Capparms.fYield = true;
                video.Capparms.fAbortLeftMouse = false;
                video.Capparms.fAbortRightMouse = false;
                video.Capparms.fCaptureAudio = false;
                video.Capparms.dwRequestMicroSecPerFrame = 0x9C40; // 设定帧率25fps: 1*1000000/25 = 0x9C40
                video.set();
            }

            watch_Timer = new System.Timers.Timer(100);
            watch_Timer.Elapsed += new ElapsedEventHandler(watch_Timer_Elapsed);
            watch_Timer.Start();
            watch_Timer.Enabled = true;
        }
Example #37
0
        //每隔1秒监听一次
        private void watch_Timer_Elapsed(object sender, EventArgs e)
        {
            Thread.CurrentThread.IsBackground = true;
            BathDBDataContext dc = new BathDBDataContext(connectionString);
            if (dc.PayMsg.Count() != 0)
            {
                watch_Timer.Interval = ts.Seconds * 1000;
                PayMsg msg = dc.PayMsg.ToList().Last();
                string path = dir + GeneralClass.Now.ToShortDateString() + "\\" + msg.systemId + ".avi";

                recording = true;
                video.StartKinescope(path);
                recordTime = GeneralClass.Now;

                dc.PayMsg.DeleteAllOnSubmit(dc.PayMsg.ToArray());
                dc.SubmitChanges();
            }
            if (recording && GeneralClass.Now - recordTime >= ts)
            {
                watch_Timer.Interval = 100;
                recording = false;
                video.StopKinescope();
            }
        }
Example #38
0
        //获取最快下钟技师
        public static string get_fast_tech(string techJob)
        {
            var info = new List<string>();

            var db = new BathDBDataContext(connectionString);
            var jobs = db.Job.Where(x => x.name.Contains("技师"));

            if (techJob != "所有技师")
                jobs = jobs.Where(x => x.name == techJob);

            foreach (var job in jobs)
            {
                var techs = db.Employee.Where(x => x.jobId == job.id);
                techs = techs.Where((x => x.techStatus != null && x.techStatus != "空闲")).
                    OrderBy(x => x.serverTime - (DateTime.Now - x.startTime.Value).TotalMinutes);
                foreach (var tech in techs)
                {
                    var room = db.Room.FirstOrDefault(x => x.status.Contains("服务") && x.techId.Contains(tech.id));
                    if (room == null) continue;

                    info.Add(tech.id);
                    info.Add(room.name);
                    info.Add(tech.startTime.Value.ToString("HH:mm"));

                    var left = (tech.serverTime.Value - (DateTime.Now - tech.startTime.Value).TotalMinutes).ToString("0");
                    info.Add(left);

                    var rs = db.TechReservation.FirstOrDefault(x => x.techId == tech.id && !x.proceeded.Value);
                    if (rs == null)
                        info.Add("无");
                    else
                        info.Add(rs.roomId);
                }
            }

            return get_result_str(info);
        }
Example #39
0
        //获取所有技师预约记录
        public static string get_resv_techs(string techJob)
        {
            var info = new List<string>();

            var db = new BathDBDataContext(connectionString);
            var tr = db.TechReservation.Where(x => !x.proceeded.Value);
            if (techJob != "所有技师")
            {
                var job = db.Job.FirstOrDefault(x => x.name == techJob);
                var techs = db.Employee.Where(x => x.jobId == job.id).Select(x => x.id);
                tr = tr.Where(x => techs.Contains(x.techId));
            }
            foreach (var t in tr)
            {
                info.Add(t.techId);
                info.Add(t.seatId);
                info.Add(t.roomId);
                info.Add(t.time.Value.ToString("HH:mm"));
            }

            return get_result_str(info);
        }
Example #40
0
 //获取所有包厢
 public static string get_rooms()
 {
     List<string> infor = new List<string>();
     var db = new BathDBDataContext(connectionString);
     foreach (var c in db.Room)
     {
         int pop = c.population;
         if (pop == 1)
         {
             infor.Add(c.name);
             string sts = "空闲";
             if (c.status != null)
                 sts = c.status.Split('|')[0];
             infor.Add(sts);
         }
         else
         {
             for (int i = 0; i < pop; i++)
             {
                 infor.Add(c.name + "-" + (i + 1).ToString());
                 string sts = "空闲";
                 try
                 {
                     if (c.status != null)
                         sts = c.status.Split('|')[i];
                 }
                 catch
                 { }
                 infor.Add(sts);
             }
         }
     }
     return get_result_str(infor);
 }
Example #41
0
        //获取房间,手牌预约记录
        public static string get_room_seat_reservation(string roomId, string seatId)
        {
            var db = new BathDBDataContext(connectionString);

            var info = new List<string>();
            var t = db.TechReservation.FirstOrDefault(x => x.roomId == roomId && x.seatId == seatId && !x.proceeded.Value);
            if (t == null)
                return "null";

            info.Add(t.techId);
            info.Add(t.time.Value.ToString("HH:mm"));
            return get_result_str(info);
        }
Example #42
0
        public static string get_seat_room(string seatId)
        {
            Room room = null;
            var db = new BathDBDataContext(connectionString);
            var rooms = db.Room.Where(x => x.seat.Contains(seatId));
            foreach (var r in rooms)
            {
                try
                {
                    var seatIds = r.seat.Split('|').ToList();
                    var status = r.status.Split('|').ToList();
                    int i = seatIds.IndexOf(seatId);
                    if (i != -1 && status[i] != "空闲" && status[i] != "null")
                    {
                        room = r;
                        break;
                    }
                }
                catch (System.Exception e)
                {

                }
            }

            if (room != null)
                return room.name;
            else
                return "";
        }
Example #43
0
        public static void print_kitchen(Orders order)
        {
            try
            {
                var dc = new BathDBDataContext(connectionString);
                var menu = dc.Menu.FirstOrDefault(x => x.name == order.menu);
                if (menu == null)
                    return;

                var cat = dc.Catgory.FirstOrDefault(x => x.id == menu.catgoryId);
                if (cat == null)
                    return;

                if (cat.kitchPrinterName == "")
                    return;

                var room = dc.Room.FirstOrDefault(x=>x.seat.Contains(order.text));
                if (room == null)
                    return;

                //PrintKitchen.Print_DataGridView(order.text, order.menu, cat.kitchPrinterName,
                //    order.inputEmployee, order.number.ToString(), DateTime.Now.ToString("MM-dd HH:ss"), room.name);
            }
            catch (System.Exception e)
            {

            }
        }
Example #44
0
        //处理预约
        public static string proceed_reservation(string techId, string seatId, string accept)
        {
            try
            {
                var db = new BathDBDataContext(connectionString);

                var tr = db.TechReservation.FirstOrDefault(x => !x.proceeded.Value && x.techId == techId && x.seatId == seatId);
                if (tr == null)
                    tr = db.TechReservation.FirstOrDefault(x => !x.proceeded.Value && x.techId == "轮钟" && x.seatId == seatId);

                if (tr == null)
                    return "null";

                tr.proceeded = true;

                if (accept == "true")
                    tr.accept = true;
                else
                    tr.accept = false;

                db.SubmitChanges();

                return "true";
            }
            catch (System.Exception e)
            {
                return "false";
            }
        }
Example #45
0
        //上传账单数据
        private void run_account()
        {
            while (true)
            {
                try
                {
                    var db = new BathDBDataContext(connectionString);

                    long maxId = -1;
                    var abandonIds = new List<long>();
                    var account_uploadRecords = db.UploadRecords.FirstOrDefault(x => x.tableName == "Account");
                    if (account_uploadRecords != null)
                    {
                        maxId = MConvert<long>.ToTypeOrDefault(account_uploadRecords.maxId, -1);
                        if (account_uploadRecords.abandonId != null)
                        {
                            var idArray = account_uploadRecords.abandonId.Split(Constants.SplitChar);
                            abandonIds = Array.ConvertAll<string, long>(idArray, delegate(string s) { return MConvert<long>.ToTypeOrDefault(s, -1); }).ToList();
                        }
                    }
                    else
                    {
                        account_uploadRecords = new UploadRecords();
                        account_uploadRecords.tableName = "Account";
                        db.UploadRecords.InsertOnSubmit(account_uploadRecords);
                        db.SubmitChanges();
                    }

                    #region 更新abandonIds,去除掉夜审之前的,以免abandonIds过长

                    var maxTime = DateTime.Parse("2013-01-01 00:00:00");
                    if (db.ClearTable.Any())
                        maxTime = db.ClearTable.Max(x => x.clearTime);
                    var max_passed_account_id = db.Account.Where(x => x.payTime <= maxTime).Max(x => x.id);
                    abandonIds.RemoveAll(x => x <= max_passed_account_id);

                    var _idArray = Array.ConvertAll<long, string>(abandonIds.ToArray(), delegate(long s) { return s.ToString(); });
                    account_uploadRecords.abandonId = string.Join(Constants.SplitChar.ToString(), _idArray);
                    db.SubmitChanges();

                    #endregion

                    var accounts = db.Account.Where(x => x.id > maxId);
                    var _accounts = db.Account.Where(x => x.payTime >= maxTime && x.abandon != null && !abandonIds.Contains(x.id));
                    accounts = accounts.Union(_accounts).Distinct();

                    bool changed = false;
                    foreach (var account in accounts)
                    {
                        bool sucess = false;
                        while (!sucess)
                        {
                            sucess = upload_json(BathClass.ConvertToJsonString(account), "account");
                            if (sucess)
                            {
                                changed = true;
                                if (maxId < account.id)
                                {
                                    maxId = account.id;
                                    account_uploadRecords.maxId = account.id;
                                }
                                if (account.abandon != null && account.id >= max_passed_account_id)
                                {
                                    account_uploadRecords.abandonId += Constants.SplitChar + account.id.ToString();
                                }
                            }
                        }
                    }

                    if (changed)
                        db.SubmitChanges();
                }
                catch (System.Exception ex)
                {
                    IOUtil.insert_file(BathClass.getErrorFileName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "run_account" + ex.Message);
                }
            }
        }
Example #46
0
        //预约技师
        public static string reserve_tech(string techId, string seatId, string roomId, string time, string gender)
        {
            try
            {
                var db = new BathDBDataContext(connectionString);

                var tr = new TechReservation();

                tr.techId = techId;
                tr.seatId = seatId;
                tr.roomId = roomId;
                tr.time = Convert.ToDateTime(time);
                tr.gender = gender;
                tr.proceeded = false;

                db.TechReservation.InsertOnSubmit(tr);
                db.SubmitChanges();

                return "true";
            }
            catch (System.Exception e)
            {
                return "false";
            }
        }
Example #47
0
        //上传ClearTable数据
        private void run_clearTable()
        {
            while (true)
            {
                try
                {
                    var db = new BathDBDataContext(connectionString);
                    long maxId = -1;
                    DateTime clearTime = DateTime.Now;
                    var uploadRecords = db.UploadRecords.FirstOrDefault(x => x.tableName == "ClearTable");
                    if (uploadRecords != null)
                    {
                        maxId = MConvert<long>.ToTypeOrDefault(uploadRecords.maxId, -1);
                        clearTime = MConvert<DateTime>.ToTypeOrDefault(uploadRecords.clearTime, clearTime);
                    }
                    else
                    {
                        uploadRecords = new UploadRecords();
                        uploadRecords.tableName = "ClearTable";
                        db.UploadRecords.InsertOnSubmit(uploadRecords);
                        db.SubmitChanges();
                    }

                    var clearTables = db.ClearTable.Where(x => x.id > maxId);
                    var _clearTables = db.ClearTable.Where(x => x.id == maxId && x.clearTime != clearTime);
                    clearTables = clearTables.Union(_clearTables).Distinct();

                    bool changed = false;
                    foreach (var clearTable in clearTables)
                    {
                        bool sucess = false;
                        while (!sucess)
                        {
                            sucess = upload_json(BathClass.ConvertToJsonString(clearTable), "ClearTable");
                            if (sucess)
                            {
                                changed = true;
                                if (maxId < clearTable.id)
                                {
                                    maxId = clearTable.id;
                                    uploadRecords.maxId = clearTable.id;
                                }
                                if (clearTable.clearTime != clearTime)
                                {
                                    clearTime = clearTable.clearTime;
                                    uploadRecords.clearTime = clearTable.clearTime;
                                }
                                db.SubmitChanges();
                            }
                        }
                    }
                    if (changed)
                        db.SubmitChanges();
                }
                catch (System.Exception ex)
                {

                }
            }
        }
Example #48
0
        //上传会员卡销售
        private void run_cardSale()
        {
            while (true)
            {
                try
                {
                    var db = new BathDBDataContext(connectionString);

                    long maxId = -1;
                    var abandonIds = new List<long>();
                    var uploadRecords = db.UploadRecords.FirstOrDefault(x => x.tableName == "CardSale");
                    if (uploadRecords != null)
                    {
                        maxId = MConvert<long>.ToTypeOrDefault(uploadRecords.maxId, -1);
                        if (uploadRecords.abandonId != null)
                        {
                            var idArray = uploadRecords.abandonId.Split(Constants.SplitChar);
                            abandonIds = Array.ConvertAll<string, long>(idArray, delegate(string s) { return MConvert<long>.ToTypeOrDefault(s, -1); }).ToList();
                        }
                    }
                    else
                    {
                        uploadRecords = new UploadRecords();
                        uploadRecords.tableName = "CardSale";
                        db.UploadRecords.InsertOnSubmit(uploadRecords);
                        db.SubmitChanges();
                    }

                    #region 更新abandonIds,去除掉夜审之前的,以免abandonIds过长

                    var maxTime = DateTime.Parse("2013-01-01 00:00:00");
                    if (db.ClearTable.Any())
                        maxTime = db.ClearTable.Max(x => x.clearTime);
                    var max_passed_id = db.CardSale.Where(x => x.payTime <= maxTime).Max(x => x.id);
                    abandonIds.RemoveAll(x => x <= max_passed_id);

                    var _idArray = Array.ConvertAll<long, string>(abandonIds.ToArray(), delegate(long s) { return s.ToString(); });
                    uploadRecords.abandonId = string.Join(Constants.SplitChar.ToString(), _idArray);
                    db.SubmitChanges();

                    #endregion

                    var cardSales = db.CardSale.Where(x => x.id > maxId);
                    var _cardSales = db.CardSale.Where(x => x.payTime >= maxTime && x.abandon != null && !abandonIds.Contains(x.id));
                    cardSales = cardSales.Union(_cardSales).Distinct();

                    bool changed = false;
                    foreach (var cardSale in cardSales)
                    {
                        bool sucess = false;
                        while (!sucess)
                        {
                            sucess = upload_json(BathClass.ConvertToJsonString(cardSale), "CardSale");
                            if (sucess)
                            {
                                changed = true;
                                if (maxId < cardSale.id)
                                {
                                    maxId = cardSale.id;
                                    uploadRecords.maxId = cardSale.id;
                                }
                                if (cardSale.abandon != null && cardSale.id >= max_passed_id)
                                {
                                    uploadRecords.abandonId += Constants.SplitChar + cardSale.id.ToString();
                                }
                            }
                        }
                    }
                    if (changed)
                        db.SubmitChanges();
                }
                catch (System.Exception ex)
                {

                }
            }
        }
Example #49
0
        //修改技师状态
        public static string save_tech(string techId, string room, string seat, string status, string serverTime, string startTime)
        {
            //StringBuilder sb = new StringBuilder();
            try
            {
                //insert_file("enter save tech");
                //var dbLayer = new DBLayer(connectionString);
                //sb.Append("update [Employee] set techStatus='" + status + "'");
                var db = new BathDBDataContext(connectionString);
                var tech = db.Employee.FirstOrDefault(x => x.id.ToString() == techId);
                if (tech == null)
                    return "null";

                string old_status = tech.techStatus.Trim();
                if (room != "null")
                //    sb.Append(",room='" + room + "'");
                    tech.room = room;
                else
                //    sb.Append(",room=null");
                    tech.room = null;

                if (seat == "null")
                    //sb.Append(",seat=null");
                    tech.seat = null;
                else
                    //sb.Append(",seat='" + seat + "'");
                    tech.seat = seat;

                //insert_file(status.Trim());
                tech.techStatus = status.Trim();
                if (serverTime != "null")
                    //sb.Append(",serverTime=" + serverTime);
                    tech.serverTime = Convert.ToInt32(serverTime);
                else
                    //sb.Append(",serverTime=null");
                    tech.serverTime = null;

                if (startTime != "null")
                    //sb.Append(",startTime='" + startTime + "'");
                    tech.startTime = Convert.ToDateTime(startTime);
                else
                    //sb.Append(",startTime=null");
                    tech.startTime = null;

                var tech_index = db.TechIndex.FirstOrDefault(x => x.dutyid == tech.jobId && x.gender == tech.gender);
                List<string> old_index = null;
                if (tech_index != null)
                {
                    old_index = tech_index.ids.Split('%').ToList();
                    var tech_str = old_index.FirstOrDefault(x => x.Contains(tech.id + "="));
                    var tech_str_index = old_index.IndexOf(tech_str);
                    if (tech_str_index != -1)
                    {
                        if (tech.techStatus == "空闲")
                        {
                            if (old_status == "点钟")
                            {
                                old_index[tech_str_index] = tech.id + "=T";
                                tech_index.ids = string.Join("%", old_index.ToArray());
                            }
                            else
                            {
                                old_index.RemoveAt(tech_str_index);
                                old_index.Add(tech.id + "=T");
                                tech_index.ids = string.Join("%", old_index.ToArray());
                            }
                        }
                        else if (tech.techStatus == "点钟" || tech.techStatus == "轮钟" || tech.techStatus == "上钟")
                        {
                            old_index[tech_str_index] = tech.id + "=F";
                            tech_index.ids = string.Join("%", old_index.ToArray());
                        }
                    }
                    else
                    {
                        if (tech.techStatus == "空闲")
                        {
                            old_index.Add(tech.id + "=T");
                            tech_index.ids = string.Join("%", old_index.ToArray());
                        }
                    }
                }

                db.SubmitChanges();
                //insert_file("finish save tech");
                return "true";
            }
            catch(Exception e)
            {
                insert_file(e.Message);
                return "false";
            }
        }
Example #50
0
        //获取单个技师预约记录
        public static string get_tech_reserve(string techId)
        {
            var info = new List<string>();
            var db = new BathDBDataContext(connectionString);
            var tech = db.Employee.FirstOrDefault(x=>x.id==techId);
            if (tech == null)
                return "null";

            var r_order = db.TechReservation.FirstOrDefault(x => !x.proceeded.Value && x.techId == techId);
            if (r_order != null)
            {
                info.Add(r_order.seatId);
                info.Add(r_order.roomId);
                info.Add(r_order.time.Value.ToString("HH:mm"));
            }
            else
            {
                var r_on = db.TechReservation.FirstOrDefault(x => !x.proceeded.Value && x.techId == "轮钟" &&
                    (x.gender == "无" || x.gender == tech.gender));
                if (r_on != null)
                {
                    info.Add(r_on.seatId);
                    info.Add(r_on.roomId);
                    info.Add(r_on.time.Value.ToString("HH:mm"));
                }
            }

            return get_result_str(info);
        }
Example #51
0
        //获取技师类别
        public static string get_tech_jobs()
        {
            var info = new List<string>();

            var db = new BathDBDataContext(connectionString);
            var jobs = db.Job.Where(x => x.name.Contains("技师"));

            info.AddRange(jobs.Select(x => x.name));

            return get_result_str(info);
        }
Example #52
0
        //输入小费
        public static string make_tip(string seatTxt, string tech, string money)
        {
            try
            {
                var db = new BathDBDataContext(connectionString);
                var m_Seat = db.Seat.FirstOrDefault(x => x.text == seatTxt);
                var menu = db.Menu.FirstOrDefault(x => x.name == "小费");

                Orders order = new Orders();
                order.menu = menu.name;
                order.text = m_Seat.text;
                order.systemId = m_Seat.systemId;
                order.number = 1;
                order.money = Convert.ToDouble(money);
                order.inputTime = DateTime.Now;
                order.inputEmployee = tech;
                order.paid = false;
                order.technician = tech;

                db.Orders.InsertOnSubmit(order);
                db.SubmitChanges();

                return "true";
            }
            catch (System.Exception e)
            {
                return "false";
            }
        }
Example #53
0
        //获取手牌消费
        public static string get_seat_orderObjects(string seatId)
        {
            List<string> infor = new List<string>();
            var db = new BathDBDataContext(connectionString);
            var seat = db.Seat.FirstOrDefault(x => x.text == seatId);
            if (seat == null || seat.systemId == null)
                return "手牌不存在";

            if (seat.status == 1)
                return "手牌不在使用中";

            if (seat.status == 3)
                return "手牌已结账";

            if (seat.status == 4)
                return "手牌已锁定";

            if (seat.status == 5)
                return "手牌已停用";

            if (seat.status == 8)
                return "手牌正在重新结账";

            if (seat.paying != null && seat.paying.Value)
                return "手牌正在结账";

            double total_money = 0;
            var orders = db.Orders.Where(x => x.systemId == seat.systemId && x.deleteEmployee == null && !x.paid);
            foreach (var order in orders)
            {
                infor.Add(order.id.ToString());
                infor.Add(order.menu);
                if (order.technician == null)
                    infor.Add("null");
                else
                    infor.Add(order.technician);

                infor.Add(order.number.ToString());

                double money = 0;
                if (order.priceType == null || order.priceType == "停止消费")
                    money = order.money;
                else if (order.priceType == "每小时")
                    money = (DateTime.Now - order.inputTime).TotalHours * order.money;

                total_money += money;
                infor.Add(money.ToString("0"));

                if (order.billId == null)
                    infor.Add("null");
                else
                    infor.Add(order.billId);
            }

            infor.Add(total_money.ToString("0"));
            return get_result_str(infor);
        }
Example #54
0
        public static string login(string name, string pwd)
        {
            var db = new BathDBDataContext(connectionString);
            var user = db.Employee.FirstOrDefault(x => x.id == name);
            if (user == null)
                return "用户不存在";

            if (user.password != GetMD5(pwd))
                return "密码不正确";

            List<string> info = new List<string>();
            info.Add(user.id);
            info.Add(user.name);
            return get_result_str(info);
        }
Example #55
0
        public static string get_rooms_for_server()
        {
            StringBuilder sb = new StringBuilder();
            var db = new BathDBDataContext(connectionString);
            foreach (var room in db.Room)
            {
                sb.Append(room.name).Append("|").Append(room.population);

                int number_in = 0;
                int pop = room.population;
                string status = "空闲";
                for (int i = 0; i < pop; i++)
                {
                    status = "空闲";
                    try
                    {
                        status = room.status.Split('|')[i];
                    }
                    catch
                    {
                    }
                    if (status == "入住" || status == "等待服务" || status == "预约服务" || status == "服务" || status == "等待清洁")
                    {
                        number_in++;
                    }
                }

                sb.Append("|").Append(number_in);
                sb.Append("$");
            }

            return sb.ToString();
        }
Example #56
0
 //获取服务项目
 public static string get_waiters()
 {
     var db = new BathDBDataContext(connectionString);
     return string.Join("$", db.WaiterItem.Select(x => x.name).ToArray());
 }
Example #57
0
        //获取所有房间号
        public static string get_room(string room_id)
        {
            List<string> infor = new List<string>();
            var db = new BathDBDataContext(connectionString);
            var room = db.Room.FirstOrDefault(x => x.name == room_id);

            infor.Add(room_id);

            if (room.openTime == null)
                infor.Add("null");
            else
                infor.Add(room.openTime);

            if (room.seat == null)
                infor.Add("null");
            else
                infor.Add(room.seat);

            if (room.systemId == null)
                infor.Add("null");
            else
                infor.Add(room.systemId);

            if (room.orderTechId == null)
                infor.Add("null");
            else
                infor.Add(room.orderTechId);

            if (room.menu == null)
                infor.Add("null");
            else
                infor.Add(room.menu);

            if (room.techId == null)
                infor.Add("null");
            else
                infor.Add(room.techId);

            if (room.startTime == null)
                infor.Add("null");
            else
                infor.Add(room.startTime);

            if (room.serverTime == null)
                infor.Add("null");
            else
                infor.Add(room.serverTime.ToString());

            if (room.orderTime == null)
                infor.Add("null");
            else
                infor.Add(room.orderTime);

            if (room.hintPlayed == null)
                infor.Add("false");
            else
                infor.Add(room.hintPlayed);

            if (room.reserveId == null)
                infor.Add("null");
            else
                infor.Add(room.reserveId);

            if (room.reserveTime == null)
                infor.Add("null");
            else
                infor.Add(room.reserveTime);

            if (room.selectId == null)
                infor.Add("null");
            else
                infor.Add(room.selectId);

            infor.Add(room.status);
            infor.Add(room.population.ToString());
            return get_result_str(infor);
        }
Example #58
0
        //获取技师状态
        public static string get_tech_status(string techId)
        {
            var info = new List<string>();

            var db = new BathDBDataContext(connectionString);
            var tech = db.Employee.FirstOrDefault(x => x.id == techId);
            if (tech == null)
                return "false";

            if (tech.techStatus == null || tech.techStatus == "空闲")
            {
                info.Add("空闲");
                return get_result_str(info);
            }
            info.Add(tech.techStatus);
            var left = Math.Round(tech.serverTime.Value - (DateTime.Now - tech.startTime.Value).TotalMinutes, 0);
            info.Add(left.ToString());

            return get_result_str(info);
        }
Example #59
0
 //获取是否需要输入单据号
 public static string get_input_billId()
 {
     var db = new BathDBDataContext(connectionString);
     var i = db.Options.FirstOrDefault().录单输入单据编号;
     if (i == null || !i.Value)
         return "false";
     else
         return "true";
 }
Example #60
0
 public static string get_offcall_delay()
 {
     var db = new BathDBDataContext(connectionString);
     return db.Options.FirstOrDefault().下钟提醒.Value.ToString();
 }