Пример #1
0
        public FormLogin()
        {
            string EncryptedPasword = "mpwfCblfsz";   // loveBakery
            string password         = "";

            foreach (char c in EncryptedPasword)
            {
                password += (char)(c - 1);
            }
            global::VoucherExpense.Properties.Settings.Default.BakeryOrderConnectionString += password;

            HardwareConfig cfg = new HardwareConfig();

            cfg.Load();
            if (cfg.EnableCloudSync)
            {
                if (cfg.SharedDatabase != cfg.Database)
                {
                    int n = cfg.SharedDatabase.Count() - 6;
                    if (n < 0 || cfg.SharedDatabase.Substring(n, 6).ToLower() != "region")
                    {
                        cfg.EnableCloudSync = false;
                        MessageBox.Show("HardwareCfg.xml 中的<區域資料庫>設定不對! 雲端同步己強制取消.請通知IT帥哥來為你設定, 要跟他說你愛他喔!");
                    }
                }
            }
            if (cfg.SharedDatabase.Length == 0)
            {
                MessageBox.Show("你的HardwareCfg.xml有誤,缺少<區域資料庫>名稱設定 .請向IT帥哥索取一份貴門店專用設定,放置在大麥執行檔同目錄即可!");
                cfg.EnableCloudSync = false;
            }
            SetGlobalConnectionString(m_Cfg = cfg);
            InitializeComponent();
            ShowLogin(false);
        }
Пример #2
0
 public MapPath(Timer timer, ProgressBar progressBar, HardwareConfig cfg)
 {
     timer1            = timer;
     this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
     progressBar1      = progressBar;
     m_Cfg             = cfg;
     Completed         = false;
     MessageBox.Show("因HardwareCfg檔己被重定義! MapPath的BackgroundWorker都無作用了");
     //backgroundWorker1=new BackgroundWorker();
     //this.backgroundWorker1.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork);
     //this.backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
 }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Config = MyFunction.HardwareCfg;
         PrinterSettings ps = new PrinterSettings();
         ps.PrinterName     = Config.DotPrinterName;
         pD.PrinterSettings = ps;
         pD.Print();
         this.Close();
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
        private void FormBillList_Load(object sender, EventArgs e)
        {
            requestsBindingSource.DataSource = m_DataSet;
            var apartmentAdapter = new VoucherExpense.DamaiDataSetTableAdapters.ApartmentTableAdapter();

            apartmentAdapter.Connection.ConnectionString = DB.SqlConnectString(MyFunction.HardwareCfg);

            apartmentAdapter.Fill(m_DataSet.Apartment);
            RequestsAdapter.Fill(m_DataSet.Requests);
            this.requestsBindingSource.Sort = "requestsid desc";

            if (m_DefaultApartment.IsApartmentNameNull())
            {
                Apartmentname = m_DefaultApartment.ApartmentAllName;
            }
            else
            {
                Apartmentname = m_DefaultApartment.ApartmentAllName;
            }
            textBox1.Text = Apartmentname;
            //设定打印机
            Config = MyFunction.HardwareCfg;
            PrinterSettings ps = new PrinterSettings();

            ps.PrinterName                     = Config.DotPrinterName;
            textBoxDotPrinter.Text             = Config.DotPrinterName;
            pD.PrinterSettings                 = ps;
            dateTimetoolStripCbB.SelectedIndex = DateTime.Now.Month;
            if (MyFunction.IntHeaderYear != DateTime.Now.Year)
            {
                dateTimetoolStripCbB.SelectedIndex = dateTimetoolStripCbB.Items.Count - 1;
            }
            else
            {
                dateTimetoolStripCbB.SelectedIndex = DateTime.Now.Month;
            }
        }
Пример #5
0
 void SetGlobalConnectionString(HardwareConfig cfg)
 {
     global::VoucherExpense.Properties.Settings.Default.DamaiConnectionString = DB.SqlConnectString(cfg.Local, cfg.Database);
 }
Пример #6
0
 public FormHardware()
 {
     InitializeComponent();
     Config = MyFunction.HardwareCfg;
 }
