protected void ASPxGridLookupStranke_DataBinding(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
            {
                dt = CheckModelValidation(GetDatabaseConnectionInstance().GetAllClients());
            }
            else
            {
                dt = CheckModelValidation(GetDatabaseConnectionInstance().GetAllClients(PrincipalHelper.GetUserPrincipal().ID));
            }

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.NewRow();
                row["idStranka"]  = -1;
                row["NazivPrvi"]  = "Izberi...";
                row["NazivDrugi"] = "";
                dt.Rows.InsertAt(row, 0);

                (sender as ASPxGridLookup).DataSource = dt;
            }
            else
            {
                ClearSessionsAndRedirect();
            }
        }
Exemple #2
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
     {
         ASPxGridViewZaposleni.DataBind();
         InitializeEditDeleteButtons();
     }
     else
     {
         RedirectHome();
     }
 }
        protected override DataTable CreateDataSource()
        {
            DataTable dt = new DataTable();

            if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
            {
                dt = CheckModelValidation <DataTable>(GetDatabaseConnectionInstance().GetAllEvents());
            }
            else
            {
                dt = CheckModelValidation <DataTable>(GetDatabaseConnectionInstance().GetAllEvents(PrincipalHelper.GetUserPrincipal().ID));
            }

            return(dt);
        }
Exemple #4
0
 private void SetMainMenuBySignInRole()
 {
     if (PrincipalHelper.IsUserSuperAdmin())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.SuperAdmin.ToString());
     }
     else if (PrincipalHelper.IsUserAdmin())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.Admin.ToString());
     }
     else if (PrincipalHelper.IsUserSalesman())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.Salesman.ToString());
     }
     else
     {
         SetXmlDataSourceSetttings(Enums.UserRole.User.ToString());
     }
 }
 private void SetMainMenuBySignInRole()
 {
     if (PrincipalHelper.IsUserSuperAdmin())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.SuperAdmin.ToString());
     }
     else if (PrincipalHelper.IsUserAdmin())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.Admin.ToString());
     }
     else if (PrincipalHelper.IsUserMiner())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.Miner.ToString());
         ASPxPanelMenu.ClientVisible = false;
     }
     else if (PrincipalHelper.IsUserEditor())
     {
         SetXmlDataSourceSetttings(Enums.UserRole.Editor.ToString());
         //ASPxPanelMenu.ClientVisible = false;
     }
 }
