Esempio n. 1
0
        public List <Sys_FunctionMaster_fum_Info> SearchRecords(Model.IModel.IModelObject searchCondition)
        {
            string sqlString   = string.Empty;
            string whereString = string.Empty;

            sqlString  = "SELECT TOP " + Common.DefineConstantValue.ListRecordMaxCount.ToString() + Environment.NewLine;
            sqlString += " fum_iRecordID," + Environment.NewLine;
            sqlString += " fum_cFunctionNumber," + Environment.NewLine;
            sqlString += " fum_cFunctionDesc," + Environment.NewLine;
            sqlString += " fum_cRemark," + Environment.NewLine;
            sqlString += " fum_cAdd," + Environment.NewLine;
            sqlString += " fum_dAddDate," + Environment.NewLine;
            sqlString += " fum_cLast," + Environment.NewLine;
            sqlString += " fum_dLastDate " + Environment.NewLine;
            sqlString += " FROM Sys_FunctionMaster_fum" + Environment.NewLine;


            Sys_FunctionMaster_fum_Info info = null;

            info = searchCondition as Sys_FunctionMaster_fum_Info;

            if (info != null)
            {
                whereString = " WHERE 1=1 ";
                if (info.fum_cFunctionNumber.Trim() != "")
                {
                    if (info.fum_cFunctionNumber.ToString().Contains("*") || info.fum_cFunctionNumber.ToString().Contains("?"))
                    {
                        whereString += " AND fum_cFunctionNumber LIKE N'" + LocalDefine.General.ReplaceSQLLikeCondition(info.fum_cFunctionNumber) + "'";
                    }
                    else
                    {
                        whereString += "AND fum_cFunctionNumber = N'" + info.fum_cFunctionNumber.ToString().Trim() + "'";
                    }
                }
            }

            sqlString += whereString;

            IEnumerable <Sys_FunctionMaster_fum_Info> infos    = null;
            List <Sys_FunctionMaster_fum_Info>        infoList = null;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    infos = db.ExecuteQuery <Sys_FunctionMaster_fum_Info>(sqlString, new object[] { });

                    if (infos != null)
                    {
                        infoList = infos.ToList <Sys_FunctionMaster_fum_Info>();
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(infoList);
        }
Esempio n. 2
0
 public Sys_FunctionMaster_fum_Info GetRecord_Last()
 {
     try
     {
         using (VPMSDBDataContext db = new VPMSDBDataContext())
         {
             IQueryable <Sys_FunctionMaster_fum> taQuery =
                 (from ta in db.Sys_FunctionMaster_fums
                  orderby ta.fum_iRecordID descending
                  select ta).Take(1);
             Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();
             if (taQuery.Count() > 0)
             {
                 foreach (var t in taQuery)
                 {
                     info = Common.General.CopyObjectValue <Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(t);
                     FindFormPurview(info);
                 }
             }
             return(info);
         }
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
Esempio n. 3
0
        public Sys_FunctionMaster_fum_Info DisplayRecord(Model.IModel.IModelObject KeyObject)
        {
            Sys_FunctionMaster_fum_Info fum  = new Sys_FunctionMaster_fum_Info();
            Sys_FunctionMaster_fum_Info info = new Sys_FunctionMaster_fum_Info();

            fum = KeyObject as Sys_FunctionMaster_fum_Info;
            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    IQueryable <Sys_FunctionMaster_fum> taQuery =
                        (from ta in db.Sys_FunctionMaster_fums
                         where ta.fum_iRecordID == fum.fum_iRecordID
                         //orderby dpms.dpm_iRecordID ascending
                         select ta).Take(1);

                    if (taQuery != null)
                    {
                        //foreach (var t in taQuery)
                        foreach (Sys_FunctionMaster_fum t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(t);
                            FindFormPurview(info);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Esempio n. 4
0
        public bool DeleteRecord(Model.IModel.IModelObject KeyObject)
        {
            Sys_FunctionMaster_fum_Info info = null;

            try
            {
                info = KeyObject as Sys_FunctionMaster_fum_Info;
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    Sys_FunctionMaster_fum fum = db.Sys_FunctionMaster_fums.Single <Sys_FunctionMaster_fum>(i => i.fum_iRecordID == info.fum_iRecordID);

                    for (int i = 0; i < fum.Sys_FormPurview_frps.Count; i++)
                    {
                        Sys_FormPurview_frp sta = fum.Sys_FormPurview_frps[i];
                        db.Sys_FormPurview_frps.DeleteOnSubmit(sta);
                    }


                    db.Sys_FunctionMaster_fums.DeleteOnSubmit(fum);
                    db.SubmitChanges();
                    return(true);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Esempio n. 5
0
        public Sys_FunctionMaster_fum_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo)
        {
            Sys_FunctionMaster_fum_Info info = null;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    string iRecordId = string.Empty;
                    foreach (var id in commandInfo.KeyInfoList)
                    {
                        iRecordId = id.KeyValue;
                        break;
                    }
                    IQueryable <Sys_FunctionMaster_fum> taQuery =
                        (from ta in db.Sys_FunctionMaster_fums
                         where ta.fum_iRecordID > Convert.ToInt32(iRecordId)
                         orderby ta.fum_iRecordID ascending
                         select ta).Take(1);
                    if (taQuery.Count() > 0)
                    {
                        foreach (var t in taQuery)
                        {
                            info = Common.General.CopyObjectValue <Sys_FunctionMaster_fum, Sys_FunctionMaster_fum_Info>(t);
                            FindFormPurview(info);
                        }
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                return(info);
            }
        }
Esempio n. 6
0
        public Sys_FunctionMaster_fum_Info GetRecord_First()
        {
            Sys_FunctionMaster_fum_Info info = null;

            try
            {
                info = this._sysFunctionMasterDA.GetRecord_First();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(info);
        }
Esempio n. 7
0
        public Model.IModel.IModelObject GetTableFieldLenght()
        {
            LocalGeneral general             = new LocalGeneral();
            Sys_FunctionMaster_fum_Info info = null;

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

            return(info);
        }
Esempio n. 8
0
 public Model.IModel.IModelObject DisplayRecord(Model.IModel.IModelObject itemEntity)
 {
     if (itemEntity == null)
     {
         return(null);
     }
     else
     {
         Sys_FunctionMaster_fum_Info info = null;
         try
         {
             info = this._sysFunctionMasterDA.DisplayRecord(itemEntity);
         }
         catch (Exception Ex)
         {
             throw Ex;
         }
         return(info);
     }
 }
Esempio n. 9
0
        public bool InsertRecord(Sys_FormMaster_fom_Info infoObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                Sys_FormMaster_fom frm = new Sys_FormMaster_fom();
                try
                {
                    frm = Common.General.CopyObjectValue <Sys_FormMaster_fom_Info, Sys_FormMaster_fom>(infoObject);


                    if (infoObject.functionMaster != null && infoObject.functionMaster.Count > 0)
                    {
                        for (int i = 0; i < infoObject.functionMaster.Count; i++)
                        {
                            Sys_FunctionMaster_fum_Info usmInfo = infoObject.functionMaster[i];

                            Sys_FormPurview_frp item = new Sys_FormPurview_frp();

                            item.frp_cFunctionNumber = usmInfo.fum_cFunctionNumber;
                            item.frp_cFormNumber     = infoObject.fom_cFormNumber;

                            item.frp_cPurviewCode = item.frp_cFunctionNumber + item.frp_cFormNumber;
                            //courseitem.cum_cNumber;
                            frm.Sys_FormPurview_frps.Add(item);
                            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                        }
                    }



                    db.Sys_FormMaster_foms.InsertOnSubmit(frm);
                    db.SubmitChanges();
                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Esempio n. 10
0
        public Sys_FunctionMaster_fum_Info GetRecord_Next(Model.Base.DataBaseCommandInfo commandInfo)
        {
            Sys_FunctionMaster_fum_Info info = null;

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

                return(info);
            }
        }
Esempio n. 11
0
        private Sys_FunctionMaster_fum_Info FindFormPurview(Sys_FunctionMaster_fum_Info info)
        {
            string sqlString = string.Empty;

            sqlString += "SELECT fom_cFormNumber,fom_cFormDesc " + Environment.NewLine;
            sqlString += "FROM Sys_FormMaster_fom " + Environment.NewLine;
            sqlString += "LEFT JOIN  Sys_FormPurview_frp" + Environment.NewLine;
            sqlString += "ON fom_cFormNumber=frp_cFormNumber" + Environment.NewLine;
            sqlString += "LEFT JOIN Sys_FunctionMaster_fum" + Environment.NewLine;
            sqlString += "ON frp_cFunctionNumber=fum_cFunctionNumber WHERE fum_iRecordID='" + info.fum_iRecordID + "'";

            IEnumerable <Sys_FormMaster_fom_Info> infos    = null;
            List <Sys_FormMaster_fom_Info>        infoList = null;

            try
            {
                using (VPMSDBDataContext db = new VPMSDBDataContext())
                {
                    infos = db.ExecuteQuery <Sys_FormMaster_fom_Info>(sqlString, new object[] { });

                    if (infos != null)
                    {
                        infoList = infos.ToList <Sys_FormMaster_fom_Info>();
                    }
                    foreach (Sys_FormMaster_fom_Info t in infoList)
                    {
                        info.formMaster.Add(t);
                    }
                    return(info);
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Esempio n. 12
0
        public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
        {
            bool b;

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

            info = itemEntity as Sys_FunctionMaster_fum_Info;

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

                return(msg);
            }

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

                case Common.DefineConstantValue.EditStateEnum.OE_Insert:

                    b = this._sysFunctionMasterDA.IsExistRecord(info);
                    if (b == false)
                    {
                        this._sysFunctionMasterDA.InsertRecord(info);
                    }
                    else
                    {
                        msg.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_I_AddFail + "  功能编号重复!";
                    }
                    break;

                case Common.DefineConstantValue.EditStateEnum.OE_Update:
                    b = this._sysFunctionMasterDA.UpdateRecord(info);
                    //if (b == 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);
        }
Esempio n. 13
0
        public bool UpdateRecord(Sys_FormMaster_fom_Info infoObject)
        {
            using (VPMSDBDataContext db = new VPMSDBDataContext())
            {
                Sys_FormMaster_fom frm = new Sys_FormMaster_fom();
                try
                {
                    frm = db.Sys_FormMaster_foms.SingleOrDefault(t => t.fom_iRecordID == infoObject.fom_iRecordID);

                    for (int i = 0; i < frm.Sys_FormPurview_frps.Count; i++)
                    {
                        Sys_FormPurview_frp sta = frm.Sys_FormPurview_frps[i];
                        db.Sys_FormPurview_frps.DeleteOnSubmit(sta);
                    }



                    string sqlString             = string.Empty;
                    Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info();

                    info = Common.General.CopyObjectValue <Sys_FormMaster_fom, Sys_FormMaster_fom_Info>(frm);

                    IEnumerable <Sys_FormMaster_fom_Info>  IEfom = null;
                    IEnumerable <Sys_FormPurview_frp_Info> IEfrp = null;

                    sqlString += "UPDATE Sys_FormMaster_fom" + Environment.NewLine;
                    sqlString += " SET fom_cFormNumber='" + infoObject.fom_cFormNumber + "'," + Environment.NewLine;
                    sqlString += " fom_cFormDesc='" + infoObject.fom_cFormDesc + "'," + Environment.NewLine;
                    sqlString += " fom_cExePath='" + infoObject.fom_cExePath + "'," + Environment.NewLine;
                    sqlString += " fom_cWebPath='" + infoObject.fom_cWebPath + "'," + Environment.NewLine;

                    sqlString += " fom_iWebForm='" + infoObject.fom_iWebForm + "'," + Environment.NewLine;
                    //sqlString += " fom_cExePath='" + infoObject.rlm_cLast + "'," + Environment.NewLine;
                    sqlString += " fom_iParentID='" + infoObject.fom_iParentID + "'," + Environment.NewLine;
                    sqlString += " fom_iIndex='" + infoObject.fom_iIndex + "'," + Environment.NewLine;
                    sqlString += " fom_cLast='" + infoObject.fom_cLast + "'," + Environment.NewLine;
                    sqlString += " fom_dLastDate='" + infoObject.fom_dLastDate.Value.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine;

                    sqlString += " WHERE fom_iRecordID='" + infoObject.fom_iRecordID + "'";

                    IEfom = db.ExecuteQuery <Sys_FormMaster_fom_Info>(sqlString, new object[] { });

                    sqlString  = string.Empty;
                    sqlString += "DELETE FROM Sys_FormPurview_frp WHERE frp_cFormNumber='" + infoObject.fom_cFormNumber + "'";
                    IEfrp      = db.ExecuteQuery <Sys_FormPurview_frp_Info>(sqlString, new object[] { });


                    if (infoObject.functionMaster != null && infoObject.functionMaster.Count > 0)
                    {
                        for (int i = 0; i < infoObject.functionMaster.Count; i++)
                        {
                            sqlString = string.Empty;
                            Sys_FunctionMaster_fum_Info fomInfo = infoObject.functionMaster[i];

                            string frp_code = fomInfo.fum_cFunctionNumber + infoObject.fom_cFormNumber;

                            sqlString += "INSERT INTO Sys_FormPurview_frp" + Environment.NewLine;
                            sqlString += "(frp_cPurviewCode, frp_cFunctionNumber, frp_cFormNumber)" + Environment.NewLine;
                            sqlString += " VALUES " + Environment.NewLine;
                            sqlString += "('" + frp_code + "','" + fomInfo.fum_cFunctionNumber + "','" + infoObject.fom_cFormNumber + "')";

                            IEfrp = db.ExecuteQuery <Sys_FormPurview_frp_Info>(sqlString, new object[] { });
                        }
                    }


                    //if (frm != null)
                    //{
                    //    frm.fom_cFormNumber = infoObject.fom_cFormNumber;
                    //    frm.fom_cFormDesc = infoObject.fom_cFormDesc;
                    //    frm.fom_cExePath = infoObject.fom_cExePath;

                    //    frm.fom_cWebPath = infoObject.fom_cWebPath;
                    //    frm.fom_iWebForm = infoObject.fom_iWebForm;

                    //    //frm.fom_iImageIndex = infoObject.fom_iImageIndex;

                    //    frm.fom_iParentID = infoObject.fom_iParentID;
                    //    frm.fom_iIndex = infoObject.fom_iIndex;

                    //    frm.fom_cLast = infoObject.fom_cLast;
                    //    frm.fom_dLastDate = infoObject.fom_dLastDate.Value;


                    //    if (infoObject.functionMaster != null && infoObject.functionMaster.Count > 0)
                    //    {
                    //        for (int i = 0; i < infoObject.functionMaster.Count; i++)
                    //        {
                    //            Sys_FunctionMaster_fum_Info usmInfo = infoObject.functionMaster[i];

                    //            Sys_FormPurview_frp item = new Sys_FormPurview_frp();

                    //            item.frp_cFunctionNumber = usmInfo.fum_cFunctionNumber;
                    //            item.frp_cFormNumber = infoObject.fom_cFormNumber;

                    //            item.frp_cPurviewCode = item.frp_cFunctionNumber + item.frp_cFormNumber;
                    //            //courseitem.cum_cNumber;
                    //            frm.Sys_FormPurview_frps.Add(item);
                    //            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                    //        }
                    //    }


                    //    db.SubmitChanges();
                    //}
                    return(true);
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }