An example of data operation in nhib.pdf

Source: Internet
Author: User

An example of data operation in nhib.pdf

[Serializable ()] public class WF_SYS_GRANT_s_ex: WF_SYS_GRANT_s, IWF_SYS_GRANT_s_ex {public bool ExitsOrgBymc (string gmc) {bool rb= false; // string x = "select count (gmc) as rec_nums "; // x + =" from WF_SYS_GRANT where gmc = '"+ gmc +"' "; IList
 
  
T_list = null; if (this. dbsf! = Null) {using (ISession s = this. dbsf. OpenSession () {t_list = s. QueryOver
  
   
(). Where (c => c. GMC = gmc). List (); if (t_list! = Null & t_list.Count> 0) {rb_grant GetRecord (string gid) {// string x = "select * from WF_SYS_GRANT where gid = '" + gid + "'"; WF_SYS_GRANT tab = this. getRecordByID (gid); return tab;} public bool DeleteRecordsByid (string gid) {bool rbc = false; // string x = ""; // x = "delete from WF_SYS_GRANT where gid = '" + gid + "'"; IList
   
    
T_list = null; if (this. dbsf! = Null) {using (ISession s = this. dbsf. OpenSession () {t_list = s. QueryOver
    
     
(). Where (c => c. GID = gid). List (); if (t_list! = Null & t_list.Count> 0) {this. deleteList (t_list) ;}}return rb;}// public int GetRelationUserCount (string gid) {int rbc = 0; // string x = "select count (uid) as num_count from WF_SYS_USER_ROLE "; // x + =" where rid in (select rid from WF_SYS_ROLE_GRANT where gid = '"+ gid +"') "; IList
     
      
T_list = null; if (this. dbsf! = Null) {using (ISession s = this. dbsf. OpenSession () {// subquery QueryOver
      
        Sub_query = QueryOver.
       
         (). Where (c => c. GID = gid). Select (c => c. RID); // main query t_list = s. QueryOver
        
          (). WithSubquery. WhereProperty (x => x. RID). In (sub_query). List (); if (t_list! = Null & t_list.Count> 0) {rbc = t_list.Count () ;}} return rb;} public int GetRelationRoleCount (string gid) {int rb= 0; // string x = "select count (rid) as num_count from WF_SYS_ROLE_GRANT where gid = '" + gid + "'"; IList
         
           T_list = null; if (this. dbsf! = Null) {using (ISession s = this. dbsf. OpenSession () {// main query t_list = s. QueryOver
          
            (). Where (c => c. GID = gid). List (); if (t_list! = Null & t_list.Count> 0) {rbc = t_list.Count () ;}} return rb ;}//}
          
         
        
       
      
     
    
   
  
 

[Serializable ()] public class WF_SYS_GRANT_s: AbsDataMethod
 
  
{Public WF_SYS_GRANT_s () {this. _ modelName = "system permission table"; this. m_tableName = "WF_SYS_GRANT";} public override IList
  
   
LoadALL () {using (ISession s = this. dbsf. OpenSession () {IList
   
    
List = s. QueryOver
    
     
(). OrderBy (c => c. GID). Asc. List (); return list;} public override IList
     
      
LoadList (object value) {using (ISession s = this. dbsf. OpenSession () {IList
      
        List = s. QueryOver
       
         (). Where (c => c. GID = value ). orderBy (c => c. GID ). asc. list (); return list;} public override object GetKey (Cwfapi. model. WF_SYS_GRANT entity) {return entity. GID ;}}
       
      
     
    
   
  
 

[Serializable()]    public class WF_SYS_GRANT:BaseDbTable    {        public virtual String GID { get; set; }        public virtual String GMC { get; set; }        public virtual String MS { get; set; }        public virtual String EXTFD_1 { get; set; }        public virtual String GTYPE { get; set; }        public override object Clone()        {            WF_SYS_GRANT tab = new WF_SYS_GRANT();            tab.GID = this.GID;            tab.GMC = this.GMC;            tab.MS = this.MS;            tab.EXTFD_1 = this.EXTFD_1;            tab.GTYPE = this.GTYPE;            return tab;        }        public override void CopyAttributeFromObject(object obj)        {            WF_SYS_GRANT t = obj as WF_SYS_GRANT;            if (t != null)            {                this.GID = t.GID;                this.GMC = t.GMC;                this.MS = t.MS;                this.EXTFD_1 = t.EXTFD_1;                this.GTYPE = t.GTYPE;            }        }    }

[Serializable ()] public abstract class BaseDbTable: ILifecycle, IValidatable, lifecycle, ICloneable {# region ILifecycle member public virtual LifecycleVeto OnDelete (ISession s) {return LifecycleVeto. noVeto;} public virtual void OnLoad (ISession s, object id) {} public virtual LifecycleVeto OnSave (ISession s) {return LifecycleVeto. noVeto;} public virtual LifecycleVeto OnUpdate (ISess Ion s) {return LifecycleVeto. NoVeto;} # endregion # region IValidatable member public virtual void Validate () {if (1! = 1) {throw new ValidationFailure () ;}# endregion # region ICloneable member public abstract object Clone (); # endregion # region ICopyAttributeFromObject member public abstract void CopyAttributeFromObject (object obj ); # endregion} public interface ICopyAttributeFromObject {void CopyAttributeFromObject (object obj );}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.