Exemplo n.º 1
0
        protected void mMaineditpermissions_ItemClick(object source, MenuItemEventArgs e)
        {
            if (e.Item.Name == "mitCancel")
            {
                div_editpermissions.Visible = false;
                clearEditPermissions();
            }

            UpPrivillages.Update();
        }
Exemplo n.º 2
0
        protected void gvStaffUsers_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            e.Cancel = true;

            txtEditStafid.Text = e.Values[0].ToString();

            loadStaffAccess(e.Values[0].ToString());
            txtEditStafName.Text        = gvStaffUsers.GetRowValues(gvStaffUsers.FocusedRowIndex, "xFullName").ToString();
            div_editpermissions.Visible = true;
            div_permissions.Visible     = false;
            uPanel.Update();
            UpPrivillages.Update();
        }
Exemplo n.º 3
0
        protected void gvPrivillages_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
        {
            e.Handled = true;
            string pvbatch = "";

            //CHECK IF MAIN MENU ACCESS HAS BEEN ASSIGNED TO THIS STAFF ALREADY
            if (cmbMainMenu.Value != null)
            {
                UserAccess us = new UserAccess();
                us.MainId = int.Parse(cmbMainMenu.Value.ToString());
                us.UserId = txtstaffId.Text;

                if (new UserAccessService().ExistUserAccess(us, new SessionManager().GetUserId(this.Session)))
                {
                }
                else
                {
                    us.DateCreated = DateTime.Now;
                    us.LastModify  = DateTime.Now;
                    if (new UserAccessService().AddUserAccess(us, new SessionManager().GetUserId(this.Session)))
                    {
                        for (int i = 0; i < e.UpdateValues.Count; i++)
                        {
                            pvbatch += "('" + txtstaffId.Text + "','" + int.Parse(cmbMainMenu.Value.ToString()) + "','" + int.Parse(e.UpdateValues[i].NewValues[1].ToString()) + "','" + e.UpdateValues[i].NewValues[2].ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'),";
                        }

                        if (new UserPermissionService().AddUserPermissionList(pvbatch.TrimEnd(','), new SessionManager().GetUserId(this.Session)))
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Saved Successfully','Message')", true);
                            loadprivillages(int.Parse(cmbMainMenu.Value.ToString()), us.UserId);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Oops something is not right!','Message')", true);
                        }
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.info('Please select an Access Level.','Message')", true);
                cmbMainMenu.IsValid = false;
            }
            LoadUsers();
            cleargvPrivillages();
            LoadMainMenu();
            uPanel.Update();
            UpPrivillages.Update();
        }
Exemplo n.º 4
0
        protected void gvEditpermissions_BatchUpdate(object sender, DevExpress.Web.Data.ASPxDataBatchUpdateEventArgs e)
        {
            e.Handled = true;

            if (e.UpdateValues.Count != 0)
            {
                for (int i = 0; i < e.UpdateValues.Count; i++)
                {
                    UserPermission up = new UserPermission();
                    up.Id       = int.Parse(e.UpdateValues[i].Keys[0].ToString());
                    up.Activity = e.UpdateValues[i].NewValues[0].ToString();
                    new UserPermissionService().UpdateUserPermission(up, new SessionManager().GetUserId(this.Session));
                }

                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Updated Successfully','Message')", true);
            }
            if (e.DeleteValues.Count != 0)
            {
                for (int i = 0; i < e.DeleteValues.Count; i++)
                {
                    new UserPermissionService().DeleteUserPermission(int.Parse(e.DeleteValues[i].Keys[0].ToString()), new SessionManager().GetUserId(this.Session));
                }

                ScriptManager.RegisterStartupScript(this, GetType(), ",toastr", "toastr.success('Deleted Successfully','Message')", true);
            }

            if (cmbEditpermissions.Value != null)
            {
                reloadEditPermissions(txtEditStafid.Text, int.Parse(cmbEditpermissions.Value.ToString()));
                uPanel.Update();
            }

            gvEditpermissions.CancelEdit();
            LoadUsers();
            UpPrivillages.Update();
        }