Esempio n. 1
0
        private sm01_soft_keep_main SM01VMtoM(SM01ViewModel viewmodel)
        {
            sm01_soft_keep_main _model = new sm01_soft_keep_main();

            _model.year           = viewmodel.year;
            _model.org            = viewmodel.org;
            _model.dept           = viewmodel.dept;
            _model.soft_id        = viewmodel.soft_id;
            _model.soft_name      = string.IsNullOrEmpty(viewmodel.soft_name) ? null : viewmodel.soft_name.Trim();
            _model.user_id        = string.IsNullOrEmpty(viewmodel.user_id) ? null : viewmodel.user_id.Trim();
            _model.soft_type      = string.IsNullOrEmpty(viewmodel.soft_type) ? null : viewmodel.soft_type.Trim();
            _model.soft_sn        = string.IsNullOrEmpty(viewmodel.soft_sn) ? null : viewmodel.soft_sn.Trim();
            _model.soft_for       = string.IsNullOrEmpty(viewmodel.soft_for) ? null : viewmodel.soft_for.Trim();
            _model.soft_work_on   = string.IsNullOrEmpty(viewmodel.soft_work_on) ? null : viewmodel.soft_work_on.Trim();
            _model.soft_max_user  = viewmodel.soft_max_user == null ? null : viewmodel.soft_max_user;
            _model.soft_number    = viewmodel.soft_number == null ? null : viewmodel.soft_number;
            _model.soft_cost      = viewmodel.soft_cost == null ? null : viewmodel.soft_cost;
            _model.soft_platform  = string.IsNullOrEmpty(viewmodel.soft_platform) ? null : viewmodel.soft_platform.Trim();
            _model.soft_from      = string.IsNullOrEmpty(viewmodel.soft_from) ? null : viewmodel.soft_from.Trim();
            _model.soft_from_unit = string.IsNullOrEmpty(viewmodel.soft_from_unit) ? null : viewmodel.soft_from_unit.Trim();
            _model.soft_keeper    = string.IsNullOrEmpty(viewmodel.soft_keeper) ? null : viewmodel.soft_keeper.Trim();
            _model.soft_doc       = string.IsNullOrEmpty(viewmodel.soft_doc) ? null : viewmodel.soft_doc.Trim();
            _model.install_date   = viewmodel.install_date == null ? System.DateTime.MinValue : viewmodel.install_date.ToLocalTime();
            _model.install_place  = string.IsNullOrEmpty(viewmodel.install_place) ? null : viewmodel.install_place.Trim();
            _model.memo           = string.IsNullOrEmpty(viewmodel.memo) ? null : viewmodel.memo.Trim();
            return(_model);
        }
Esempio n. 2
0
        private sm01_soft_keep_main SM01VMtoM(SM01ViewModel viewmodel)
        {
            sm01_soft_keep_main _model = new sm01_soft_keep_main();

            _model.year           = viewmodel.year;
            _model.org            = viewmodel.org;
            _model.dept           = viewmodel.dept;
            _model.soft_id        = viewmodel.soft_id;
            _model.soft_name      = viewmodel.soft_name;
            _model.user_id        = viewmodel.user_id;
            _model.soft_type      = viewmodel.soft_type;
            _model.soft_sn        = viewmodel.soft_sn;
            _model.soft_for       = viewmodel.soft_for;
            _model.soft_work_on   = viewmodel.soft_work_on;
            _model.soft_max_user  = viewmodel.soft_max_user;
            _model.soft_number    = viewmodel.soft_number;
            _model.soft_platform  = viewmodel.soft_platform;
            _model.soft_from      = viewmodel.soft_from;
            _model.soft_from_unit = viewmodel.soft_from_unit;
            _model.soft_keeper    = viewmodel.soft_keeper;
            _model.soft_doc       = viewmodel.soft_doc;
            _model.install_date   = viewmodel.install_date;
            _model.install_place  = viewmodel.install_place;
            _model.memo           = viewmodel.memo;
            return(_model);
        }
Esempio n. 3
0
        public void saveSM01(SM01ViewModel viewmodel)
        {
            sm01_soft_keep_main _model = SM01VMtoM(viewmodel);
            IRepository <sm01_soft_keep_main> db_getmkdate = new GenericRepository <sm01_soft_keep_main>();

            _model.make_date = db_getmkdate.Get().Where(x => x.soft_id == _model.soft_id).ToList()[0].make_date;
            db.Update(_model);
        }
Esempio n. 4
0
        //private sm02_soft_keep_detail SM01VMtoSM02VM(SM01ViewModel viewmodel)
        //{
        //    sm02_soft_keep_detail _model = new sm02_soft_keep_detail();
        //    _model.year = viewmodel.year;
        //    _model.org = viewmodel.org;
        //    _model.dept = viewmodel.dept;
        //    _model.soft_id = viewmodel.soft_id;
        //    _model.keep_org = "";
        //    return _model;
        //}

        public void addSM01(SMViewModel viewmodel)
        {
            IRepository <sm02_soft_keep_detail> db2 = new GenericRepository <sm02_soft_keep_detail>();
            SM01ViewModel         SM01VM            = SMVMtoSM01VM(viewmodel);
            SM02ViewModel         SM02VM            = SMVMtoSM02VM(viewmodel);
            sm01_soft_keep_main   _SM01model        = SM01VMtoM(SM01VM);
            sm02_soft_keep_detail _SM02model        = SM02VMtoM(SM02VM);

            db.Insert(_SM01model);
            db2.Insert(_SM02model);
        }
