internal IXapPocoMap GetPocoMap <T>(T obj)
        {
            IXapPocoMap pocoMap = pocoMaps.GetItem(typeof(T).FullName);

            if (pocoMap != null)
            {
                return(pocoMap);
            }

            DbExecution dbExecution = SharedMethods.GetCustomAttribute <DbExecution>(obj);

            if (dbExecution == null)
            {
                return(null);
            }
            pocoMap                     = PocoMap.Create();
            pocoMap.ObjectName          = obj.GetType().FullName;
            pocoMap.InsertProcedure     = dbExecution.InsertProcedure;
            pocoMap.SelectProcedure     = dbExecution.SelectProcedure;
            pocoMap.SelectListProcedure = dbExecution.SelectListProcedure;
            pocoMap.UpdateProcedure     = dbExecution.UpdateProcedure;
            pocoMap.DeleteProcedure     = dbExecution.DeleteProcedure;

            foreach (PropertyInfo prop in PropertyService.Instance.GetInterfaceProperties <T>(obj).GetProperties())
            {
                object[] attributes = prop.GetCustomAttributes(typeof(DbBinding), true);
                if (attributes.Length == 1)
                {
                    IXapPocoField pocoField = PocoField.Create();
                    pocoField.DbColumn       = ((DbBinding)attributes[0]).DbColumn;
                    pocoField.FieldName      = prop.Name;
                    pocoField.DoesInsert     = ((DbBinding)attributes[0]).DoesInsert;
                    pocoField.DoesSelect     = ((DbBinding)attributes[0]).DoesSelect;
                    pocoField.DoesSelectList = ((DbBinding)attributes[0]).DoesSelectList;
                    pocoField.DoesUpdate     = ((DbBinding)attributes[0]).DoesUpdate;
                    pocoField.DoesDelete     = ((DbBinding)attributes[0]).DoesDelete;
                    pocoField.IsIdentity     = ((DbBinding)attributes[0]).IsIdentityField;
                    pocoField.DataType       = ((DbBinding)attributes[0]).DataType;

                    pocoMap.AddField(pocoField);
                }
            }

            pocoMaps.AddItem(pocoMap.ObjectName, pocoMap);
            return(pocoMap);
        }
Example #2
0
        public string getEGN(string username)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                string     EGN;
                SqlCommand command = new SqlCommand("spGetEGNByUserName_tblTeacherInfo", con);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("@UserName", username));


                con.Open();
                EGN = command.ExecuteScalar().ToString();
                con.Close();

                return(EGN);
            }
        }
Example #3
0
        internal static void CheckForUpdates()
        {
            Version currentversion = new Version(Application.ProductVersion);
            Version newestversion;

            try {
                newestversion = new Version(SharedMethods.CreateWebRequest("File with the newest version of the app to check at every startup for updates.txt"));
            }
            catch (Exception ex) {
                SharedMethods.LogException(ex.TargetSite + " " + ex.Message + " " + ex.InnerException);
                return;
            }

            if (currentversion.CompareTo(newestversion) < 0)
            {
                UpdateApp();
            }
        }
Example #4
0
        public void Compile()
        {
            var          path = "";
            DialogResult dirResult;

            dirResult = DialogResult.Retry;

            if (CommonFileDialog.IsPlatformSupported)
            {
                var dialog = new CommonOpenFileDialog();
                dialog.IsFolderPicker = true;
                ThreadSaveAction(
                    () => { dirResult = dialog.ShowDialog() == CommonFileDialogResult.Ok ? DialogResult.OK : DialogResult.Abort; });
                if (dirResult == DialogResult.OK)
                {
                    path = dialog.FileName;
                }
            }
            else
            {
                var dir = new FolderBrowserDialog();
                ThreadSaveAction(() => { dirResult = dir.ShowDialog(); });
                if (dirResult == DialogResult.OK)
                {
                    path = dir.SelectedPath;
                }
            }

            if (dirResult == DialogResult.OK)
            {
                TargetDir = path;
                foreach (var tableInfoModel in Tables)
                {
                    Status = string.Format("Compiling Table '{0}'", tableInfoModel.GetClassName());
                    SharedMethods.CompileTable(tableInfoModel, this);
                }

                foreach (var tableInfoModel in Views)
                {
                    Status = string.Format("Compiling View '{0}'", tableInfoModel.GetClassName());
                    SharedMethods.CompileTable(tableInfoModel, this);
                }
            }
        }