Exemple #6
0
        protected override DataTable CreateDataSource()
        {
            DataTable dt = new DataTable();

            if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
            {
                dt = CheckModelValidation <DataTable>(GetDatabaseConnectionInstance().GetAllClients());
            }
            else
            {
                dt = CheckModelValidation <DataTable>(GetDatabaseConnectionInstance().GetAllClients(PrincipalHelper.GetUserPrincipal().ID));
            }

            /*if (SessionHasValue(Enums.ClientSession.ColumnFilters))
             * {
             *  CriteriaFilterHelper criteria = (CriteriaFilterHelper)GetValueFromSession(Enums.ClientSession.ColumnFilters);
             *  List<ClientSimpleModel> list = CheckModelValidation(GetDatabaseConnectionInstance().GetClientsByFilter(criteria.Column.FieldName, criteria.Value));
             *  dt = SerializeToDataTable(list);
             * }*/

            return(dt);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Initialize();
                if (action == (int)Enums.UserAction.Edit || action == (int)Enums.UserAction.Delete)
                {
                    if (eventID > 0)
                    {
                        if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
                        {
                            model = CheckModelValidation <EventFullModel>(GetDatabaseConnectionInstance().GetEvent(eventID));
                        }
                        else
                        {//this else checks if the signed in user actually have rights to edit this client!
                            model = CheckModelValidation <EventFullModel>(GetDatabaseConnectionInstance().GetEvent(eventID, PrincipalHelper.GetUserPrincipal().ID));
                            if (model == null)
                            {
                                RedirectHome();
                            }
                        }

                        if (model != null)
                        {
                            GetEventDataProviderInstance().SetEventFullModel(model);
                            FillForm();

                            if (isReferallClient)
                            {
                                SetFormValuesForclientReferall();
                            }
                        }
                        lblErrorDelete.ClientVisible = false;
                        btnConfirm.ClientEnabled     = true;
                        if (action == (int)Enums.UserAction.Delete && (model.idStatus == 2 || model.idStatus == 3))
                        {
                            lblErrorDelete.ClientVisible = true;
                            btnConfirm.ClientEnabled     = false;
                        }
                        if (action == (int)Enums.UserAction.Edit && model.idStatus == 2)
                        {
                            btnConfirm.ClientEnabled        = false;
                            ASPxButton1.ClientEnabled       = false;
                            PotrdiPripravoBtn.ClientEnabled = false;
                        }

                        //This popup shows if we set the session ShowWarning
                        ShowWarningPopUp("'Dogodka še niste shranili. Da zaključite shranjevanje dogodka pritisnite OK!'");
                    }
                }
                else if (action == (int)Enums.UserAction.Add)
                {
                    SetFormDefaultValues();

                    if (isReferallClient)
                    {
                        SetFormValuesForclientReferall();
                    }
                }
                InitializeEditDeleteButtons();
                UserActionConfirmBtnUpdate(btnConfirm, action);
            }
            else
            {
                if (model == null && SessionHasValue(Enums.EventSession.EventModel))
                {
                    model = GetEventDataProviderInstance().GetEventFullModel();
                }
                else if (isReferallClient)//When adding event through client we need to restore values.
                {
                    SetFormValuesForclientReferall();
                }
            }

            /*if (planFocusedRow > 0)
             * {
             *  ASPxGridViewPlan.FocusedRowIndex = ASPxGridViewPlan.FindVisibleIndexByKeyValue(planFocusedRow);
             *  ASPxGridViewPlan.ScrollToVisibleIndexOnClient = ASPxGridViewPlan.FindVisibleIndexByKeyValue(planFocusedRow);
             * }*/
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (clientID > 0)
                {
                    if (Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath.Contains("ClientsForm.aspx"))
                    {
                        ClearClientReferralSessions();
                    }

                    if (GetClientDataProviderInstance().GetFullModelFromClientModel() != null)
                    {
                        model = GetClientDataProviderInstance().GetFullModelFromClientModel();
                    }
                    else if (PrincipalHelper.IsUserSuperAdmin() || PrincipalHelper.IsUserAdmin())
                    {
                        model = CheckModelValidation <ClientFullModel>(GetDatabaseConnectionInstance().GetClient(clientID));
                    }
                    else
                    {//this else checks if the signed in user actually have rights to edit this client!
                        model = CheckModelValidation <ClientFullModel>(GetDatabaseConnectionInstance().GetClient(clientID, PrincipalHelper.GetUserPrincipal().ID));
                        if (model == null)
                        {
                            RedirectHome();
                        }
                    }

                    if (model != null)
                    {
                        GetClientDataProviderInstance().SetClientFullModel(model);
                        FillForm();
                    }
                    //This popup shows if we set the session ShowWarning
                    ShowWarningPopUp("'The new client was not in database. If you want to add new plans or cnotact person you need to save client first. Click OK to finish saving!'");
                }

                //InitializeEditDeleteButtons();
                //UserActionConfirmBtnUpdate(btnConfirm, action);
            }
            else
            {
                if (model == null && SessionHasValue(Enums.ClientSession.ClientModel))
                {
                    model = (ClientFullModel)GetValueFromSession(Enums.ClientSession.ClientModel);
                }
            }

            if (ClientPageControl.TabPages.FindByName("Charts").IsActive)
            {   //First Tab Charts
                if (SessionHasValue(Enums.ChartSession.GraphCollection))
                {
                    ChartsCallback.Controls.Clear();
                    AddControlsToPanel(GetClientDataProviderInstance().GetGraphBindingList());
                }
            }

            if (btnDisplayAllCharts.Checked)
            {
                filteringBlock.Style.Add("display", "flex");
            }

            if (!String.IsNullOrEmpty(ErrorLabel.Text))
            {
                ErrorLabel.Text = "";
            }
        }