Exemplo n.º 1
0
        public object UpdateAdmRoledetailsInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    AdmRoledetailsEntity admRoledetailsEntity = (AdmRoledetailsEntity)param;
                    AdmRoledetailsDAL    admRoledetailsDAL    = new AdmRoledetailsDAL();
                    retObj = (object)admRoledetailsDAL.UpdateAdmRoledetailsInfo(admRoledetailsEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Exemplo n.º 2
0
        public bool SaveAdmRoledetailsInfo(AdmRoledetailsEntity admRoledetailsEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "INSERT INTO Adm_RoleDetails ( RoleId, FeatureId, IsView, IsAdd, IsEdit, IsDelete) VALUES (  @Roleid,  @Featureid,  @Isview,  @Isadd,  @Isedit,  @Isdelete )";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Roleid", DbType.String, admRoledetailsEntity.Roleid);
            db.AddInParameter(dbCommand, "Featureid", DbType.String, admRoledetailsEntity.Featureid);
            db.AddInParameter(dbCommand, "Isview", DbType.String, admRoledetailsEntity.Isview);
            db.AddInParameter(dbCommand, "Isadd", DbType.String, admRoledetailsEntity.Isadd);
            db.AddInParameter(dbCommand, "Isedit", DbType.String, admRoledetailsEntity.Isedit);
            db.AddInParameter(dbCommand, "Isdelete", DbType.String, admRoledetailsEntity.Isdelete);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Exemplo n.º 3
0
        public bool UpdateAdmRoledetailsInfo(AdmRoledetailsEntity admRoledetailsEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE Adm_RoleDetails SET RoleId= @Roleid, FeatureId= @Featureid, IsView= @Isview, IsAdd= @Isadd, IsEdit= @Isedit, IsDelete= @Isdelete WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, admRoledetailsEntity.Id);
            db.AddInParameter(dbCommand, "Roleid", DbType.String, admRoledetailsEntity.Roleid);
            db.AddInParameter(dbCommand, "Featureid", DbType.String, admRoledetailsEntity.Featureid);
            db.AddInParameter(dbCommand, "Isview", DbType.String, admRoledetailsEntity.Isview);
            db.AddInParameter(dbCommand, "Isadd", DbType.String, admRoledetailsEntity.Isadd);
            db.AddInParameter(dbCommand, "Isedit", DbType.String, admRoledetailsEntity.Isedit);
            db.AddInParameter(dbCommand, "Isdelete", DbType.String, admRoledetailsEntity.Isdelete);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Exemplo n.º 4
0
        public AdmRoledetailsEntity GetSingleAdmRoledetailsRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, RoleId, FeatureId, IsView, IsAdd, IsEdit, IsDelete FROM Adm_RoleDetails WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            AdmRoledetailsEntity admRoledetailsEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    admRoledetailsEntity = new AdmRoledetailsEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["RoleId"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Roleid = dataReader["RoleId"].ToString();
                    }
                    if (dataReader["FeatureId"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Featureid = dataReader["FeatureId"].ToString();
                    }
                    if (dataReader["IsView"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Isview = dataReader["IsView"].ToString();
                    }
                    if (dataReader["IsAdd"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Isadd = dataReader["IsAdd"].ToString();
                    }
                    if (dataReader["IsEdit"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Isedit = dataReader["IsEdit"].ToString();
                    }
                    if (dataReader["IsDelete"] != DBNull.Value)
                    {
                        admRoledetailsEntity.Isdelete = dataReader["IsDelete"].ToString();
                    }
                }
            }
            return(admRoledetailsEntity);
        }
Exemplo n.º 5
0
        public DataTable GetAllAdmRoledetailsRecord(object param)
        {
            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"SELECT D.ID, D.RoleId, D.FeatureId, D.IsView, D.IsAdd, D.IsEdit, D.IsDelete 
                FROM Adm_RoleDetails D
                Left Join Adm_RoleMaster M ON M.ID = D.RoleId Where 1=1";

            AdmRoledetailsEntity obj = new AdmRoledetailsEntity();

            if (param != null)
            {
                obj = (AdmRoledetailsEntity)param;
            }

            if (!string.IsNullOrEmpty(obj.Roleid))
            {
                sql += " And D.RoleId = '" + obj.Roleid + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isview))
            {
                sql += " And D.IsView = '" + obj.Isview + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isadd))
            {
                sql += " And D.IsAdd = '" + obj.Isadd + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isedit))
            {
                sql += " And D.IsEdit = '" + obj.Isedit + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isdelete))
            {
                sql += " And D.IsDelete = '" + obj.Isdelete + "'";
            }
            if (!string.IsNullOrEmpty(obj.Isactive))
            {
                sql += " And M.IsActive = '" + obj.Isactive + "'";
            }

            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }
