Exemplo n.º 1
0
        /// <summary>
        /// Add access level
        /// </summary>
        /// <param name="creator">user login id</param>
        /// <returns>OK or error from DB</returns>
        public string Add(string creator)
        {
            string    result = "OK";
            DataTable dt     = null;

            try
            {
                //Add aclv master
                ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient();
                DataSet ds = client.AccessLevelSave("A", groupId, GroupName, creator, DateTime.Now);
                dt     = ds.Tables[0];
                result = dt.Rows[0][0].ToString();

                //Add schedule of aclv
                foreach (Schedule s in listSchedule)
                {
                    result = AddSchedule(groupId, s.ScheduleId, creator);
                }

                //Add door of aclv
                foreach (Door d in listDoor)
                {
                    result = AddSchedule(groupId, d.DoorId, creator);
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(string.Format("Access level class - Add: {0}", ex.ToString()));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// delete access level
        /// </summary>
        /// <param name="creator">user login id</param>
        /// <returns>OK or error from DB</returns>
        public string Delete(string creator)
        {
            string    result = "OK";
            DataTable dt     = null;

            try
            {
                //Delete aclv master
                ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient();
                DataSet ds = client.AccessLevelSave("D", groupId, GroupName, creator, DateTime.Now);
                dt     = ds.Tables[0];
                result = dt.Rows[0][0].ToString();

                return(result);
            }
            catch (Exception ex)
            {
                return(string.Format("Access level class - Delete: {0}", ex.ToString()));
            }
        }