コード例 #1
0
        private void Button_Click_3(object sender, RoutedEventArgs e)//submit
        {
            ObservableCollection <ui_mark> custdata;

            custdata = (ObservableCollection <ui_mark>)dg_mark.DataContext;

            int i = 0;

            foreach (ui_mark ss in custdata)
            {
                if (ss.Delete == true)
                {
                    sp_bll.mark_process.mark_delete(sp_bll.mark_process.get_single(ss.mk_index));
                }
                if (ss.Update == true)
                {
                    //tbl_course course_update = sp_bll.Course.get_single_course(tablebefore[i].Num);
                    //try
                    //{
                    //    course_update.C_Num = ss.Num;
                    //    course_update.C_Name = ss.Name;
                    //    course_update.C_Course = ss.Describe;
                    //}
                    //catch (Exception ex)
                    //{
                    //    ModernDialog.ShowMessage("Some important data may be change unsuccessful \nsystem message:" + ex.Message + MainWindow.loginuser.U_Power, "User Input ERROR", MessageBoxButton.OK);
                    //}
                    //sp_bll.Course.update(course_update);
                    v_mark mark_update = sp_bll.mark_process.get_single(tablebefore[i].mk_index);
                    try
                    {
                        Err ee = sp_bll.mark_process.mark_update(mark_update.mk_index, Convert.ToDecimal(ss.C_mark));
                    }
                    catch (Exception ex)
                    {
                        ModernDialog.ShowMessage(ex.Message, "ERROR", MessageBoxButton.OK);
                    }
                }
                i++;
            }
            loadtable();
        }
コード例 #2
0
        public static Err mark_update(v_mark vv)
        {
            Err e = new Err();

            try
            {
                using (var db = new DataBase())
                {
                    tbl_stu_mark tsm = (
                        from d in db.tbl_stu_mark
                        where d.mk_index == vv.mk_index
                        select d
                        ).Single();
                    tsm.mk_mark = vv.mk_mark;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                e.res  = false;
                e.info = ex.Message;
            }
            return(e);
        }