예제 #1
0
 public IHttpActionResult GetPersonelOfMenuData(object ParentMenu)
 {
     try
     {
         JObject JsonObject = JObject.Parse(ParentMenu.ToString());
         Bis.AccessLevelMethod    BisAccessLevel = new Bis.AccessLevelMethod();
         ViewModel.tblAccessLevel GetAccessLevel = JsonObject.ToObject <ViewModel.tblAccessLevel>();
         GetAccessLevel.MenuUrl = GetAccessLevel.MenuUrl.Replace(GetAccessLevel.MenuUrl.Split('/')[0] + "/" + GetAccessLevel.MenuUrl.Split('/')[1] + "/" + GetAccessLevel.MenuUrl.Split('/')[2] + "/", "");
         JArray PersonelOfMenu = BisAccessLevel.GetJsonDataForEventUser(GetAccessLevel);
         return(Ok(PersonelOfMenu));
     }
     catch
     {
         return(NotFound());
     }
 }
예제 #2
0
        public void InitialAccessLevel(string IDRole)
        {
            try
            {
                ViewModel.Search roleMenu = new ViewModel.Search();
                roleMenu.Filter = " and tblRole.IDRole='" + IDRole + "' and tblRoleMenu.Access ='true'";
                DataSet dsRoleMenu = BisRoleMenu.GetRoleMenuData(roleMenu);

                ViewModel.tblAccessLevel AccessLevelModel = new ViewModel.tblAccessLevel();
                for (int i = 0; i < dsRoleMenu.Tables[0].Rows.Count; i++)
                {
                    AccessLevelModel.IDAccessLevel = Guid.NewGuid();
                    AccessLevelModel.IDMenu        = dsRoleMenu.Tables[0].Rows[i]["IDMenu"].ToString().StringToGuid();
                    AccessLevelModel.IDRole        = IDRole.StringToGuid();
                    AccessLevelModel.IDUser        = drpUser.SelectedValue.StringToGuid();
                    BisAccessLevel.InserDataFromMenuToAccessLevelAndGetData(AccessLevelModel);
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط بادیتابیس!');", true);
            }
        }
예제 #3
0
        protected void chkSelectMenu_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                ViewModel.tblAccessLevel AccessLevelModel = new ViewModel.tblAccessLevel();
                AccessLevelModel.IDMenu = hfIDMenuForEvent.Value.StringToGuid();
                AccessLevelModel.IDUser = drpUser.SelectedValue.StringToGuid();
                if (chkSelectMenu.Checked)
                {
                    panelEvent.Enabled = true;
                    panelEvent.Style.Add("background-color", "white");

                    AccessLevelModel.Access = true;
                    bool ret1 = BisAccessLevel.UpdateAccessLevel(AccessLevelModel);


                    // vaghti child click mishavad va parent tik nadasht,baraie parent tik mizanad
                    ViewModel.Search getMenu = new ViewModel.Search();
                    getMenu.Filter = " and tblMenu.IDMenu = '" + hfIDMenuForEvent.Value + "'";
                    DataSet dsMenu = BisMenu.GetMenuData(getMenu);

                    if (dsMenu.ReturnDataSetField("ParentID") != Guid.Empty.ToString())
                    {
                        AccessLevelModel.IDMenu = dsMenu.ReturnDataSetField("ParentID").StringToGuid();
                        AccessLevelModel.IDUser = drpUser.SelectedValue.StringToGuid();
                        AccessLevelModel.Access = true;
                        bool ret2 = BisAccessLevel.UpdateAccessLevel(AccessLevelModel);
                        if (!ret2)
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در ثبت اطلاعات!');", true);
                        }
                    }
                }
                else
                {
                    panelEvent.Enabled = false;
                    panelEvent.Style.Add("background-color", "lightgray");
                    AccessLevelModel.Access = false;
                    bool ret1 = BisAccessLevel.UpdateAccessLevel(AccessLevelModel);
                    if (!ret1)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال !');", true);
                    }

                    //bayad tamame eventaie in menu pak shabad
                    deleteEventUser(hfIDMenuForEvent.Value);

                    // yani age pedar ra uncheck kardim hameye childha uncheck savand
                    ViewModel.Search searchChildNodes = new ViewModel.Search();
                    searchChildNodes.Filter = " and tblMenu.ParentID = '" + hfIDMenuForEvent.Value + "' and tblAccessLevel.IDUser ='******'";
                    DataSet dsChilNodes = BisAccessLevel.GetAccessLevelDataForTree(searchChildNodes);

                    foreach (DataRow dr in dsChilNodes.Tables[0].Rows)
                    {
                        AccessLevelModel.IDMenu = dr["IDMenu"].ToString().StringToGuid();
                        AccessLevelModel.IDUser = drpUser.SelectedValue.StringToGuid();
                        AccessLevelModel.Access = false;
                        bool ret2 = BisAccessLevel.UpdateAccessLevel(AccessLevelModel);
                        if (!ret2)
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال !');", true);
                        }

                        deleteEventUser(dr["IDMenu"].ToString());
                    }


                    filltvEvent(hfIDMenuForEvent.Value);
                }
                filltvAccessLevel(drpUser.SelectedValue);
            }
            catch (Exception)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorMessage", "alert('اشکال در برقراری ارتباط بادیتابیس!');", true);
            }
        }
예제 #4
0
 public bool InserDataFromMenuToAccessLevelAndGetData(ViewModel.tblAccessLevel AccessLevel)
 {
     return(sqlHelper.RunProcedure("sp_tblAccessLevel_InserDataFromMenuToAccessLevel", AccessLevel) > 0);
 }
예제 #5
0
 public bool UpdateAccessLevel(ViewModel.tblAccessLevel AccessLevel)
 {
     return(sqlHelper.RunProcedure("sp_tblAccessLevel_Update", AccessLevel) > 0);
 }
예제 #6
0
 public JArray GetJsonDataForEventUser(ViewModel.tblAccessLevel AccessLevel)
 {
     return(sqlHelper.ReturnJsonData("sp_tblAccessLevel_GetDataForEventUser", AccessLevel));
 }