Пример #7
0
        public FormHome(COperator Op, HardwareConfig cfg, DamaiDataSet.ApartmentRow apartment, DamaiDataSet.ApartmentDataTable authorizedApartment)
        {
            InitializeComponent();

            Operator = Op;
            MyFunction.OperatorID  = Op.OperatorID;
            MyFunction.HardwareCfg = m_Config = cfg;
            m_DefaultApartment     = apartment;
            m_AuthorizedApartment  = authorizedApartment;
            SetFormTitle();

            ToolStripMenuItem basic, accounting, bank, it;

            basic              = (ToolStripMenuItem)menu1.Items["基本資料MenuItem"];
            accounting         = (ToolStripMenuItem)menu1.Items["會計MenuItem"];
            it                 = (ToolStripMenuItem)menu1.Items["IT維護MenuItem"];
            bank               = (ToolStripMenuItem)menu1.Items["銀行MenuItem"];
            basic.Enabled      = (Op.EditEmployee | Op.EditOperator | Op.EditIngredient | Op.EditVendor);
            accounting.Enabled = Op.EditAccountingTitle;
            it.Enabled         = Op.IsSuper;
            bank.Enabled       = Op.EditBank;


            bool manager = Op.IsManager;

            MyFunction.IsManager     = manager;
            MyFunction.LockHR        = Op.LockHR;
            MyFunction.LockInventory = Op.LockInventory;
            basic.DropDownItems["食材表MenuItem"].Enabled           = Op.EditIngredient;
            basic.DropDownItems["配方表MenuItem"].Enabled           = Op.EditRecipe;
            basic.DropDownItems["產品表MenuItem"].Enabled           = Op.EditProduct;
            basic.DropDownItems["产品类别ToolStripMenuItem"].Enabled = Op.EditProduct;
            basic.DropDownItems["編修菜單MenuItem"].Enabled          = Op.EditProduct;
            basic.DropDownItems["供應商MenuItem"].Enabled           = Op.EditVendor;
            basic.DropDownItems["客户MenuItem"].Visible            = Op.EditCustomer;

            轉帳傳票MenuItem.Enabled = Op.EditAccountingTitle;                                                   // 傳票和會計科目
            accounting.DropDownItems["會計科目MenuItem"].Enabled = Op.LockAccVoucher && Op.EditAccountingTitle;
            accounting.DropDownItems["傳票設定MenuItem"].Visible = Op.LockAccVoucher && Op.EditAccountingTitle;  // 核傳票+編修科目

            bank.DropDownItems["銀行帳號MenuItem"].Enabled = Op.EditBank;
            bank.DropDownItems["銀行帳號MenuItem"].Visible = Op.EditBank;

            it.DropDownItems["操作員MenuItem"].Enabled  = Op.EditOperator;
            it.DropDownItems["硬體環境MenuItem"].Enabled = Op.IsSuper;
            it.DropDownItems["年初開帳MenuItem"].Visible = Op.IsSuper;
            it.DropDownItems["編修部門MenuItem"].Visible = Op.IsSuper;


            menu1.Items["庫存MenuItem"].Enabled = Op.EditInventory;
            menu1.Items["費用MenuItem"].Enabled = Op.EditExpense;
            menu1.Items["進貨MenuItem"].Enabled = Op.EditVoucher;
            menu1.Items["收入MenuItem"].Enabled = Op.RevenueOperate;
            menu1.Items["報表MenuItem"].Enabled = manager;

            ToolStripMenuItem i = (ToolStripMenuItem)menu1.Items["查核MenuItem"];

            i.Enabled            = Op.LockExpense || Op.LockVoucher || Op.LockAccVoucher;
            查核費用MenuItem.Enabled = Op.LockExpense;
            查核進貨MenuItem.Enabled = Op.LockVoucher;
            查核傳票MenuItem.Enabled = Op.LockAccVoucher;
            人事MenuItem.Enabled   = Op.EditSalary || Op.EditOnDuty || Op.LockHR;
            考勤MenuItem.Enabled   = Op.EditOnDuty;
            排班表MenuItem.Enabled  = Op.EditOnDuty;
            資料卡MenuItem.Enabled  = Op.EditSalary;
            出货MenuItem.Enabled   = Op.EditShipment || Op.LockShipment;

            if (m_AuthorizedApartment.Rows.Count <= 1) // 只有一家店可登入的就不顯示了
            {
                切換門店MenuItem.Enabled = false;
            }

            if (MyFunction.LockAll)
            {
                i.DropDownItems["鎖定資料庫MenuItem"].Text = "解鎖資料庫";
            }
            else
            {
                i.DropDownItems["鎖定資料庫MenuItem"].Text = "鎖定資料庫";
            }
            foreach (ToolStripMenuItem item in menu1.Items)
            {
                if (!item.Enabled)
                {
                    item.Visible = false;
                }
                else
                {
                    foreach (ToolStripMenuItem its in item.DropDownItems)
                    {
                        if (!its.Enabled)
                        {
                            its.Visible = false;
                        }
                    }
                }
            }
        }
Пример #8
0
 public FormInitNewYear()
 {
     InitializeComponent();
     m_HCfg = MyFunction.HardwareCfg;
 }