Example #5
0
        public Client()
        {
            gameState = new GameState();
            BinaryFormatter formatter       = new BinaryFormatter();
            TcpClient       client          = new TcpClient("127.0.0.1", 1234);
            bool            closeConnection = false;

            gameState    = formatter.Deserialize(client.GetStream()) as GameState;
            playerNumber = gameState.Player.PlayerNumber;
            //gameState.Player.Hand.ForEach(x => Console.WriteLine(x));

            while (!closeConnection)
            {
                while (playerNumber == gameState.PlayerTurn)
                {
                    gameState.Player.Hand.ForEach(x => Console.WriteLine(x));

                    if (gameState.Player.Hand.Count == 0)
                    {
                        Console.WriteLine("You win");
                    }
                    else
                    {
                        if (gameState.Player.FindPlayableCardInHand(gameState.Pile[gameState.Pile.Count - 1]))
                        {
                            Console.WriteLine("Its your turn opponent has " + gameState.CardsAtOtherPlayer + " cards in hand " +
                                              "\nCard on pile is " + gameState.Pile[gameState.Pile.Count - 1]);
                            string response   = Console.ReadLine();
                            int    handnumber = Int32.Parse(response);
                            SharedMethods.SendPacket(client, gameState.Player.Hand[handnumber]);
                            gameState = formatter.Deserialize(client.GetStream()) as GameState;
                        }
                        else
                        {
                            Console.WriteLine("Its your turn opponent has " + gameState.CardsAtOtherPlayer + " cards in hand " +
                                              "\nCard on pile is " + gameState.Pile[gameState.Pile.Count - 1] + "\nYou dont have a playable card");
                            SharedMethods.SendPacket(client, new DrawCardPacket());
                            gameState = formatter.Deserialize(client.GetStream()) as GameState;
                        }
                    }
                }
                gameState = formatter.Deserialize(client.GetStream()) as GameState;
            }
        }
Example #6
0
        public int getTeacherClassId(string EGN)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand command = new SqlCommand("spGetTeacherClassByCheckingEGN_tblTeacherInfo", con);
                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(new SqlParameter("@EGN", EGN));
                SqlParameter Result = new SqlParameter("@ClassId", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                command.Parameters.Add(Result);

                con.Open();
                command.ExecuteNonQuery();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #7
0
        public async Task <IActionResult> Unlock(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var applicationUser = await _db.ApplicationUser.FirstOrDefaultAsync(m => m.Id == id);

            if (applicationUser == null)
            {
                return(NotFound());
            }

            applicationUser.LockoutEnd = SharedMethods.GetDateTime();

            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Example #8
0
        public async Task <IActionResult> Summary()
        {
            detailsCart = new OrderDetailsCart()
            {
                OrderHeader = new Models.OrderHeader()
            };

            detailsCart.OrderHeader.OrderTotal = 0;

            var             claimsIdentity  = (ClaimsIdentity)User.Identity;
            var             claim           = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);
            ApplicationUser applicationUser = await _db.ApplicationUser.Where(c => c.Id == claim.Value).FirstOrDefaultAsync();

            var cart = _db.ShoppingCart.Where(c => c.ApplicationUserId == claim.Value);

            if (cart != null)
            {
                detailsCart.listCart = cart.ToList();
            }

            foreach (var list in detailsCart.listCart)
            {
                list.MenuItems = await _db.MenuItems.FirstOrDefaultAsync(m => m.Id == list.MenuItemId);

                detailsCart.OrderHeader.OrderTotal = Math.Round(detailsCart.OrderHeader.OrderTotal + (list.MenuItems.Price * list.Count), 2);
            }
            detailsCart.OrderHeader.OrderTotalOriginal = detailsCart.OrderHeader.OrderTotal;
            detailsCart.OrderHeader.PickUpName         = applicationUser.Name;
            detailsCart.OrderHeader.PhoneNumber        = applicationUser.PhoneNumber;
            detailsCart.OrderHeader.PickUpTime         = SharedMethods.GetDateTime();


            if (HttpContext.Session.GetString(SD.ssCouponCode) != null)
            {
                detailsCart.OrderHeader.CouponCode = HttpContext.Session.GetString(SD.ssCouponCode);
                var couponFromDb = await _db.Coupon.Where(c => c.Name.ToLower() == detailsCart.OrderHeader.CouponCode.ToLower()).FirstOrDefaultAsync();

                detailsCart.OrderHeader.OrderTotal = SD.DiscountedPrice(couponFromDb, detailsCart.OrderHeader.OrderTotalOriginal);
            }


            return(View(detailsCart));
        }
        public int Delete(Object.Specialization specialization)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spDeleteSpecialization_tblSpecialization", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", specialization.Id);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;

                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteNonQuery();

                return((int)Result.Value);
            }
        }
