Esempio n. 1
0
        //删除部门
        private void delOfficer_Click(object sender, EventArgs e)
        {
            if (jobTree.SelectedNode == null)
            {
                GeneralClass.printErrorMsg("没有选择节点!");
                return;
            }

            string jobSelName = jobTree.SelectedNode.Text;
            var    depart     = db.Department.FirstOrDefault(x => x.name == jobSelName);

            if (depart == null)
            {
                BathClass.printErrorMsg("所选节点异常,请确认!");
                return;
            }

            int jobSelId = depart.id;

            if (GeneralClass.printAskMsg("确认删除部门: " + jobSelName + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.Job.FirstOrDefault(x => x.departId == jobSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的部门包含职位,不能删除!");
                return;
            }

            db.Department.DeleteOnSubmit(depart);
            db.SubmitChanges();
            createTree();
        }
Esempio n. 2
0
        //删除支出
        private void delTool_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                GeneralClass.printErrorMsg("没有选择行!");
                return;
            }

            if (GeneralClass.printAskMsg("确认删除?") != DialogResult.Yes)
            {
                return;
            }

            int delId   = Convert.ToInt32(dgv.CurrentRow.Cells[0].Value);
            var expense = db.Expense.FirstOrDefault(s => s.id == delId);


            if (del_time_limit != null)
            {
                if ((BathClass.Now(LogIn.connectionString) - expense.inputDate) >= TimeSpan.Parse("00:" + del_time_limit.ToString() + ":00"))
                {
                    GeneralClass.printErrorMsg("超过支出删除时限,不能删除!");
                    return;
                }
            }
            db.Expense.DeleteOnSubmit(expense);

            db.SubmitChanges();
            dgv_show();
        }