Esempio n. 5
0
        public SM01ViewModel Get(string year, string org, string dept, string soft_id)
        {
            List <SM01ViewModel> model = new List <SM01ViewModel>();
            //var dbresult = db.Get().AsQueryable();
            var dbresult = db.Get().ToList();
            //var result = dbresult.Find(year, org, dept, soft_id);
            int  i       = 0;
            bool isfound = false;
            sm01_soft_keep_main result = new sm01_soft_keep_main();

            while (i < dbresult.Count && !isfound)
            {
                if (dbresult[i].year.Trim() == year && dbresult[i].org.Trim() == org && dbresult[i].dept.Trim() == dept && dbresult[i].soft_id.Trim() == soft_id)
                {
                    result  = dbresult[i];
                    isfound = true;
                }
                i++;
            }
            if (isfound)
            {
                SM01ViewModel _model = new SM01ViewModel();
                _model.year           = result.year.Trim();
                _model.org            = result.org.Trim();
                _model.dept           = result.dept.Trim();
                _model.soft_id        = result.soft_id.Trim();
                _model.soft_name      = string.IsNullOrEmpty(result.soft_name) ? null : result.soft_name.Trim();
                _model.user_id        = string.IsNullOrEmpty(result.user_id) ? null : result.user_id.Trim();
                _model.soft_type      = string.IsNullOrEmpty(result.soft_type) ? null : result.soft_type.Trim();
                _model.soft_sn        = string.IsNullOrEmpty(result.soft_sn) ? null : result.soft_sn.Trim();
                _model.soft_for       = string.IsNullOrEmpty(result.soft_for) ? null : result.soft_for.Trim();
                _model.soft_work_on   = string.IsNullOrEmpty(result.soft_work_on) ? null : result.soft_work_on.Trim();
                _model.soft_max_user  = result.soft_max_user == null ? null : result.soft_max_user;
                _model.soft_number    = result.soft_number == null ? null : result.soft_number;
                _model.soft_cost      = result.soft_cost == null ? null : result.soft_cost;
                _model.soft_platform  = string.IsNullOrEmpty(result.soft_platform) ? null : result.soft_platform.Trim();
                _model.soft_from      = string.IsNullOrEmpty(result.soft_from) ? null : result.soft_from.Trim();
                _model.soft_from_unit = string.IsNullOrEmpty(result.soft_from_unit) ? null : result.soft_from_unit.Trim();
                _model.soft_keeper    = string.IsNullOrEmpty(result.soft_keeper) ? null : result.soft_keeper.Trim();
                _model.soft_doc       = string.IsNullOrEmpty(result.soft_doc) ? null : result.soft_doc.Trim();
                _model.install_date   = result.install_date == null ? System.DateTime.MinValue : result.install_date.ToLocalTime();
                _model.install_place  = string.IsNullOrEmpty(result.install_place) ? null : result.install_place.Trim();
                _model.memo           = string.IsNullOrEmpty(result.memo) ? null : result.memo.Trim();
                model.Add(_model);
                return(_model);
            }
            else
            {
                return(new SM01ViewModel());
            }
        }
Esempio n. 6
0
        public SM01ViewModel Get(string year, string org, string dept, string soft_id)
        {
            List <SM01ViewModel> model = new List <SM01ViewModel>();
            //var dbresult = db.Get().AsQueryable();
            var dbresult = db.Get().ToList();
            //var result = dbresult.Find(year, org, dept, soft_id);
            int  i       = 0;
            bool isfound = false;
            sm01_soft_keep_main result = new sm01_soft_keep_main();

            while (i < dbresult.Count)
            {
                if (dbresult[i].year.Trim() == year && dbresult[i].org.Trim() == org && dbresult[i].dept.Trim() == dept && dbresult[i].soft_id.Trim() == soft_id)
                {
                    result  = dbresult[i];
                    isfound = true;
                }
                i++;
            }
            if (isfound)
            {
                SM01ViewModel _model = new SM01ViewModel();
                _model.year           = result.year.Trim();
                _model.org            = result.org.Trim();
                _model.dept           = result.dept.Trim();
                _model.soft_id        = result.soft_id.Trim();
                _model.soft_name      = result.soft_name.Trim();
                _model.user_id        = result.user_id.Trim();
                _model.soft_type      = result.soft_type.Trim();
                _model.soft_sn        = result.soft_sn.Trim();
                _model.soft_for       = result.soft_for.Trim();
                _model.soft_work_on   = result.soft_work_on.Trim();
                _model.soft_max_user  = result.soft_max_user;
                _model.soft_number    = result.soft_number;
                _model.soft_platform  = result.soft_platform.Trim();
                _model.soft_from      = result.soft_from.Trim();
                _model.soft_from_unit = result.soft_from_unit.Trim();
                _model.soft_keeper    = result.soft_keeper.Trim();
                _model.soft_doc       = result.soft_doc.Trim();
                _model.install_date   = result.install_date;
                _model.install_place  = result.install_place.Trim();
                _model.memo           = result.memo.Trim();
                model.Add(_model);
                return(_model);
            }
            else
            {
                return(new SM01ViewModel());
            }
        }
Esempio n. 7
0
        public void saveSM01(SM01ViewModel viewmodel)
        {
            sm01_soft_keep_main _model = SM01VMtoM(viewmodel);

            db.Update(_model);
        }