Exemple #1
0
        public async Task <IActionResult> Edit(string id, [Bind("CatId,Name,Status")] Catgory catgory)
        {
            ModelView modelView = new ModelView();

            modelView.catgory = catgory;
            if (id != catgory.CatId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Catgories.Update(catgory);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IsCatExists(catgory.CatId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(modelView));
        }
Exemple #2
0
        public void WriteLog(string strLog, Catgory catgory)
        {
            StreamWriter  log;
            FileStream    fileStream = null;
            DirectoryInfo logDirInfo = null;
            FileInfo      logFileInfo;
            string        logFilePath;

            if (catgory == Catgory.User)
            {
                logFilePath = @"C:\Users\yahav\source\repos\WebStoreProject\Logger\Product\";
            }
            else
            {
                logFilePath = @"C:\Users\yahav\source\repos\WebStoreProject\Logger\User\";
            }
            logFilePath = logFilePath + "Log-" + System.DateTime.Today.ToString("MM-dd-yyyy") + "." + "txt";
            logFileInfo = new FileInfo(logFilePath);
            logDirInfo  = new DirectoryInfo(logFileInfo.DirectoryName);
            if (!logDirInfo.Exists)
            {
                logDirInfo.Create();
            }
            if (!logFileInfo.Exists)
            {
                fileStream = logFileInfo.Create();
            }
            else
            {
                fileStream = new FileStream(logFilePath, FileMode.Append);
            }
            log = new StreamWriter(fileStream);
            log.WriteLine(strLog + " - " + DateTime.Now.ToShortTimeString());
            log.Close();
        }
        //构造函数
        public MenuCatgoryForm(BathDBDataContext dc, Catgory curCat)
        {
            db = dc;
            if (curCat != null)
            {
                newCat = false;
                m_cat  = curCat;
            }

            InitializeComponent();
        }
Exemple #4
0
        //选择类别
        private void type_TextChanged(object sender, EventArgs e)
        {
            Catgory catgory = db.Catgory.FirstOrDefault(x => x.name == type.Text);

            if (catgory == null)
            {
                return;
            }

            menu.Items.Clear();
            menu.Items.AddRange(db.Menu.Where(x => x.catgoryId == catgory.id && !menus.Contains(x.id.ToString())).Select(x => x.name).ToArray());
        }
Exemple #5
0
        //点击菜式类别
        private void btnType_Click(object sender, EventArgs e)
        {
            Button btn = sender as Button;

            foreach (Control c in cPanel.Controls)
            {
                c.BackColor = Color.Blue;
            }
            btn.BackColor = Color.Orange;

            m_Catgory = db.Catgory.FirstOrDefault(x => x.name == btn.Text);
            createMenuPanel();
        }
        //编辑类别
        private void editCat_Click(object sender, EventArgs e)
        {
            if (catTree.SelectedNode == null ||
                db.Catgory.FirstOrDefault(x => x.name == catTree.SelectedNode.Text) == null)
            {
                GeneralClass.printWarningMsg("没有选择类别!");
                return;
            }

            Catgory         cat     = db.Catgory.FirstOrDefault(x => x.name == catTree.SelectedNode.Text);
            MenuCatgoryForm editCat = new MenuCatgoryForm(db, cat);

            if (editCat.ShowDialog() == DialogResult.OK)
            {
                createTree();
            }
        }
        private void find_member_menu_number()
        {
            try
            {
                Catgory catgory = null;
                if (catgory_txt != "")
                {
                    catgory = db.Catgory.FirstOrDefault(x => x.name == catgory_txt);
                }
                memberInfo.Clear();
                var account_ids = db.CardCharge.Where(x => x.CC_CardNo == memberId && x.CC_AccountNo != null).Select(x => x.CC_AccountNo);
                var orders      = db.HisOrders.Where(x => account_ids.Contains(x.accountId.ToString()));

                var order_menus = orders.Select(x => x.menu).Distinct();
                foreach (var order_menu in order_menus)
                {
                    if (order_menu.Contains("浴资"))
                    {
                        continue;
                    }
                    if (catgory != null)
                    {
                        var order_menu_obj = db.Menu.FirstOrDefault(x => x.name == order_menu);
                        if (order_menu_obj != null && order_menu_obj.catgoryId != catgory.id)
                        {
                            continue;
                        }
                    }
                    memberInfo.Add(order_menu, orders.Where(x => x.menu == order_menu).Count());
                }

                member_found = true;
                this.Invoke(new delegate_BindGrid(BindGrid));
            }
            catch (System.Exception ex)
            {
                BathClass.printErrorMsg(ex.Message);
            }
            finally
            {
                member_found = true;
            }
        }
Exemple #8
0
        //创建菜单类别界面
        private void createMenuTypePanel()
        {
            cPanel.Controls.Clear();
            bool first = true;
            int  x     = 10;
            int  y     = 9;

            //createButton(x, y, "技师", cPanel, 1, Color.Blue);
            //x += 80;

            //var typeLst = db.Catgory.Select(s => s.name);
            for (int i = m_index; i < typeList.Count(); i++)
            {
                Color color = first ? Color.Orange : Color.Blue;
                first = false;
                createButton(x, y, typeList.ToArray()[i], cPanel, 1, color);
                x += 80;
            }
            m_Catgory = db.Catgory.FirstOrDefault(z => z.name == typeList[0]);
            createMenuPanel();
        }
 public void UpdateCate(Catgory catgory)
 {
     _context.Catgories.Update(catgory);
 }
 public void AddCate(Catgory catgory)
 {
     throw new System.NotImplementedException();
 }
Exemple #11
0
 void ILogger.WriteLog(string strLog, Catgory catgory)
 {
 }