Exemple #1
0
 public Model.Management.Master.SiteMaster_stm_Info GetRecord_Last()
 {
     try
     {
         using (VPMSDBDataContext db = new VPMSDBDataContext())
         {
             IQueryable <SiteMaster_stm> taQuery =
                 (from stms in db.SiteMaster_stms
                  orderby stms.stm_iRecordID descending
                  select stms).Take(1);
             SiteMaster_stm_Info info = new SiteMaster_stm_Info();
             if (taQuery.Count() > 0)
             {
                 foreach (var t in taQuery)
                 {
                     info = Common.General.CopyObjectValue <SiteMaster_stm, model.SiteMaster_stm_Info>(t);
                 }
             }
             return(info);
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
Exemple #2
0
        public Model.Management.Master.SiteMaster_stm_Info GetRecord_Previous(Model.Base.DataBaseCommandInfo commandInfo)
        {
            SiteMaster_stm_Info info = null;

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

                    if (taQuery.Count() > 0)
                    {
                        foreach (var t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <SiteMaster_stm, SiteMaster_stm_Info>(t);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                return(info);
            }
        }
Exemple #3
0
        public bool IsExistRecord(object KeyObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                SiteMaster_stm_Info stm = new SiteMaster_stm_Info();
                try
                {
                    stm = KeyObject as SiteMaster_stm_Info;
                    //stm = Common.General.CopyObjectValue<object, SiteMaster_stm_Info>(KeyObject);

                    IQueryable <SiteMaster_stm> taQuery =
                        (from stms in db.SiteMaster_stms where stms.stm_cNumber == stm.stm_cNumber select stms);
                    if (taQuery.Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Exemple #4
0
        public Model.Management.Master.SiteMaster_stm_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            SiteMaster_stm_Info stm  = new SiteMaster_stm_Info();
            SiteMaster_stm_Info info = new SiteMaster_stm_Info();

            stm = KeyObject as SiteMaster_stm_Info;
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    IQueryable <SiteMaster_stm> taQuery =
                        (from stms in db.SiteMaster_stms
                         where stms.stm_iRecordID == stm.stm_iRecordID
                         //orderby dpms.dpm_iRecordID ascending
                         select stms).Take(1);

                    if (taQuery != null)
                    {
                        //foreach (var t in taQuery)
                        foreach (SiteMaster_stm t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <SiteMaster_stm, SiteMaster_stm_Info>(t);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Exemple #5
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            bool checkstm;

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

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

                return(msg);
            }

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

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

                case Common.DefineConstantValue.EditStateEnum.OE_Update:
                    checkstm = this._isteMasterDA.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);
        }
Exemple #6
0
        public Model.Management.Master.SiteMaster_stm_Info GetRecord_Last()
        {
            SiteMaster_stm_Info info = null;

            try
            {
                info = this._isteMasterDA.GetRecord_Last();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(info);
        }
Exemple #7
0
        public Model.Management.Master.SiteMaster_stm_Info GetRecord_First()
        {
            //Model.General.ReturnValueInfo msg = new Model.General.ReturnValueInfo();
            SiteMaster_stm_Info info = null;

            try
            {
                info = this._isteMasterDA.GetRecord_First();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(info);
        }
Exemple #8
0
        public Model.IModel.IModelObject GetTableFieldLenght()
        {
            LocalGeneral        general = new LocalGeneral();
            SiteMaster_stm_Info info    = null;

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

            return(info);
        }
Exemple #9
0
        public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
        {
            SiteMaster_stm_Info info = null;

            try
            {
                info = KeyObject as SiteMaster_stm_Info;
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    SiteMaster_stm stm = db.SiteMaster_stms.Single <SiteMaster_stm>(i => i.stm_iRecordID == info.stm_iRecordID);
                    db.SiteMaster_stms.DeleteOnSubmit(stm);
                    db.SubmitChanges();
                    return(true);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Exemple #10
0
 public Model.IModel.IModelObject DisplayRecord(Model.IModel.IModelObject itemEntity)
 {
     if (itemEntity == null)
     {
         return(null);
     }
     else
     {
         SiteMaster_stm_Info info = null;
         try
         {
             info = this._isteMasterDA.DisplayRecord(itemEntity);
         }
         catch (Exception Ex)
         {
             throw Ex;
         }
         return(info);
     }
 }
Exemple #11
0
        public Model.Management.Master.SiteMaster_stm_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo)
        {
            SiteMaster_stm_Info info = null;

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

                return(info);
            }
        }