Exemplo n.º 6
0
        public bool SiteUserAccess(string MenuId, string Action)
        {
            bool Access = false;

            try
            {
                bool IsAdmin = Session["UserType"].ToString() == "Admin" ? true : false;
                if (!IsAdmin && "VAED".Contains(Action.ToUpper()))
                {
                    AdmRoledetailsEntity obj = new AdmRoledetailsEntity();
                    obj.Roleid    = Session["UserType"].ToString();
                    obj.Featureid = MenuId;
                    obj.Isactive  = "Active";
                    if (Action.ToUpper() == "V")
                    {
                        obj.Isview = "checked";
                    }
                    if (Action.ToUpper() == "A")
                    {
                        obj.Isadd = "checked";
                    }
                    if (Action.ToUpper() == "E")
                    {
                        obj.Isedit = "checked";
                    }
                    if (Action.ToUpper() == "D")
                    {
                        obj.Isdelete = "checked";
                    }
                    DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmRoledetailsRecord, obj);
                    if (dt.Rows.Count > 0)
                    {
                        Access = true;
                    }
                }
                else if (IsAdmin)
                {
                    Access = true;
                }
            }
            catch { }
            return(Access);
        }
Exemplo n.º 7
0
        string RoleDetailsTableData(string Id)
        {
            List <AdmRoledetailsEntity> RoleList = new List <AdmRoledetailsEntity>();

            if (!string.IsNullOrEmpty(Id))
            {
                AdmRoledetailsEntity obj = new AdmRoledetailsEntity {
                    Roleid = Id
                };
                DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmRoledetailsRecord, obj);
                foreach (DataRow dr in dt.Rows)
                {
                    RoleList.Add(new AdmRoledetailsEntity()
                    {
                        Id        = dr["Id"].ToString(),
                        Roleid    = dr["RoleId"].ToString(),
                        Featureid = dr["FeatureId"].ToString(),
                        Isview    = dr["IsView"].ToString(),
                        Isadd     = dr["IsAdd"].ToString(),
                        Isedit    = dr["IsEdit"].ToString(),
                        Isdelete  = dr["IsDelete"].ToString(),
                    });
                }
            }

            int    Count     = 1;
            string TableData = "";
            //........ Web Permission
            List <SiteInfo> MainMenuList = SiteMainMenusList();

            foreach (SiteInfo Menu in MainMenuList)
            {
                string          MenuId = Menu.MenuId, MenuName = Menu.MenuName;
                List <SiteInfo> SubMenuList = SiteSubMenusList(MenuId);
                string          SubFeature  = "";
                foreach (SiteInfo sMenu in SubMenuList)
                {
                    string sMenuId = sMenu.MenuId, sMenuName = sMenu.MenuName;
                    var    reponse = RoleList.Find(r => r.Featureid == sMenuId);
                    string view    = reponse != null ? reponse.Isview : "",
                           add     = reponse != null ? reponse.Isadd : "",
                           edit    = reponse != null ? reponse.Isedit : "",
                           delete  = reponse != null ? reponse.Isdelete : "",
                           detlid  = reponse != null ? reponse.Id : "";

                    SubFeature += "<tr>" +
                                  "<td>" + sMenuName + " <input data-detlid='" + detlid + "' type='hidden' value='" + sMenuId + "' class='allInput' id='id" + Count + "' /></td>" +
                                  "<td><input type='checkbox' class='allSel' onchange='SelectAll(this)' /></td>" +
                                  "<td><input type='checkbox' class='allSel' id='view" + Count + "' " + view + " />" +
                                  "<td><input type='checkbox' class='allSel' id='add" + Count + "' " + add + " /></td>" +
                                  "<td><input type='checkbox' class='allSel' id='edit" + Count + "' " + edit + " /></td>" +
                                  "<td><input type='checkbox' class='allSel' id='delete" + Count + "' " + delete + " /></td>" +
                                  "</tr>";
                    Count++;
                }
                if (!string.IsNullOrEmpty(SubFeature))
                {
                    TableData += @"<a style='color:blue;' class='card-header link border-top' data-toggle='collapse' data-parent='#accordian-4' href='#Toggle-" + Count + "' aria-expanded='true' aria-controls='Toggle-" + Count + "'>" +
                                 "<i class='seticon fa fa-arrow-right' aria-hidden='true'></i> <span>" + MenuName + "</span></a>" +
                                 "<div id='Toggle-" + Count + "' class='collapse show multi-collapse'>" +
                                 "<div class='card-body widget-content'>" +
                                 "<div class='table-responsive'>" +
                                 @"<table class='table'>
                    <thead class='thead-light'><tr><th width='50%'>Feature</th><th width='10%'>All</th><th width='10%'>View</th><th width='10%'>Add</th><th width='10%'>Edit</th><th width='10%'>Delete</th></tr></thead>
                    <tbody>" + SubFeature + "</tbody></table></div></div></div>";
                }
            }

            TableData = "<div id='accordian-4'><div class='card m-t-30'>" + TableData + "</div></div>";

            return(TableData);
        }