Example #10
0
        public int Create(Object.Author author)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spAddAuthor_tblAuthor", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Publisher", author.Publisher);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #11
0
        /// <summary>
        /// Deletes an entity permanently from Active Directory.
        /// </summary>
        /// <param name="userGuid"></param>
        protected void DeleteEntity(string userGuid)
        {
            if (userGuid == null)
            {
                return;
            }
            ldapSearch.Filter = String.Format("(objectGUID={0})", SharedMethods.Guid2OctetString(userGuid));

            SearchResult result = ldapSearch.FindOne();

            if (result == null)
            {
                return;                 //User doesn't exist.
            }
            DirectoryEntry DEUser = result.GetDirectoryEntry();

            DEUser.DeleteTree();

            DEUser.CommitChanges();
        }
        public int Create(Object.Subject subject)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spAddSubject_tblSubject", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@SubjectName", subject.SubjectName);

                SqlParameter Result = new SqlParameter("@ResultNumber", SqlDbType.Int);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteScalar();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #13
0
        /// <summary>
        /// Adds an entity to a group in Active Directory.
        /// </summary>
        /// <param name="entityGuid">The GUID of the entity in question.</param>
        /// <param name="groupGuid">The GUID of the group to assign the user to.</param>
        protected void AddEntityToGroup(string entityGuid, string groupGuid)
        {
            // TODO: Fix error when adding user to group they are already in.

            //Get the entity DirectoryEntry
            ldapSearch.Filter = String.Format("(objectGUID={0})", SharedMethods.Guid2OctetString(entityGuid));

            SearchResult result = ldapSearch.FindOne();

            if (result == null)
            {
                throw new NullReferenceException("Attempted to add a nonexistent entity to a group.");
            }

            DirectoryEntry DEEntity = result.GetDirectoryEntry();

            //Get the group DirectoryEntry
            ldapSearch.Filter = String.Format("(objectGUID={0})", SharedMethods.Guid2OctetString(groupGuid));

            result = ldapSearch.FindOne();
            if (result == null)
            {
                throw new NullReferenceException("Attempted to add an entity to a nonexistent group.");
            }

            DirectoryEntry DEGroup = result.GetDirectoryEntry();

            //Add the entity to the group
            try
            {
                DEGroup.Properties["member"].Add(DEEntity.Path.Substring(7));
                DEGroup.CommitChanges();

                Cache.RemoveByGuid(entityGuid);
                Cache.RemoveByGuid(groupGuid);
            }
            catch (DirectoryServicesCOMException) { }

            DEGroup.Close();
            DEEntity.Close();
        }
        private void button_OpenInExplorer_Click(object sender, EventArgs e)
        {
            Plugin selectedPlugin = null;

            if (treeView_Installed.SelectedNodes.Count == 1)
            {
                selectedPlugin = (Plugin)treeView_Installed.SelectedNodes[0].Tag;
            }
            else if (treeView_Available.SelectedNodes.Count == 1)
            {
                selectedPlugin = (Plugin)treeView_Available.SelectedNodes[0].Tag;
            }

            if (string.IsNullOrEmpty(selectedPlugin.InternalDllPath))
            {
                DarkMessageBox.Show(this, "Invalid plugin folder.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            SharedMethods.OpenInExplorer(Path.GetDirectoryName(selectedPlugin.InternalDllPath));
        }
        public int Delete(Object.Lesson lesson, Object.Programme programme)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spDeleteLesson_tblLesson", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", lesson.Id);
                cmd.Parameters.AddWithValue("@ClassId", programme.ClassId);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #16
0
        /// <summary></summary>
        public void SetPassword(string userGuid, string password)
        {
            ldapSearch.Filter = String.Format("(objectGUID={0})", SharedMethods.Guid2OctetString(userGuid));

            SearchResult result = ldapSearch.FindOne();

            if (result == null)
            {
                throw new NullReferenceException("Attempted to set a password for a nonexistent user.");
            }

            DirectoryEntry DEUser = result.GetDirectoryEntry();

            DEUser.Invoke("SetPassword", new object[] { password });

            DEUser.CommitChanges();

            Cache.RemoveByGuid(userGuid);

            DEUser.Close();
        }
Example #17
0
    // Update is called once per frame
    private void Update()
    {
        var yAxis    = Input.GetAxisRaw("Vertical");
        var maxSpeed = playerMaxSpeed + StaticVariables.SpeedBuff;

        SharedMethods.ThrustForward(gameObject, _rigidbody2D, -(yAxis * maxSpeed));
        SharedMethods.ClampVelocity(_rigidbody2D, -maxSpeed, maxSpeed);


        if (!(Camera.main is null))
        {
            /* rotation with mouse handling */
            var mousePosition = Input.mousePosition - Camera.main.WorldToScreenPoint(transform.position);
            var angle         = Mathf.Atan2(mousePosition.y, mousePosition.x) * Mathf.Rad2Deg;
            angle += 90;
            Transform transform1;
            (transform1 = transform).rotation = Quaternion.AngleAxis(angle, Vector3.forward);

            SharedMethods.EscapeScreen(transform1, transform1.position);
        }
    }
Example #18
0
        public void Compile()
        {
            Console.WriteLine("Start compiling with selected options");

            var elements = Tables.Concat(Views);

            foreach (var tableInfoModel in elements)
            {
                SharedMethods.CompileTable(tableInfoModel, this);
            }

            foreach (var proc in StoredProcs)
            {
                if (proc.Exclude)
                {
                    continue;
                }

                var targetCsName = proc.GetClassName();
                var compiler     = new ProcedureCompiler(TargetDir, targetCsName);
                compiler.CompileHeader        = GenerateCompilerHeader;
                compiler.Namespace            = Namespace;
                compiler.GenerateConfigMethod = GenerateConfigMethod;
                compiler.TableName            = proc.NewTableName;
                if (proc.Parameter.ParamaterSpParams != null)
                {
                    foreach (var spParamter in proc.Parameter.ParamaterSpParams)
                    {
                        var targetType = DbTypeToCsType.GetClrType(spParamter.Type);
                        var spcName    = spParamter.Parameter.Replace("@", "");
                        compiler.AddProperty(spcName, targetType);
                    }
                }

                Console.WriteLine("Compile Procedure {0}", compiler.Name);
                compiler.Compile(new List <ColumInfoModel>(), SplitByType);
            }

            Console.WriteLine("Created all files");
        }
Example #19
0
        /// <summary> 道具Trigger </summary>
        protected virtual void PropCollected(GameObject obj)
        {
            if (!obj.CompareTag(TriggerTag))
            {
                return;
            }

            if (_propState == PropState.IsCollected || _propState == PropState.IsExpiring)
            {
                return;
            }

            _propState = PropState.IsCollected;

            _playerBrain = obj.GetComponent <T>();
            if (_playerBrain == null)
            {
                return;
            }

            ///如果玩家身上已经有同名道具,销毁
            if (SharedMethods.DeepFindTransform(_playerBrain.transform, gameObject.name) != null)
            {
                AfterDelay();
                return;
            }
            gameObject.transform.parent = _playerBrain.transform;


            PropUsed();
            Effects();

            //作用于UI的事件系统
            foreach (GameObject cell in PropEventSystemListeners.Instance.Listeners)
            {
                ExecuteEvents.Execute <IPropEvents <T> >(cell, null, (prop, player) => prop.OnPropCollected(this, _playerBrain));
            }

            AfterTrigger();
        }
Example #20
0
        public int Create(Object.BudgetType budgetType)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spAddBudgetType_tblBudgetType", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Item", budgetType.Item);
                cmd.Parameters.AddWithValue("@OperationTypeId", budgetType.OperationTypeId);
                cmd.Parameters.AddWithValue("@OperationLengthId", budgetType.OperationLengthId);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #21
