예제 #1
0
        public SpecialtyMaster_spm_Info GetRecord_Previous(Model.Base.DataBaseCommandInfo commandInfo)
        {
            SpecialtyMaster_spm_Info info = null;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    string iRecordId = string.Empty;
                    foreach (var id in commandInfo.KeyInfoList)
                    {
                        iRecordId = id.KeyValue;
                        break;
                    }
                    IQueryable <SpecialtyMaster_spm> taQuery =
                        (from spms in db.SpecialtyMaster_spms
                         where spms.spm_iRecordID < Convert.ToInt32(iRecordId)
                         orderby spms.spm_iRecordID descending
                         select spms).Take(1);

                    if (taQuery.Count() > 0)
                    {
                        foreach (SpecialtyMaster_spm t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <SpecialtyMaster_spm, SpecialtyMaster_spm_Info>(t);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                return(info);
            }
        }
예제 #2
0
        public SpecialtyMaster_spm_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            SpecialtyMaster_spm_Info spm  = new SpecialtyMaster_spm_Info();
            SpecialtyMaster_spm_Info info = new SpecialtyMaster_spm_Info();

            spm = KeyObject as SpecialtyMaster_spm_Info;
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    IQueryable <SpecialtyMaster_spm> taQuery =
                        (from spms in db.SpecialtyMaster_spms
                         where spms.spm_iRecordID == spm.spm_iRecordID
                         //orderby dpms.dpm_iRecordID ascending
                         select spms).Take(1);

                    if (taQuery != null)
                    {
                        //foreach (var t in taQuery)
                        foreach (SpecialtyMaster_spm t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <SpecialtyMaster_spm, SpecialtyMaster_spm_Info>(t);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
예제 #3
0
 public SpecialtyMaster_spm_Info GetRecord_Last()
 {
     try
     {
         using (VPMSDBDataContext db = new VPMSDBDataContext())
         {
             IQueryable <SpecialtyMaster_spm> taQuery =
                 (from spms in db.SpecialtyMaster_spms
                  orderby spms.spm_iRecordID descending
                  select spms).Take(1);
             SpecialtyMaster_spm_Info info = new SpecialtyMaster_spm_Info();
             if (taQuery.Count() > 0)
             {
                 foreach (SpecialtyMaster_spm t in taQuery)
                 {
                     info = Common.General.CopyObjectValue <SpecialtyMaster_spm, model.SpecialtyMaster_spm_Info>(t);
                 }
             }
             return(info);
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
예제 #4
0
        public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
        {
            SpecialtyMaster_spm_Info info = null;

            try
            {
                info = KeyObject as SpecialtyMaster_spm_Info;
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    SpecialtyMaster_spm spm = db.SpecialtyMaster_spms.Single <SpecialtyMaster_spm>(i => i.spm_iRecordID == info.spm_iRecordID);

                    for (int i = 0; i < spm.SpecialtyMasterCourse_smcs.Count; i++)
                    {
                        SpecialtyMasterCourse_smc sta = spm.SpecialtyMasterCourse_smcs[i];
                        db.SpecialtyMasterCourse_smcs.DeleteOnSubmit(sta);
                    }

                    db.SpecialtyMaster_spms.DeleteOnSubmit(spm);

                    db.SubmitChanges();
                }


                return(true);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
예제 #5
0
        public bool UpdateRecord(SpecialtyMaster_spm_Info infoObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                SpecialtyMaster_spm spm = new SpecialtyMaster_spm();
                try
                {
                    spm = db.SpecialtyMaster_spms.SingleOrDefault(t => t.spm_iRecordID == infoObject.spm_iRecordID);
                    for (int i = 0; i < spm.SpecialtyMasterCourse_smcs.Count; i++)
                    {
                        SpecialtyMasterCourse_smc sta = spm.SpecialtyMasterCourse_smcs[i];
                        db.SpecialtyMasterCourse_smcs.DeleteOnSubmit(sta);
                    }
                    if (spm != null)
                    {
                        spm.spm_cName     = infoObject.spm_cName;
                        spm.spm_cNumber   = infoObject.spm_cNumber;
                        spm.spm_cRemark   = infoObject.spm_cRemark;
                        spm.spm_cLast     = infoObject.spm_cLast;
                        spm.spm_dLastDate = infoObject.spm_dLastDate.Value;

                        db.SubmitChanges();
                    }

                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
예제 #6
0
        public bool InsertRecord(SpecialtyMaster_spm_Info infoObject)
        {
            if (infoObject == null)
            {
                return(false);
            }

            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                SpecialtyMaster_spm spm = new SpecialtyMaster_spm();
                try
                {
                    spm = Common.General.CopyObjectValue <Model.Management.Master.SpecialtyMaster_spm_Info, SpecialtyMaster_spm>(infoObject);

                    IQueryable <SpecialtyMaster_spm> taQuery =
                        (from spms in db.SpecialtyMaster_spms where spms.spm_cNumber == spm.spm_cNumber select spms);

                    db.SpecialtyMaster_spms.InsertOnSubmit(spm);
                    db.SubmitChanges();
                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
예제 #7
0
        public bool IsExistRecord(object KeyObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                SpecialtyMaster_spm_Info spm = new SpecialtyMaster_spm_Info();
                try
                {
                    spm = Common.General.CopyObjectValue <object, SpecialtyMaster_spm_Info>(KeyObject);

                    IQueryable <SpecialtyMaster_spm> taQuery =
                        (from spms in db.SpecialtyMaster_spms where spms.spm_cNumber == spm.spm_cNumber select spms);
                    if (taQuery.Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
예제 #8
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            bool checkstm;

            Model.General.ReturnValueInfo msg  = new Model.General.ReturnValueInfo();
            SpecialtyMaster_spm_Info      info = null;

            info = itemEntity as SpecialtyMaster_spm_Info;
            if (info == null)
            {
                msg.boolValue   = false;
                msg.messageText = "传入的数据为空!";

                return(msg);
            }
            try
            {
                switch (EditMode)
                {
                case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                    checkstm = this._specialtyMasterDA.DeleteRecord(info);
                    if (checkstm == true)
                    {
                        msg.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_I_RecordByDelete;
                    }
                    break;

                case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                    checkstm = this._specialtyMasterDA.IsExistRecord(info);
                    if (checkstm == false)
                    {
                        this._specialtyMasterDA.InsertRecord(info);
                    }
                    else
                    {
                        msg.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_I_AddFail + " 专业编号重复!";
                    }
                    break;

                case Common.DefineConstantValue.EditStateEnum.OE_Update:
                    checkstm = this._specialtyMasterDA.UpdateRecord(info);
                    //if (checkstm == true)
                    //{
                    //    msg.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_I_UpdateSuccess;
                    //}
                    //else
                    //{
                    //    msg.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_I_UpdateFail;
                    //}
                    break;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(msg);
        }
예제 #9
0
        public SpecialtyMaster_spm_Info GetRecord_Last()
        {
            SpecialtyMaster_spm_Info info = null;

            try
            {
                info = this._specialtyMasterDA.GetRecord_Last();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(info);
        }
예제 #10
0
        public Model.IModel.IModelObject GetTableFieldLenght()
        {
            LocalGeneral             general = new LocalGeneral();
            SpecialtyMaster_spm_Info info    = null;

            try
            {
                info = general.GetTableFieldLenght <SpecialtyMaster_spm_Info>("SpecialtyMaster_spm");
            }
            catch (Exception Ex)
            {
                throw Ex;
            }

            return(info);
        }
예제 #11
0
 public Model.IModel.IModelObject DisplayRecord(Model.IModel.IModelObject itemEntity)
 {
     if (itemEntity == null)
     {
         return(null);
     }
     else
     {
         SpecialtyMaster_spm_Info info = null;
         try
         {
             info = this._specialtyMasterDA.DisplayRecord(itemEntity);
         }
         catch (Exception Ex)
         {
             throw Ex;
         }
         return(info);
     }
 }
예제 #12
0
        public SpecialtyMaster_spm_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo)
        {
            SpecialtyMaster_spm_Info info = null;

            if (commandInfo.KeyInfoList == null)
            {
                return(info);
            }
            else
            {
                try
                {
                    info = this._specialtyMasterDA.GetRecord_Next(commandInfo);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }

                return(info);
            }
        }