Exemplo n.º 8
0
        public string SiteMainMenuList(string cPageHead = "", string cController = "", string cAction = "")
        {
            string ErrorMsg = "";

            ViewBag.SitePageHead = cPageHead;

            bool IsActive = false;

            if (Session["UserId"] != null)
            {
                HcUsersEntity obj = (HcUsersEntity)ExecuteDB(HCareTaks.AG_GetSingleHcUsersRecordById, Session["UserId"].ToString());
                if (obj != null && obj.Isactive == "Active")
                {
                    IsActive = true;
                }
            }


            if (!IsActive || Session["UserType"].ToString() == "Patient" || (Session["UserType"].ToString() != "Admin" && Session["UserRoleId"] == null))
            {
                ErrorMsg = "Sorry, Authentication Error!";
            }
            else
            {
                bool IsAdmin = Session["UserType"].ToString() == "Admin" ? true : false;
                List <AdmRoledetailsEntity> rDetl = new List <AdmRoledetailsEntity>();
                if (!IsAdmin)
                {
                    AdmRoledetailsEntity obj = new AdmRoledetailsEntity();
                    obj.Roleid   = Session["UserRoleId"].ToString();
                    obj.Isview   = "checked";
                    obj.Isactive = "Active";
                    DataTable aDt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmRoledetailsRecord, obj);
                    foreach (DataRow dr in aDt.Rows)
                    {
                        rDetl.Add(new AdmRoledetailsEntity {
                            Featureid = dr["FeatureId"].ToString(), Isview = dr["IsView"].ToString(), Isadd = dr["IsAdd"].ToString(), Isedit = dr["IsEdit"].ToString(), Isdelete = dr["IsDelete"].ToString()
                        });
                    }
                }

                string cSelected    = cPageHead.Contains("Dashboard") ? "selected" : "";
                string cActive      = !string.IsNullOrEmpty(cSelected) ? "active" : "";
                string cIn          = !string.IsNullOrEmpty(cSelected) ? "in" : "";
                string SiteMenuList = "<li class='sidebar-item " + cSelected + "'> <a class='sidebar-link waves-effect waves-dark sidebar-link " + cActive + "' href='/AdmHome/Dashboard' aria-expanded='false'><i class='mdi mdi-view-dashboard'></i><span class='hide-menu'>Dashboard</span></a></li>";

                //..... Get Main Menu List
                List <SiteInfo> MainList = SiteMainMenusList();
                foreach (SiteInfo Menu in MainList)
                {
                    string mID = Menu.MenuId,
                                  mIcon = Menu.MenuIcon,
                                  mName = Menu.MenuName,
                                  mUrl = Menu.MenuUrl;
                    string[] Url = mUrl.Split(new string[] { "/" }, StringSplitOptions.None);
                    string   Controller = Url.Length > 1 ? Url[1] : "", Action = Url.Length > 2 ? Url[2] : "";

                    //..... Get Sub Menu List
                    List <SiteInfo> SubList = SiteSubMenusList(mID);
                    if (SubList.Count > 0)
                    {
                        string SubMenu = "", mActive = "";
                        foreach (SiteInfo Sub in SubList)
                        {
                            bool iView = IsAdmin;
                            if (!IsAdmin && rDetl.Count > 0)
                            {
                                var aDr = rDetl.FirstOrDefault(m => m.Featureid.ToUpper() == Sub.MenuId.ToUpper());
                                if (aDr != null)
                                {
                                    iView = true;
                                }
                            }

                            if (iView)
                            {
                                string sID   = Sub.MenuId,
                                       sName = Sub.MenuName,
                                       sIcon = Sub.MenuIcon,
                                       sUrl  = Sub.MenuUrl;

                                Url        = sUrl.Split(new string[] { "/" }, StringSplitOptions.None);
                                Controller = Url.Length > 1 ? Url[1] : ""; Action = Url.Length > 2 ? Url[2] : "";

                                cActive = cController == Controller && cAction == Action && string.IsNullOrEmpty(Url[0]) ? "active" : "";
                                if (!string.IsNullOrEmpty(cActive))
                                {
                                    mActive = cActive;
                                }
                                SubMenu += "<li class='sidebar-item " + cActive + "'><a href='" + sUrl + "' class='sidebar-link " + cActive + "'><i class='" + sIcon + "'></i><span class='hide-menu'> " + sName + " </span></a></li>";
                            }
                        }
                        if (!string.IsNullOrEmpty(SubMenu))
                        {
                            cSelected     = !string.IsNullOrEmpty(mActive) ? "selected" : "";
                            cIn           = !string.IsNullOrEmpty(mActive) ? "in" : "";
                            SiteMenuList += "<li class='sidebar-item " + cSelected + "'> <a class='sidebar-link has-arrow waves-effect waves-dark " + mActive + "' href='javascript:void(0)' aria-expanded='false'><i class='" + mIcon + "'></i><span class='hide-menu'>" + mName + " </span></a>"
                                            + "<ul aria-expanded='false' class='collapse  first-level " + cIn + "'>" + SubMenu + "</ul></li>";
                        }
                    }
                    //else
                    //{
                    //    cSelected = cController == Controller && cAction == Action && string.IsNullOrEmpty(Url[0]) ? "selected" : "";
                    //    cActive = !string.IsNullOrEmpty(cSelected) ? "active" : "";
                    //    SiteMenuList += "<li class='sidebar-item " + cSelected + "'> <a class='sidebar-link waves-effect waves-dark sidebar-link " + cActive + "' href='" + mUrl + "' aria-expanded='false'><i class='" + mIcon + "'></i><span class='hide-menu'>" + mName + "</span></a></li>";
                    //}
                }
                ViewBag.SiteMainMenuList      = SiteMenuList;
                ViewBag.SiteDashboardMenuList = DashboardMenuList();
                //Session["SiteMainMenuList"] = SiteMenuList;
            }
            return(ErrorMsg);
        }