0
        public DataTable ReadWithId(DataTable table)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("Select Id,ClassName,NameDay,LessonHour From vwProgrammeFull_tblProgramme", con);

                con.Open();
                using (SqlDataReader rdr = cmd.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        DataRow row = table.NewRow();
                        row["Id"]        = rdr["Id"];
                        row["Programme"] = "Клас :" + rdr["ClassName"].ToString() + "\n Ден:" + rdr["NameDay"] + "\n Час : " + rdr["LessonHour"];

                        table.Rows.Add(row);
                    }
                }
                con.Close();
                return(table);
            }
        }
Example #22
0
        /// <summary>
        /// Edits a user property.
        /// </summary>
        /// <param name="userGuid">The GUID of the user or group in question.</param>
        /// <param name="propertyName">The user property to change.</param>
        /// <param name="newValue">The new value to assign the property.</param>
        public void SetProperty(string guid, string propertyName, object newValue)
        {
            //Get the user DirectoryEntry
            ldapSearch.Filter = String.Format("(objectGUID={0})", SharedMethods.Guid2OctetString(guid));

            SearchResult result = ldapSearch.FindOne();

            if (result == null)
            {
                throw new NullReferenceException("Attempted to edit a property for a nonexistent user.");
            }

            DirectoryEntry DEUser = result.GetDirectoryEntry();

            DEUser.Properties[propertyName].Value = newValue;

            DEUser.CommitChanges();

            Cache.RemoveByGuid(guid);

            DEUser.Close();
        }