Esempio n. 3
0
        //获取夜审时间
        private bool get_clear_table_time()
        {
            var lct = db.ClearTable.FirstOrDefault(x => x.clearTime.Date == startTime.Value.Date);

            if (lct == null)
            {
                lct = db.ClearTable.Where(x => x.clearTime < startTime.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.FirstOrDefault(x => x.clearTime.Date == endTime.Value.AddDays(1).Date);

            if (ct == null)
            {
                GeneralClass.printErrorMsg("没有夜审,不能查询");
                return(false);
            }

            thisTime = ct.clearTime;

            return(true);
        }
        //删除类别
        private void delCat_Click(object sender, EventArgs e)
        {
            if (catTree.SelectedNode == null ||
                db.Catgory.FirstOrDefault(x => x.name == catTree.SelectedNode.Text) == null)
            {
                GeneralClass.printWarningMsg("没有选择节点!");
                return;
            }

            string catSel   = catTree.SelectedNode.Text;
            int    catSelId = db.Catgory.FirstOrDefault(x => x.name == catSel).id;

            if (GeneralClass.printAskMsg("确认删除类别: " + catSel + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.Menu.FirstOrDefault(x => x.catgoryId == catSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的职位包含菜式,不能删除!");
                return;
            }

            db.Catgory.DeleteOnSubmit(db.Catgory.FirstOrDefault(x => x.name == catSel));
            db.SubmitChanges();
            createTree();
        }
Esempio n. 5
0
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (name.Text == "" || mobile.Text == "")
            {
                GeneralClass.printErrorMsg("需要输入必填信息");
                return;
            }

            foreach (Control c in this.Controls)
            {
                if (c.GetType() == typeof(TextBox))
                {
                    if (c.Text != "")
                    {
                        var pro    = m_Customer.GetType().GetProperty(c.Name);
                        var proVal = TypeDescriptor.GetConverter(pro.PropertyType).ConvertFrom(c.Text);
                        pro.SetValue(m_Customer, proVal, null);
                    }
                }
            }
            if (newCustomer)
            {
                m_Customer.registerDate = BathClass.Now(LogIn.connectionString);
                db.Customer.InsertOnSubmit(m_Customer);
            }

            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }
Esempio n. 6
0
        //删除类型
        private void delType_Click(object sender, EventArgs e)
        {
            //if (m_thread != null && m_thread.IsAlive)
            //    m_thread.Abort();

            if (typeTree.SelectedNode == null ||
                db.MemberType.FirstOrDefault(x => x.name == typeTree.SelectedNode.Text) == null)
            {
                GeneralClass.printErrorMsg("没有选择节点!");
                return;
            }

            string typeSelName = typeTree.SelectedNode.Text;
            int    typeSelId   = db.MemberType.FirstOrDefault(x => x.name == typeSelName).id;

            if (GeneralClass.printAskMsg("确认删除类型: " + typeSelName + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.CardInfo.FirstOrDefault(x => x.CI_CardTypeNo == typeSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的类型包含会员卡,不能删除!");
                return;
            }

            db.MemberType.DeleteOnSubmit(db.MemberType.FirstOrDefault(x => x.name == typeSelName));
            db.SubmitChanges();
            createTree();
        }
        //删除手牌类型
        private void delSeatType_Click(object sender, EventArgs e)
        {
            if (seatTypeTree.SelectedNode == null ||
                db.SeatType.FirstOrDefault(x => x.name == seatTypeTree.SelectedNode.Text) == null)
            {
                GeneralClass.printErrorMsg("没有选择节点!");
                return;
            }

            string typeSelName = seatTypeTree.SelectedNode.Text;
            int    typeSelId   = db.SeatType.FirstOrDefault(x => x.name == typeSelName).id;

            if (GeneralClass.printAskMsg("确认删除类型: " + typeSelName + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.Seat.FirstOrDefault(x => x.typeId == typeSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的手牌类型包含手牌,不能删除!");
                return;
            }

            db.SeatType.DeleteOnSubmit(db.SeatType.FirstOrDefault(x => x.name == typeSelName));
            db.SubmitChanges();
            createTree();
        }
Esempio n. 8
0
        //注册
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (GetRNum().IndexOf(GetRNum()) == 0)
            {
                string   regTimeStr = code.Text.Substring(24);
                DateTime regTime    = reg_date(regTimeStr);
                TimeSpan tSpan      = BathClass.Now(LogIn.connectionString) - regTime;
                if (tSpan.TotalDays >= 365)
                {
                    GeneralClass.printErrorMsg("注册码已经过期, 请联系赵经理:18674468090");
                    this.Close();
                    return;
                }
                MessageBox.Show("注册成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                var regKey = Registry.LocalMachine;
                regKey = regKey.OpenSubKey("Software", true);
                regKey = regKey.OpenSubKey("wxf", true).OpenSubKey("wxf.INI", true);
                foreach (var subkey in regKey.GetSubKeyNames())
                {
                    regKey.DeleteSubKeyTree(subkey);
                }

                regKey.CreateSubKey(code.Text);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                GeneralClass.printErrorMsg("注册失败,请联系赵经理:18674468090");
                this.Close();
            }
        }
Esempio n. 9
0
        //删除员工
        private void delTool_Click(object sender, EventArgs e)
        {
            if (dgv.CurrentCell == null)
            {
                GeneralClass.printErrorMsg("没有选择行!");
                return;
            }

            if (GeneralClass.printAskMsg("确认删除?") != DialogResult.Yes)
            {
                return;
            }

            string delId = dgv.CurrentRow.Cells[0].Value.ToString();

            db.Employee.DeleteOnSubmit(db.Employee.FirstOrDefault(s => s.id == delId));

            var authEmployee = db.Authority.FirstOrDefault(x => x.emplyeeId == delId);

            if (authEmployee != null)
            {
                db.Authority.DeleteOnSubmit(authEmployee);
            }

            db.SubmitChanges();
            dgv_show();
        }
Esempio n. 10
0
        //删除职位
        private void delOfficer_Click(object sender, EventArgs e)
        {
            if (jobTree.SelectedNode == null ||
                db.Job.FirstOrDefault(x => x.name == jobTree.SelectedNode.Text) == null)
            {
                GeneralClass.printErrorMsg("没有选择节点!");
                return;
            }

            string jobSelName = jobTree.SelectedNode.Text;
            int    jobSelId   = db.Job.FirstOrDefault(x => x.name == jobSelName).id;

            if (GeneralClass.printAskMsg("确认删除职位: " + jobSelName + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.Employee.FirstOrDefault(x => x.jobId == jobSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的职位包含员工,不能删除!");
                return;
            }

            db.Job.DeleteOnSubmit(db.Job.FirstOrDefault(x => x.name == jobSelName));
            db.Authority.DeleteOnSubmit(db.Authority.FirstOrDefault(x => x.jobId == jobSelId));
            db.SubmitChanges();
            createTree();
        }
Esempio n. 11
0
        //点击确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (name.Text == "")
            {
                name.Focus();
                GeneralClass.printErrorMsg("请输入项目名称");
                return;
            }
            m_WaiterItem.name = name.Text;
            m_WaiterItem.note = note.Text;

            if (newWaiterItem)
            {
                if (db.WaiterItem.FirstOrDefault(x => x.name == name.Text) != null)
                {
                    name.SelectAll();
                    name.Focus();
                    GeneralClass.printErrorMsg("已存在" + name.Text + "服务项目,不能重复添加");
                    return;
                }
                db.WaiterItem.InsertOnSubmit(m_WaiterItem);
                db.SubmitChanges();
                m_rmForm.dgv_show();

                m_WaiterItem = new WaiterItem();
                name.Text    = "";
                note.Text    = "";
                name.Focus();
            }
            else
            {
                db.SubmitChanges();
                this.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 12
0
        //确定
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (cardId.Text == "" || money.Text == "" || money.Text == "0")
            {
                GeneralClass.printErrorMsg("需要输入必填信息");
                return;
            }

            if (name.Text == "")
            {
                GeneralClass.printErrorMsg("不存在此会员卡");
                return;
            }

            CardCharge cc = new CardCharge();

            cc.CC_CardNo = cardId.Text;
            //cc.CC_AccountNo = account.id.ToString();
            cc.CC_ItemExplain = "会员扣卡";
            cc.CC_LenderSum   = Convert.ToDouble(money.Text);
            //cc.expense = account_money;
            cc.CC_InputOperator = LogIn.m_User.id.ToString();
            cc.CC_InputDate     = DateTime.Now;
            db.CardCharge.InsertOnSubmit(cc);

            //Deducted deduct = new Deducted();
            //deduct.memberId = cardId.Text;
            //deduct.money = Convert.ToDouble(money.Text);
            //deduct.date = BathClass.Now(LogIn.connectionString);
            //deduct.processed = false;

            //db.Deducted.InsertOnSubmit(deduct);
            db.SubmitChanges();
            this.DialogResult = DialogResult.OK;
        }
Esempio n. 13
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            string val = validateTextFilds();

            if (val != "OK")
            {
                GeneralClass.printErrorMsg(val);
                return;
            }

            //m_Expense.id = Convert.ToInt32(id.Text);
            m_Expense.name        = name.Text;
            m_Expense.typeId      = db.ExpenseType.FirstOrDefault(x => x.name == type.Text).id;
            m_Expense.money       = Convert.ToDouble(money.Text);
            m_Expense.payType     = payType.Text;
            m_Expense.toWhom      = toWhom.Text;
            m_Expense.transactor  = transactor.Text;
            m_Expense.tableMaker  = tableMaker.Text;
            m_Expense.checker     = checker.Text;
            m_Expense.note        = note.Text;
            m_Expense.expenseDate = expenseDate.Value;

            if (newExpense)
            {
                m_Expense.inputDate = BathClass.Now(LogIn.connectionString);
                db.Expense.InsertOnSubmit(m_Expense);
            }
            db.SubmitChanges();

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 14
0
        //删除类别
        private void delType_Click(object sender, EventArgs e)
        {
            if (typeTree.SelectedNode == null ||
                db.Job.FirstOrDefault(x => x.name == typeTree.SelectedNode.Text) == null)
            {
                GeneralClass.printErrorMsg("没有选择节点!");
                return;
            }

            string jobSelName = typeTree.SelectedNode.Text;
            int    jobSelId   = db.ExpenseType.FirstOrDefault(x => x.name == jobSelName).id;

            if (GeneralClass.printAskMsg("确认删除类别: " + jobSelName + " ?") != DialogResult.Yes)
            {
                return;
            }

            if (db.Expense.FirstOrDefault(x => x.typeId == jobSelId) != null)
            {
                GeneralClass.printErrorMsg("所选择的类别包含支出,不能删除!");
                return;
            }

            db.ExpenseType.DeleteOnSubmit(db.ExpenseType.FirstOrDefault(x => x.name == jobSelName));
            db.SubmitChanges();
            createTree();
        }
Esempio n. 15
0
        //应付账款
        private void btnPayableMoney_Click(object sender, EventArgs e)
        {
            var    db  = new BathDBDataContext(LogIn.connectionString);
            string pro = ((Button)sender).Text;

            if (!BathClass.getAuthority(db, LogIn.m_User, pro))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
        }
Esempio n. 16
0
 //查询
 private void toolFind_Click(object sender, EventArgs e)
 {
     try
     {
         dgvActList_Show();
     }
     catch (System.Exception ex)
     {
         GeneralClass.printErrorMsg(ex.Message);
     }
 }
Esempio n. 17
0
 //选中某行
 private void dgvActList_CurrentCellChanged(object sender, EventArgs e)
 {
     try
     {
         dgvOrders_Show();
         dgvAct_Show();
     }
     catch (System.Exception ex)
     {
         GeneralClass.printErrorMsg(ex.Message);
     }
 }
Esempio n. 18
0
        //开牌登记
        private void btnSeat_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "开牌"))
            {
                GeneralClass.printErrorMsg("不具有权限");
                return;
            }
            ReceptionSeatForm receptionSeatForm = new ReceptionSeatForm();

            receptionSeatForm.ShowDialog();
        }
Esempio n. 19
0
        private void btnFreeAdd_Click(object sender, EventArgs e)
        {
            if (dgvItems.CurrentCell == null)
            {
                GeneralClass.printErrorMsg("未选择行");
                return;
            }

            var menuId = db.Menu.FirstOrDefault(x => x.name == dgvItems.CurrentRow.Cells[0].Value.ToString()).id;

            freeIdList.Add(menuId);
            dgvFreeItems_show();
        }
Esempio n. 20
0
 private bool validateTextFields()
 {
     foreach (Control c in groupBox1.Controls)
     {
         if (c.GetType() != typeof(Label) && c.Name != "toStock" && c.Name != "note" && c.Text == "")
         {
             c.Focus();
             GeneralClass.printErrorMsg("需要输入内容");
             return(false);
         }
     }
     return(true);
 }
Esempio n. 21
0
        //提成统计
        private void btnBonusTable_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "提成统计"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            BonusTableForm bonusTableForm = new BonusTableForm();

            bonusTableForm.ShowDialog();
        }
Esempio n. 22
0
        //营业报表
        private void btnOverallTable_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "营业报表"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            DayOperationForm tableOperationForm = new DayOperationForm();

            tableOperationForm.ShowDialog();
        }
Esempio n. 23
0
        //结账单据查询
        private void btnBillTbale_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "收银单据查询"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            TableCashierCheckForm tableCashierCheckForm = new TableCashierCheckForm();

            tableCashierCheckForm.ShowDialog();
        }
Esempio n. 24
0
        //往来单位账目统计
        private void btnAccountWithTable_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "往来单位账目"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            AccountWithTableForm accountWithTableForm = new AccountWithTableForm();

            accountWithTableForm.ShowDialog();
        }
Esempio n. 25
0
        //会员卡售卡及续卡统计
        private void btnMemberCardSale_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "会员售卡及充值统计"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            MemberCardSaleForm memberCardSaleForm = new MemberCardSaleForm();

            memberCardSaleForm.ShowDialog();
        }
Esempio n. 26
0
        //客房管理
        private void btnRoomManage_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "客房管理"))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            RoomManagementForm roomForm = new RoomManagementForm();

            roomForm.ShowDialog();
        }
