Exemple #1
0
        internal DOMAIN GetDomain(int id)
        {
            var domain = new DOMAIN();

            using (var connection = MySqlDbConnection.NewConnection)
            {
                _statement = string.Format(MySQLquery.GetDomain, id);
                using (var command = MySqlDbConnection.Command(connection, _statement))
                {
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                domain.DOM_ID      = UtilityDL.CheckNull <int>(reader["DOM_ID"]);
                                domain.NAME        = UtilityDL.CheckNull <string>(reader["NAME"]);
                                domain.DESCRIPTION = UtilityDL.CheckNull <string>(reader["DESCRIPTION"]);
                                domain.ORGL_STAMP  = UtilityDL.CheckNull <DateTime>(reader["ORGL_STAMP"]);
                                domain.ORGL_USER   = UtilityDL.CheckNull <string>(reader["ORGL_USER"]);
                                domain.UPDT_STAMP  = UtilityDL.CheckNull <DateTime>(reader["UPDT_STAMP"]);
                                domain.UPDT_USER   = UtilityDL.CheckNull <string>(reader["UPDT_USER"]);
                                domain.DEL_FLG     = UtilityDL.CheckNull <string>(reader["DEL_FLG"]);
                            }
                        }
                    }
                }
            }

            return(domain);
        }
Exemple #2
0
        public FLI(string name, DOMAIN domain)
        {
            int status = FLIOpen(out dev, name, domain);

            if (0 != status)
            {
                throw new Win32Exception(-status);
            }
        }
 // POST: api/Domain
 //[HttpPost]
 /// <summary>
 /// It takes the parameter of DOMAIN model type.
 /// If DOMAIN.DOM_ID = 0 then it performs INSERT
 /// If DOMAIN.DOM_ID > 0 and DOMAIN.DEL_FLG = N then it performs UPDATE.
 /// If DOMAIN.DEL_FLG = Y then it performs DELETE.
 /// </summary>
 /// <param name="dm"></param>
 public void Post([FromBody] DOMAIN dm) //For Insert
 {
     if ((dm.DOM_ID.HasValue ? dm.DOM_ID.Value : 0) == 0)
     {
         _logicLayer.InsertDomain(dm);
     }
     else
     if (dm.DOM_ID.Value > 0 && (string.IsNullOrWhiteSpace(dm.DEL_FLG) ? "N" : dm.DEL_FLG) == "N")
     {
         _logicLayer.UpdateDomain(dm);
     }
     else
     {
         _logicLayer.DeleteDomain(dm.DOM_ID.Value);
     }
 }
Exemple #4
0
 internal void InsertDomain(DOMAIN dm)
 {
     using (var connection = MySqlDbConnection.NewConnection)
     {
         _statement = string.Format(MySQLquery.InsertDomain,
                                    string.Concat("'", dm.NAME, "'"),
                                    string.Concat("'", dm.DESCRIPTION, "'"),
                                    string.Concat("'", string.IsNullOrWhiteSpace(dm.DEL_FLG) ? "N" : dm.DEL_FLG, "'"), //dm.DEL_FLG
                                    string.Concat("'", string.IsNullOrWhiteSpace(dm.ORGL_USER) ? "ADMIN" : dm.ORGL_USER, "'"),
                                    "SYSDATE()"
                                    );
         using (var command = MySqlDbConnection.Command(connection, _statement))
         {
             command.ExecuteNonQuery();
         }
     }
 }
Exemple #5
0
        public static DeviceName[] List(DOMAIN domain)
        {
            IntPtr NamesHandle;

            // first, get the data, using an opaque token for the string array
            int status = FLIList(domain, out NamesHandle);

            if (0 != status)
            {
                throw new Win32Exception(-status);
            }

            // now marshal the string array into the return type we actually want
            List <DeviceName> NameList = new List <DeviceName>();
            IntPtr            p        = NamesHandle;
            string            s;

            while (IntPtr.Zero != p)
            {
                // manually bring the string into managed memory
                s = ((StringWrapper)Marshal.PtrToStructure(p, typeof(StringWrapper))).s;
                if (null == s)
                {
                    break;
                }

                // parse it according to FLI SDK spec
                int        DelimPos = s.IndexOf(';');
                DeviceName dn       = new DeviceName();
                dn.FileName  = (-1 == DelimPos ? s : s.Substring(0, DelimPos));
                dn.ModelName = (-1 == DelimPos ? null : s.Substring(DelimPos + 1, s.Length - (DelimPos + 1)));
                // and accumulate into our list
                NameList.Add(dn);

                // move to the next pointer
                p += sizeof(Int64);
            }

            // don't bother the caller with memory management now that we've made our own copy
            FLIFreeList(NamesHandle);

            // render the result to the caller!
            return(NameList.ToArray());
        }