Example #23
0
        public int absent(string SenderEGN, int SenderRank, string AbsentTeacherEGN,
                          string lessonsAbsent, DateTime onDate, string substituteTeacherEGN)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spAddAbsentTeacher_tblTeacherAbsence", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@SenderEGN", SenderEGN);
                cmd.Parameters.AddWithValue("@SenderRank", SenderRank);
                cmd.Parameters.AddWithValue("@AbsentTeacherEGN", AbsentTeacherEGN);
                cmd.Parameters.AddWithValue("@LessonsAbsent", lessonsAbsent);
                cmd.Parameters.AddWithValue("@OnDate", onDate);
                cmd.Parameters.AddWithValue("@SubstituteTeacherEGN", substituteTeacherEGN);

                con.Open();
                int result = (int)cmd.ExecuteScalar();
                con.Close();

                return(result);
            }
        }
Example #24
0
        public int Update(Object.Position position)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spUpdatePosition_tblPosition", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Id", position.Id);
                cmd.Parameters.AddWithValue("@Position", position.Name);
                cmd.Parameters.AddWithValue("@Salary", position.Salary);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteScalar();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #25
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="LDAPQuery"></param>
        /// <returns></returns>
        protected IList <T> GetEntitiesByQuery <T>(string LDAPQuery) where T : ADEntity
        {
            if (string.IsNullOrEmpty(LDAPQuery))
            {
                return(null);
            }

            IList <T> returnVar = new List <T>();

            ldapSearch.Filter = LDAPQuery;

            SearchResultCollection results = ldapSearch.FindAll();

            foreach (SearchResult result in results)
            {
                T entity = SharedMethods.New <T>(result);
                returnVar.Add(entity);
                Cache.AddToCache(entity);
            }

            return(returnVar);
        }