Esempio n. 27
0
        //调货补货
        private void btnAdjust_Click(object sender, EventArgs e)
        {
            var    db  = new BathDBDataContext(LogIn.connectionString);
            string pro = ((Button)sender).Text;

            if (!BathClass.getAuthority(db, LogIn.m_User, pro))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            TransferStockMangeForm transferStockMangeForm = new TransferStockMangeForm();

            transferStockMangeForm.ShowDialog();
        }
Esempio n. 28
0
        //卡入库
        private void btnMemberPop_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "卡入库"))
            {
                GeneralClass.printErrorMsg("不具有权限");
                return;
            }

            var form = new OpenCardForm();

            form.ShowDialog();
        }
Esempio n. 29
0
        //技师管理
        private void btnTechnician_Click(object sender, EventArgs e)
        {
            var db = new BathDBDataContext(LogIn.connectionString);

            if (!BathClass.getAuthority(db, LogIn.m_User, "技师管理"))
            {
                GeneralClass.printErrorMsg("不具有权限");
                return;
            }

            TechnicianSeclectForm technicianForm = new TechnicianSeclectForm();

            technicianForm.ShowDialog();
        }
Esempio n. 30
0
        //数据优化
        private void btnOptimization_Click(object sender, EventArgs e)
        {
            var    db  = new BathDBDataContext(LogIn.connectionString);
            string pro = ((Button)sender).Text;

            if (!BathClass.getAuthority(db, LogIn.m_User, pro))
            {
                GeneralClass.printErrorMsg("权限不够,不能访问!");
                return;
            }
            OptimizationForm optimizationForm = new OptimizationForm();

            optimizationForm.ShowDialog();
        }