Example #1
0
        public virtual void PushGroup(string name)
        {
            if (this.groupCtxStack.Count == 0)
            {
                throw new BinariexException("reading schema", "Cannot put group out of sheet.");
            }
            var parentCtx = this.groupCtxStack.Peek();

            var newCtx = new GroupContext
            {
                Sheet             = parentCtx.Sheet,
                SheetContext      = parentCtx.SheetContext,
                HeaderRowIndex    = parentCtx.HeaderRowIndex + 1,
                TopRowIndex       = parentCtx.CursorRowIndex,
                LeftColumnIndex   = parentCtx.CursorColumnIndex,
                CursorRowIndex    = parentCtx.CursorRowIndex,
                CursorColumnIndex = parentCtx.CursorColumnIndex
            };

            this.groupCtxStack.Push(newCtx);
        }
Example #2
0
    /// <summary>
    /// Saves the options.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SaveOption(object sender, EventArgs e)
    {
        IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>();

        userOption.SetCommonOption(DefaultGroupOptionName(), "DefaultGroup", GetFamNameFromId(ddlGroup.SelectedValue), false);
        userOption.SetCommonOption(DefaultGroupOptionName(), "LookupLayoutGroup", GetFamNameFromId(ddlLookupLayoutGroup.SelectedValue), false);
        var egis = GroupContext.GetGroupContext().EntityGroupInfos;

        if (egis != null)
        {
            foreach (var egi in egis)
            {
                if (egi.EntityName.Equals(DefaultGroupOptionName(), StringComparison.OrdinalIgnoreCase))
                {
                    egi.ClearCache(true);
                    break;
                }
            }
        }
        userOption.SetCommonOption("defaultLookupCondition", "DefaultLookupCondition", ddlDefaultSearchCondition.SelectedValue, false);
    }
Example #3
0
    private void RestoreState()
    {
        try
        {
            UIStateService service = new UIStateService();

            GroupContext group = GroupContext.GetGroupContext();
            if (group != null && !String.IsNullOrEmpty(GroupContext.CurrentGroupID))
            {
                GroupInfo info = GroupContext.GetGroupContext().CurrentGroupInfo.CurrentGroup.GroupInformation;

                string family = info.Entity.ToLower();
                string name   = info.GroupName.ToLower();
                string data   = service.GetTaskletState(ID, "hidden:" + family + "-" + name);
                if (data != null)
                {
                    _hiddenFilters = new List <string>(JsonConvert.DeserializeObject <string[]>(data));
                }
            }
        }
        catch { }
    }
    /// <summary>
    /// Saves the options.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SaveOption(object sender, EventArgs e)
    {
        IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>();

        userOption.SetCommonOption(DefaultGroupOptionName(), "DefaultGroup", GetFamNameFromId(ddlGroup.SelectedValue), false);
        userOption.SetCommonOption(DefaultGroupOptionName(), "LookupLayoutGroup", GetFamNameFromId(ddlLookupLayoutGroup.SelectedValue), false);
        var egis = GroupContext.GetGroupContext().EntityGroupInfos;

        if (egis != null)
        {
            foreach (var egi in egis)
            {
                if (egi.EntityName.Equals(DefaultGroupOptionName(), StringComparison.OrdinalIgnoreCase))
                {
                    egi.ClearCache(true);
                    break;
                }
            }
        }
        userOption.SetCommonOption("autoFitColumns", "GroupGridView",
                                   cbAutoFitColumns.Checked.ToString(CultureInfo.InvariantCulture), false);
    }