Example #26
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Attribute"></param>
        /// <param name="SearchValue"></param>
        /// <returns></returns>
        protected IList <T> GetEntitiesByAttribute <T>(string Attribute, string SearchValue) where T : ADEntity
        {
            if (string.IsNullOrEmpty(Attribute) || string.IsNullOrEmpty(SearchValue))
            {
                return(null);
            }

            IList <T> returnVar = new List <T>();

            ldapSearch.Filter = string.Format("({0}={1})", Attribute, SearchValue);

            SearchResultCollection results = ldapSearch.FindAll();

            foreach (SearchResult result in results)
            {
                T entity = SharedMethods.New <T>(result);
                returnVar.Add(entity);
                Cache.AddToCache(entity);
            }

            return(returnVar);
        }
Example #27
0
        public int Create(Object.TimeTable timeTable)
        {
            using (SqlConnection con = new SqlConnection(SharedMethods.getConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("spAddTimeTable_tblTimeTable", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@LessonHour", timeTable.LessonHour);
                cmd.Parameters.AddWithValue("@LessonTime", timeTable.LessonTime);
                cmd.Parameters.AddWithValue("@ShiftType", timeTable.ShiftType);

                SqlParameter Result = new SqlParameter("@ResultNumber", DbType.Int32);
                Result.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(Result);

                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                return((int)Result.Value);
            }
        }
Example #28
0
        public void ProcessRequest(HttpContext context)
        {
            SharedMethods.InitializeEntitySpaces();
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            context.Response.ContentType = "application/json";

            int maxPoints = Convert.ToInt32(request.Params["MaxPoints"]);
            int?markerId  = Convert.ToInt32(request.Params["markerId"]);


            var customField = request.Params["customField"];
            var country     = request.Params["country"];
            var state       = request.Params["state"];
            var city        = request.Params["city"];

            var moduleId       = Convert.ToInt32(request.Params["moduleId"]);
            var targetModuleId = Convert.ToInt32(request.Params["targetModuleId"]);

            var states           = Queries.GetDistinctStates(targetModuleId, customField, country, maxPoints);
            var cities           = Queries.GetDistinctCities(targetModuleId, customField, country, state, maxPoints);
            var citiesHtml       = SharedMethods.CreateCityHtml(cities);
            var statesHtml       = SharedMethods.CreateStatesHtml(states);
            var markerCollection = Queries.GetMarkersByState(targetModuleId, customField, country, state, maxPoints, markerId);

            var markers = new List <ViewAbleMarker>();

            markerCollection.ToList().ForEach(marker => markers.Add(new ViewAbleMarker(marker)));

            DotNetNuke.Entities.Modules.ModuleController objModules = new DotNetNuke.Entities.Modules.ModuleController();
            var settings   = objModules.GetModuleSettings(moduleId);
            var template   = Convert.ToString(settings[DNNspot.Maps.MarkerListing.ModuleSettingNames.ListTemplate]);
            var markerHtml = DNNspot.Maps.Common.ModuleBase.ReplaceTokens(markerCollection, template, moduleId);

            var jsonObject = new { cities = citiesHtml, states = statesHtml, message = String.Empty, success = true, markers, markerHtml = markerHtml.ToString() };

            response.Write(JsonConvert.SerializeObject(jsonObject));
        }
Example #29
0
        /// <summary>
        /// Retrieves entity info based on account name. Do not prefix with domain. Does NOT try fetching from cache first. Case-insensitive. Caches results.
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        protected IList <T> GetEntitiesByEmail <T>(string email) where T : ADEntity
        {
            if (email == null)
            {
                return(null);
            }

            IList <T> returnVar = new List <T>();

            ldapSearch.Filter = string.Format("(mail={0})", email);

            SearchResultCollection results = ldapSearch.FindAll();

            foreach (SearchResult result in results)
            {
                T entity = SharedMethods.New <T>(result);
                returnVar.Add(entity);
                Cache.AddToCache(entity);
            }

            return(returnVar);
        }
Example #30
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            if (ModifierKeys == Keys.None)
            {
                if (e.KeyCode == Keys.F2)
                {
                    LaunchFLEP();
                }

                if (e.KeyCode == Keys.F3)
                {
                    SharedMethods.OpenInExplorer(_ide.Project.ProjectPath);
                }

                if (e.KeyCode == Keys.F4)
                {
                    LaunchGame();
                }
            }
        }