Exemple #6
0
        internal void UpdateDomain(DOMAIN dm)
        {
            using (var connection = MySqlDbConnection.NewConnection)
            {
                //var str = MySQLquery.UpdateDomain;
                _statement = string.Format(MySQLquery.UpdateDomain,
                                           string.IsNullOrWhiteSpace(dm.NAME) ? "NAME" : string.Concat("'", dm.NAME, "'"),
                                           string.IsNullOrWhiteSpace(dm.DESCRIPTION) ? "DESCRIPTION" : string.Concat("'", dm.DESCRIPTION, "'"),
                                           string.IsNullOrWhiteSpace(dm.UPDT_USER) ? "UPDT_USER" : string.Concat("'", dm.UPDT_USER, "'"),
                                           "SYSDATE()",
                                           dm.DOM_ID.Value
                                           );

                using (var command = MySqlDbConnection.Command(connection, _statement))
                {
                    command.ExecuteNonQuery();
                }
            }
        }
Exemple #7
0
 private static extern int FLIOpen(out IntPtr dev, string name, DOMAIN domain);
Exemple #8
0
 private static extern int FLIList(DOMAIN domain, out IntPtr names);
Exemple #9
0
 public bool IsDomain()
 {
     return(DOMAIN.Equals(GetQueryType()));
 }
Exemple #10
0
 private static extern int FLIList(DOMAIN domain, out IntPtr names);
Exemple #11
0
 internal void UpdateDomain(DOMAIN dm)
 {
     _dac.UpdateDomain(dm);
 }
Exemple #12
0
 internal void InsertDomain(DOMAIN dm)
 {
     _dac.InsertDomain(dm);
 }
Exemple #13
0
 public FLI(string name, DOMAIN domain)
 {
     int status = FLIOpen(out dev, name, domain);
     if (0 != status)
         throw new Win32Exception(-status);
 }
Exemple #14
0
        public static DeviceName[] List(DOMAIN domain)
        {
            IntPtr NamesHandle;

            // first, get the data, using an opaque token for the string array
            int status = FLIList(domain, out NamesHandle);
            if (0 != status)
                throw new Win32Exception(-status);

            // now marshal the string array into the return type we actually want
            List<DeviceName> NameList = new List<DeviceName>();
            IntPtr p = NamesHandle;
            string s;
            while (IntPtr.Zero != p)
            {
                // manually bring the string into managed memory
                s = ((StringWrapper)Marshal.PtrToStructure(p, typeof(StringWrapper))).s;
                if (null == s)
                    break;

                // parse it according to FLI SDK spec
                int DelimPos = s.IndexOf(';');
                DeviceName dn = new DeviceName();
                dn.FileName = (-1 == DelimPos ? s : s.Substring(0, DelimPos));
                dn.ModelName = (-1 == DelimPos ? null : s.Substring(DelimPos + 1, s.Length - (DelimPos + 1)));
                // and accumulate into our list
                NameList.Add(dn);

                // move to the next pointer
                p += sizeof(int);
            }

            // don't bother the caller with memory management now that we've made our own copy
            FLIFreeList(NamesHandle);

            // render the result to the caller!
            return NameList.ToArray();
        }
Exemple #15
0
 private static extern int FLIOpen(out IntPtr dev, string name, DOMAIN domain);
 // PUT: api/Domain/5
 public void Put([FromBody] DOMAIN dm) //, [FromBody]string value) //For Update
 {
     _logicLayer.UpdateDomain(dm);
 }
			assertEquals(DOMAIN, new JID(DOMAIN).toString());