Example #5
0
        /// <summary> Drills down into the group at the given index within the current
        /// group -- ie sets the location pointer to the first structure within the child.
        /// </summary>
        /// <param name="childNumber">the index of the group child into which to drill.
        /// </param>
        /// <param name="rep">the group repetition into which to drill.
        /// </param>
        public virtual void DrillDown(int childNumber, int rep)
        {
            if (childNumber != -1)
            {
                var s = CurrentGroup.GetStructure(childNames[childNumber], rep);
                if (!(s is IGroup))
                {
                    throw new HL7Exception("Can't drill into segment", ErrorCode.APPLICATION_INTERNAL_ERROR);
                }

                var group = (IGroup)s;

                // stack the current group and location
                var gc = new GroupContext(this, CurrentGroup, currentChild);
                ancestors.Add(gc);

                CurrentGroup = group;
            }

            currentChild = 0;
            childNames   = CurrentGroup.Names;
        }
Example #6
0
        public GroupContext group()
        {
            GroupContext _localctx = new GroupContext(Context, State);

            EnterRule(_localctx, 10, RULE_group);
            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 48; Match(GROUP_START);
                    State = 49; or();
                    State = 50; Match(GROUP_END);
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
Example #7
0
        /// <summary>
        /// Returns string Array with all the usernames registrated.
        /// If you send an groupid with it you'll get a list of all players except the once that are already in the group.
        /// </summary>
        /// <param name="groupid"></param>
        /// <returns></returns>
        public string[] GetAddPlayerName(int?groupid)
        {
            AccountContext accountContext = new AccountContext();
            GroupContext   groupContext   = new GroupContext();

            if (groupid != null)
            {
                List <string> usernames = new List <string>();

                foreach (string username in accountContext.GetAllPlayers())
                {
                    if (!groupContext.IsPlayerInGroup(accountContext.GetPlayerByUsername(username).ID, (int)groupid))
                    {
                        usernames.Add(username);
                    }
                }

                return(usernames.ToArray <string>());
            }
            else
            {
                return(accountContext.GetAllPlayers().ToArray <string>());
            }
        }
Example #8
0
 /// <summary> Switches the group context to the parent of the current group,
 /// and sets the child pointer to the next sibling.
 /// </summary>
 /// <returns> false if already at root
 /// </returns>
 public virtual bool drillUp()
 {
     //pop the top group and resume search there
     if (!(ancestors.Count == 0))
     {
         GroupContext gc = (GroupContext)SupportClass.StackSupport.Pop(ancestors);
         currentGroup = gc.group;
         currentChild = gc.child;
         childNames   = currentGroup.Names;
         return(true);
     }
     else
     {
         if (currentChild == -1)
         {
             return(false);
         }
         else
         {
             currentChild = -1;
             return(true);
         }
     }
 }
Example #9
0
 public GroupService(GroupContext context)
 {
     _context = context;
 }
Example #10
0
        public int GetGroupId(string groupname)
        {
            GroupContext gc = new GroupContext();

            return(gc.GetGroupID(groupname));
        }
        private async Task DeleteGroup(int groupId)
        {
            await GroupContext.Delete(groupId);

            NavigateToGroups();
        }
Example #12
0
 public StudentGroupService(GroupContext groupContext)
 {
     GroupContext = groupContext;
 }
 public GroupsController(GroupContext context)
 {
     _context = context;
 }
Example #14
0
        static void DeleteStudent()
        {
            int choice;

            using (GroupContext groupContext = new GroupContext())
            {
                List <Group> groups = groupContext.Group.ToList();
                if (groups.Count == 0)
                {
                    List <Student> students = groupContext.Students.ToList();
                    if (students == null)
                    {
                        Console.WriteLine("Студентов, доступных для удаления, нет");
                        Console.WriteLine("Поробуйте войти позже...");
                    }
                    else
                    {
                        Console.WriteLine("Введите номер студента, которого хотите удалить");
                        foreach (var student in students.OrderBy(p => p.LastName))
                        {
                            Console.WriteLine("{0} - {1} {2} {3}", student.StudentId, student.LastName, student.FirstName, student.Patronymic);
                        }
                        try
                        {
                            choice = Convert.ToInt32(Console.ReadLine());

                            groupContext.Students.Remove(students.Where(p => p.StudentId == choice).FirstOrDefault());
                            groupContext.SaveChanges();
                            Console.WriteLine("Удаление студента прошло успешно");
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Произошел сбой. Причина сбоя: {0}", ex.Message);
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Введите номер группы, из которой хотите удалить студента");
                    Console.WriteLine("Список групп");
                    foreach (var group in groups)
                    {
                        if (group.GroupId != groups.Max(p => p.GroupId))
                        {
                            Console.Write("{0} - {1}, ", group.GroupId, group.NameGroup);
                        }
                        else
                        {
                            Console.Write("{0} - {1}.", group.GroupId, group.NameGroup);
                        }
                    }
                    Console.WriteLine();
                    try
                    {
                        choice = Convert.ToInt32(Console.ReadLine());
                    }
                    catch
                    {
                        choice = -1;
                    }
                    List <Student> students = groupContext.Students.Where(p => p.GroupId == choice).ToList();
                    if (students.Count == 0)
                    {
                        Console.WriteLine("Студентов, доступных для удаления, нет");
                        Console.WriteLine("Поробуйте войти позже...");
                    }
                    else
                    {
                        Console.WriteLine("Введите номер студента, которого хотите удалить");
                        foreach (var student in students.OrderBy(p => p.LastName))
                        {
                            Console.WriteLine("{0} - {1} {2} {3}", student.StudentId, student.LastName, student.FirstName, student.Patronymic);
                        }
                        try
                        {
                            choice = Convert.ToInt32(Console.ReadLine());
                            groupContext.Students.Remove(students.Where(p => p.StudentId == choice).FirstOrDefault());
                            groupContext.SaveChanges();
                            Console.WriteLine("Удаление студента прошло успешно");
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Произошел сбой. Причина сбоя: {0}", ex.Message);
                        }
                    }
                }
            }
        }
Example #15
0
 public GroupController(GroupContext context)
 {
     _service = new StudentGroupService(context);
 }
Example #16
0
		/// <summary> Drills down into the group at the given index within the current
		/// group -- ie sets the location pointer to the first structure within the child
		/// </summary>
		/// <param name="childNumber">the index of the group child into which to drill
		/// </param>
		/// <param name="rep">the group repetition into which to drill
		/// </param>
		public virtual void drillDown(int childNumber, int rep)
		{
			if (childNumber != -1)
			{
				IStructure s = currentGroup.GetStructure(childNames[childNumber], rep);
				if (!(s is IGroup))
				{
					throw new HL7Exception("Can't drill into segment", HL7Exception.APPLICATION_INTERNAL_ERROR);
				}
				IGroup group = (IGroup) s;

				//stack the current group and location
				GroupContext gc = new GroupContext(this, currentGroup, currentChild);
				ancestors.Add(gc);

				currentGroup = group;
			}

			currentChild = 0;
			childNames = currentGroup.Names;
		}
        public void Start()
        {
            using var db = new GroupContext();
            var appService = new StudentGroupService(db);

            while (true)
            {
                Console.Write(AllStudentsAndGroupsStr());
                Console.Write("Что Вы хотите сделать?\n1 – добавить студента\n2 - удалить студента\n");
                if (TryParse(Console.ReadLine(), out var command))
                {
                    switch (command)
                    {
                    case 1:
                    {
                        var groups    = db.Groups.ToList();
                        var groupsStr = string.Join(", ", groups);
                        Console.WriteLine($"Выберете номер группы:\n{groupsStr}");
                        if (!TryParse(Console.ReadLine(), out var numOfGroup))
                        {
                            Console.WriteLine("Wrong Input!");
                            continue;
                        }
                        Console.WriteLine("Введите ФИО студента");
                        var fullName = Console.ReadLine();
                        if (fullName != null)
                        {
                            var stud    = fullName.Split(" ");
                            var student = new Student
                            {
                                Surname = stud[0], Name = stud[1], Patronymic = stud[2], GroupId = numOfGroup
                            };
                            appService.AddStudentToDB(student);
                        }
                        else
                        {
                            Console.WriteLine("Wrong input!");
                        }

                        break;
                    }

                    case 2:
                    {
                        var groups    = db.Groups.ToList();
                        var groupsStr = string.Join(", ", groups);
                        Console.WriteLine($"Выберете номер группы:\n{groupsStr}");
                        if (!TryParse(Console.ReadLine(), out var numOfGroup))
                        {
                            continue;
                        }
                        var studentsFromGroup = appService.AllStudentsFromGroup(numOfGroup);
                        var studentsStr       = string.Join(", ", studentsFromGroup);
                        Console.WriteLine($"Выберете номер студента:\n{studentsStr}");
                        if (!TryParse(Console.ReadLine(), out var numOfStud))
                        {
                            Console.WriteLine("Wrong Input!");
                            continue;
                        }
                        var student = new Student {
                            StudentId = numOfStud
                        };
                        appService.RemoveStudentFromDB(student);
                        break;
                    }

                    default:
                        Console.WriteLine("Wrong Input!");
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Wrong Input!");
                }
            }
        }
Example #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            GroupContext groupContext = GroupContext.GetGroupContext();

            GroupInfo groupInfo = new GroupInfo();
            groupInfo.GroupID = groupContext.CurrentGroupID;

            string fromSQL  = groupInfo.FromSQL;
            string whereSQL = groupInfo.WhereSQL;

            if (whereSQL != "")
            {
                whereSQL = "WHERE " + whereSQL;
            }
            string selectSQL = "SELECT SALESPOTENTIAL, CLOSEPROBABILITY, ACTUALAMOUNT, DATEOPENED, CLOSED, ESTIMATEDCLOSE ";
            string groupSQL  = selectSQL + "FROM " + fromSQL + " " + whereSQL;

            using (new SparseQueryScope())
                using (IDbConnection vConn = GroupInfo.GetOpenConnection())
                {
                    OleDbDataAdapter vAdapter = new OleDbDataAdapter(groupSQL, vConn as OleDbConnection);
                    foreach (DbParameter p in groupInfo.Parameters)
                    {
                        vAdapter.SelectCommand.Parameters.Add(p);
                    }
                    vAdapter.SelectCommand.Prepare();
                    DataTable dt = new DataTable();
                    vAdapter.Fill(dt);

                    if (dt.Rows.Count != 0)
                    {
                        GetNumOfOpportunities(dt);
                        GetPotentialValues(dt);
                        GetAverageCloseProb(dt);
                        GetActualAmountValues(dt);
                        GetAverageDaysOpen(dt);
                        GetRangeofDates(dt);
                    }
                    else
                    {
                        lblNumOfOppsVal.Text                = "0";
                        curSalesPotentialTotalVal.Text      = "0";
                        curSalesPotentialAverageVal.Text    = "0";
                        curWeightedPotentialAverageVal.Text = "0";
                        curWeightedPotentialTotalVal.Text   = "0";
                        lblAverageCloseProbabilityVal.Text  = "0";
                        curActualAmountTotalVal.Text        = "0";
                        curActualAmountAverageVal.Text      = "0";
                        lblAverageNumOfDaysOpenVal.Text     = "0";
                        lblRangeOfEstCloseVal.Text          = GetLocalResourceObject("None_rsc").ToString();
                    }
                }
        }
        catch //Group didn't contain any records disable active controls
        {
            btnUpdateOpps.Enabled = false;
            ddlReports.Enabled    = false;
        }
    }
		/// <summary> Drills down into the group at the given index within the current
		/// group -- ie sets the location pointer to the first structure within the child
		/// </summary>
		/// <param name="childNumber">the index of the group child into which to drill
		/// </param>
		/// <param name="rep">the group repetition into which to drill
		/// </param>
		public virtual void  drillDown(int childNumber, int rep)
		{
			if (childNumber != - 1)
			{
				Structure s = currentGroup.get_Renamed(childNames[childNumber], rep);
				if (!(s is Group))
				{
					throw new NuGenHL7Exception("Can't drill into segment", NuGenHL7Exception.APPLICATION_INTERNAL_ERROR);
				}
				Group group = (Group) s;
				
				//stack the current group and location
				GroupContext gc = new GroupContext(this, this.currentGroup, this.currentChild);
				this.ancestors.Add(gc);
				
				this.currentGroup = group;
			}
			
			this.currentChild = 0;
			this.childNames = this.currentGroup.Names;
		}
    protected void LoadGrid()
    {
        if (this.Visible)
        {
            GenerateScript();

            EnableEstCloseControls();

            GroupContext groupContext = GroupContext.GetGroupContext();

            string fromSQL   = null;
            string whereSQL  = null;
            string selectSQL = null;
            string groupSQL  = null;
            //string joinSQL = null;
            IList <DbParameter> parameters;


            if (groupContext.CurrentGroupID != "LOOKUPRESULTS")
            {
                GroupInfo groupInfo = new GroupInfo();
                groupInfo.GroupID = groupContext.CurrentGroupID;
                fromSQL           = groupInfo.FromSQL;
                whereSQL          = groupInfo.WhereSQL;
                parameters        = groupInfo.Parameters;
            }
            else
            {
                CachedGroup groupInfo = groupContext.CurrentGroupInfo.CurrentGroup;
                fromSQL    = groupInfo.GroupInformation.FromSQL;
                whereSQL   = groupInfo.GroupInformation.WhereSQL;
                parameters = groupInfo.GroupInformation.Parameters;
            }

            // the joing caused ambiguous columns in the select clause so aliases had to be specified.
            // I made an assumption that opportunity is a required table and that the format of the
            // query would remain the same.  Shaky at best, I know.
            //string opportunityAlias = null;
            //int startIndex = fromSQL.ToLower().IndexOf("opportunity ") + "opportunity ".Length;
            //int stringLength = fromSQL.ToLower().IndexOf(" ", startIndex);
            //opportunityAlias = fromSQL.Substring(startIndex, stringLength - startIndex);

            //if (whereSQL != "")
            //    whereSQL = " WHERE " + whereSQL;
            //selectSQL = "SELECT opportunityid, " + opportunityAlias + ".description, estimatedclose, closeprobability, addtoforecast, " + opportunityAlias + ".notes, salespotential, UserInfoCustom.LastName + ', ' + UserInfoCustom.FirstName as AccountManager";
            //joinSQL = "LEFT OUTER JOIN USERINFO UserInfoCustom ON (" + opportunityAlias + ".AccountManagerId = UserInfoCustom.USERID)";
            //groupSQL = selectSQL + " FROM " + fromSQL + " " + joinSQL + " " + whereSQL;

            if (whereSQL != "")
            {
                whereSQL = " WHERE " + whereSQL;
            }
            selectSQL = "SELECT opportunityid, description, estimatedclose, closeprobability, accountmanagerid, addtoforecast, notes, salespotential";
            groupSQL  = selectSQL + " FROM " + fromSQL + " " + whereSQL;

            var vConn    = GroupInfo.GetOpenConnection();
            var vAdapter = new OleDbDataAdapter(groupSQL, vConn as OleDbConnection);
            foreach (DbParameter p in parameters)
            {
                vAdapter.SelectCommand.Parameters.Add(p);
            }

            DataTable dt = new DataTable();
            try
            {
                using (new SparseQueryScope())
                {
                    vAdapter.Fill(dt);
                }
            }
            catch
            {
                //throw new GroupInfoException(string.Format("Error Executing SQL", groupSQL), e);
                throw new Exception("Error Executing SQL");
            }
            finally
            {
                vConn.Close();
            }

            UpdateOppsGrid.DataSource = dt;
            UpdateOppsGrid.DataBind();
            CalcOppValues();
        }
    }
 public ProductGroupController(GroupContext context)
 {
     _context = context;
 }
Example #22
0
 public GroupController(GroupContext groupContext, IGroupService groupService, IMapper mapper)
 {
     _groupContext = groupContext;
     _groupService = groupService;
     _mapper       = mapper;
 }