Beispiel #1
0
        public Model.Management.Master.SchoolMaster_scm_Info GetRecord_Last()
        {
            IQueryable <SchoolMaster_scm> taQuery = null;

            Model.Management.Master.SchoolMaster_scm_Info tab = null;
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    taQuery =
                        (from ta in db.SchoolMaster_scm
                         orderby ta.scm_iRecordID descending
                         select ta).Take(1);

                    foreach (SchoolMaster_scm t in taQuery)
                    {
                        tab = Common.General.CopyObjectValue <SchoolMaster_scm, Model.Management.Master.SchoolMaster_scm_Info>(t);
                        break;
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(tab);
        }
Beispiel #2
0
        public bool UpdateRecord(Model.Management.Master.SchoolMaster_scm_Info infoObject)
        {
            SchoolMaster_scm tab       = new SchoolMaster_scm();
            bool             isSuccess = false;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    tab = db.SchoolMaster_scm.SingleOrDefault(t => t.scm_cNumber == infoObject.scm_cNumber);
                    if (tab != null)
                    {
                        tab.scm_cName     = infoObject.scm_cName;
                        tab.scm_cRemark   = infoObject.scm_cRemark;
                        tab.scm_cLast     = infoObject.scm_cLast;
                        tab.scm_dLastDate = infoObject.scm_dLastDate;
                        //tab=Common.General.SetDataToLingQEntity(tab, infoObject);
                    }
                    db.SubmitChanges();
                    isSuccess = true;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(isSuccess);
        }
Beispiel #3
0
        private bool InsertRecord(Model.Management.Master.SchoolMaster_scm_Info infoObject)
        {
            bool tabB = _schoolMasterDA.IsExistRecord((infoObject as SchoolMaster_scm_Info).scm_cNumber);

            if (!tabB)
            {
                return(_schoolMasterDA.InsertRecord(infoObject));
            }
            return(false);
        }
Beispiel #4
0
        public Model.Management.Master.SchoolMaster_scm_Info GetRecord_Previous(Model.Base.DataBaseCommandInfo commandInfo)
        {
            string RecordID = null;
            IQueryable <SchoolMaster_scm> taQuery = null;

            Model.Management.Master.SchoolMaster_scm_Info tab = null;
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    if (commandInfo.KeyInfoList != null)
                    {
                        //foreach (var t in commandInfo.KeyInfoList)
                        //{
                        //    if (t.Key == "scm_iRecordID")
                        //    {
                        //        RecordID = t.KeyValue.ToString();
                        //        break;
                        //    }
                        //}
                        RecordID = commandInfo.KeyInfoList[0].KeyValue.ToString();
                        taQuery  =
                            (from ta in db.SchoolMaster_scm
                             where ta.scm_iRecordID < Convert.ToInt32(RecordID)
                             orderby ta.scm_iRecordID descending
                             select ta).Take(1);

                        if (taQuery.Count() > 0)
                        {
                            foreach (SchoolMaster_scm t in taQuery)
                            {
                                tab = Common.General.CopyObjectValue <SchoolMaster_scm, SchoolMaster_scm_Info>(t);
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(tab);
        }
Beispiel #5
0
        public bool InsertRecord(Model.Management.Master.SchoolMaster_scm_Info infoObject)
        {
            SchoolMaster_scm tab       = null;
            bool             isSuccess = false;

            tab = Common.General.CopyObjectValue <SchoolMaster_scm_Info, SchoolMaster_scm>(infoObject);
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    db.SchoolMaster_scm.InsertOnSubmit(tab);
                    db.SubmitChanges();
                    isSuccess = true;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(isSuccess);
        }
Beispiel #6
0
        public Model.Management.Master.SchoolMaster_scm_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            model.SchoolMaster_scm_Info info = null;
            SchoolMaster_scm            tab  = null;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    info = new model.SchoolMaster_scm_Info();
                    tab  = db.SchoolMaster_scm.SingleOrDefault(t => t.scm_iRecordID == (KeyObject as SchoolMaster_scm_Info).RecordID);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            if (tab != null)
            {
                info = Common.General.CopyObjectValue <SchoolMaster_scm, SchoolMaster_scm_Info>(tab);
            }
            return(info);
        }
Beispiel #7
0
 private bool UpdateRecord(Model.Management.Master.SchoolMaster_scm_Info infoObject)
 {
     return(_schoolMasterDA.UpdateRecord(infoObject));
 }