public JsonResult FeatureSaveUpdate(AdmMenuEntity obj)
        {
            bool Success = false;

            if (string.IsNullOrEmpty(obj.Isactive))
            {
                obj.Isactive = "Active";
            }
            if (string.IsNullOrEmpty(obj.Id))
            {
                obj.Createdby   = Session["UserId"].ToString();
                obj.Createdtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                obj.Id          = (string)ExecuteDB(HCareTaks.AG_SaveAdmMenuInfo, obj);
                if (!string.IsNullOrEmpty(obj.Id))
                {
                    Success = true;
                }
            }
            else
            {
                obj.Updatedby   = Session["UserId"].ToString();
                obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                Success         = (bool)ExecuteDB(HCareTaks.AG_UpdateAdmMenuInfo, obj);
            }

            string Message = Success ? "Process has been done successfully" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message, Id = obj.Id }));
        }
Exemple #2
0
        public object UpdateAdmMenuInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    AdmMenuEntity admMenuEntity = (AdmMenuEntity)param;
                    AdmMenuDAL    admMenuDAL    = new AdmMenuDAL();
                    retObj = (object)admMenuDAL.UpdateAdmMenuInfo(admMenuEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
Exemple #3
0
        public object SaveAdmMenuInfo(AdmMenuEntity admMenuEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "SELECT isnull(MAX(SortBy),0)+1  FROM Adm_Menu ";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            if (string.IsNullOrEmpty(admMenuEntity.Sortby))
            {
                admMenuEntity.Sortby = db.ExecuteScalar(dbCommand, transaction).ToString();
            }

            sql       = "INSERT INTO Adm_Menu ( SortBy, MenuIcon, MenuName, MenuUrl, IsActive, CreatedBy, CreatedTime) output inserted.ID VALUES (  @Sortby,  @Menuicon,  @Menuname,  @Menuurl,  @Isactive,  @Createdby,  @Createdtime )";
            dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Sortby", DbType.String, admMenuEntity.Sortby);
            db.AddInParameter(dbCommand, "Menuicon", DbType.String, admMenuEntity.Menuicon);
            db.AddInParameter(dbCommand, "Menuname", DbType.String, admMenuEntity.Menuname);
            db.AddInParameter(dbCommand, "Menuurl", DbType.String, admMenuEntity.Menuurl);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, admMenuEntity.Isactive);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, admMenuEntity.Createdby);
            db.AddInParameter(dbCommand, "Createdtime", DbType.String, admMenuEntity.Createdtime);

            var id = db.ExecuteScalar(dbCommand, transaction).ToString();

            return(id);
        }
Exemple #4
0
        public AdmMenuEntity GetSingleAdmMenuRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, SortBy, MenuIcon, MenuName, MenuUrl, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime FROM Adm_Menu WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            AdmMenuEntity admMenuEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    admMenuEntity = new AdmMenuEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        admMenuEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["SortBy"] != DBNull.Value)
                    {
                        admMenuEntity.Sortby = dataReader["SortBy"].ToString();
                    }
                    if (dataReader["MenuIcon"] != DBNull.Value)
                    {
                        admMenuEntity.Menuicon = dataReader["MenuIcon"].ToString();
                    }
                    if (dataReader["MenuName"] != DBNull.Value)
                    {
                        admMenuEntity.Menuname = dataReader["MenuName"].ToString();
                    }
                    if (dataReader["MenuUrl"] != DBNull.Value)
                    {
                        admMenuEntity.Menuurl = dataReader["MenuUrl"].ToString();
                    }
                    if (dataReader["IsActive"] != DBNull.Value)
                    {
                        admMenuEntity.Isactive = dataReader["IsActive"].ToString();
                    }
                    if (dataReader["CreatedBy"] != DBNull.Value)
                    {
                        admMenuEntity.Createdby = dataReader["CreatedBy"].ToString();
                    }
                    if (dataReader["CreatedTime"] != DBNull.Value)
                    {
                        admMenuEntity.Createdtime = dataReader["CreatedTime"].ToString();
                    }
                    if (dataReader["UpdatedBy"] != DBNull.Value)
                    {
                        admMenuEntity.Updatedby = dataReader["UpdatedBy"].ToString();
                    }
                    if (dataReader["UpdatedTime"] != DBNull.Value)
                    {
                        admMenuEntity.Updatedtime = dataReader["UpdatedTime"].ToString();
                    }
                }
            }
            return(admMenuEntity);
        }
        public JsonResult FeatureDeleteById(string Id)
        {
            bool          Success = false;
            AdmMenuEntity obj     = (AdmMenuEntity)ExecuteDB(HCareTaks.AG_GetSingleAdmMenuRecordById, Id);

            if (obj != null)
            {
                obj.Updatedby   = Session["UserId"].ToString();
                obj.Updatedtime = DateTime.Now.ToString("dd/MM/yyyy");
                obj.Isactive    = "Inactive";
                Success         = (bool)ExecuteDB(HCareTaks.AG_UpdateAdmMenuInfo, obj);
            }
            string Message = Success ? "Delete Success" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message }));
        }
Exemple #6
0
        public List <SelectListItem> List_MainFeature()
        {
            List <SelectListItem> Items = new List <SelectListItem>();
            AdmMenuEntity         obj   = new AdmMenuEntity();

            obj.Isactive = "Active";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmMenuRecord, obj);

            foreach (DataRow dr in dt.Rows)
            {
                Items.Add(new SelectListItem {
                    Text = dr["MenuName"].ToString(), Value = dr["ID"].ToString()
                });
            }
            return(Items);
        }
Exemple #7
0
        public bool UpdateAdmMenuInfo(AdmMenuEntity admMenuEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "UPDATE Adm_Menu SET SortBy= @Sortby, MenuIcon= @Menuicon, MenuName= @Menuname, MenuUrl= @Menuurl, IsActive= @Isactive, UpdatedBy= @Updatedby, UpdatedTime= @Updatedtime WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, admMenuEntity.Id);
            db.AddInParameter(dbCommand, "Sortby", DbType.String, admMenuEntity.Sortby);
            db.AddInParameter(dbCommand, "Menuicon", DbType.String, admMenuEntity.Menuicon);
            db.AddInParameter(dbCommand, "Menuname", DbType.String, admMenuEntity.Menuname);
            db.AddInParameter(dbCommand, "Menuurl", DbType.String, admMenuEntity.Menuurl);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, admMenuEntity.Isactive);
            db.AddInParameter(dbCommand, "Updatedby", DbType.String, admMenuEntity.Updatedby);
            db.AddInParameter(dbCommand, "Updatedtime", DbType.String, admMenuEntity.Updatedtime);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
Exemple #8
0
        public List <SiteInfo> SiteMainMenusList()
        {
            List <SiteInfo> Items = new List <SiteInfo>();
            AdmMenuEntity   obj   = new AdmMenuEntity();

            obj.Isactive = "Active";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmMenuRecord, obj);

            foreach (DataRow dr in dt.Rows)
            {
                Items.Add(new SiteInfo {
                    MenuId = dr["ID"].ToString(), MenuIcon = dr["MenuIcon"].ToString(), MenuName = dr["MenuName"].ToString(), MenuUrl = dr["MenuUrl"].ToString()
                });
            }
            //Items.Add(new SiteInfo { MenuId = "3", MenuIcon = "mdi mdi-blur-linear", MenuName = "Manage User", MenuUrl = "/UserManage/UserList" });
            //Items.Add(new SiteInfo { MenuId = "6", MenuIcon = "mdi mdi-blur-linear", MenuName = "Reports", MenuUrl = "/Settings/CompanyList" });
            return(Items);
        }
        string FeatureListTableData()
        {
            string        TableData = "";
            AdmMenuEntity obj       = new AdmMenuEntity();
            DataTable     dt        = (DataTable)ExecuteDB(HCareTaks.AG_GetAllAdmMenuRecord, obj);
            int           Count     = 1;

            foreach (DataRow dr in dt.Rows)
            {
                string Action = "<i class='mdi mdi-table-edit iAction' title='Edit This' onclick=\"EditDetails('" + dr["Id"].ToString() + "')\" style='color:orange'></i>";
                Action    += "<i class='mdi mdi-close-box iAction' title='Inactive This' onclick=\"DeleteDetails('" + dr["Id"].ToString() + "', this)\" style='color:red'></i>";
                TableData +=
                    "<tr>" +
                    "<td><i class='mdi mdi-format-float-left iAction' title='Sub-Feature' onclick=\"SubFeatureDetails('" + dr["Id"].ToString() + "')\" style='color:green'></i></td>" +
                    "<td>F" + dr["ID"] + "</td>" +
                    "<td>" + dr["SortBy"] + "</td>" +
                    "<td>" + dr["MenuIcon"] + "</td>" +
                    "<td>" + dr["MenuName"] + "</td>" +
                    "<td>" + dr["MenuUrl"] + "</td>" +
                    "<td class='IsActive'>" + dr["IsActive"] + "</td>" +
                    "<td>" + Action + "</td>" +
                    "</tr>";
                Count += 1;
            }

            string CreateBtn = "<button class='btn btn-primary' type='button' onclick='CreateDetails()'  style='margin-bottom:10px;'> New</button>";
            string tHead     =
                "<tr>" +
                "<th>Sub</th>" +
                "<th>Code</th>" +
                "<th>SortBy</th>" +
                "<th>Icon</th>" +
                "<th>Feature</th>" +
                "<th>Url</ th>" +
                "<th>IsActive</th>" +
                "<th>Action</th>" +
                "</tr>";

            TableData = CreateBtn + "<div class='table-responsive'><table id='zero_config' class='table table-striped table-bordered'>" +
                        "<thead>" + tHead + "</thead><tbody>" + TableData + "</tbody></table></div>";

            return(TableData);
        }
        public ActionResult FeatureCreate(string Id)
        {
            string eMsg = SiteMainMenuList("Feature Details", "Settings", "FeatureList");

            if (!string.IsNullOrEmpty(eMsg))
            {
                return(RedirectToOut(eMsg));
            }
            //else if (!SiteUserAccess("", "V")) return RedirectToOut();

            AdmMenuEntity obj = new AdmMenuEntity();

            obj.Menuicon = "mdi mdi-blur-linear";
            obj.Menuurl  = "#";
            if (!string.IsNullOrEmpty(Id))
            {
                obj = (AdmMenuEntity)ExecuteDB(HCareTaks.AG_GetSingleAdmMenuRecordById, Id);
            }

            return(View(obj));
        }
Exemple #11
0
        public DataTable GetAllAdmMenuRecord(object param)
        {
            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"SELECT ID, SortBy, MenuIcon, MenuName, MenuUrl, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime 
                FROM Adm_Menu Where 1=1";

            AdmMenuEntity obj = new AdmMenuEntity();

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

            if (!string.IsNullOrEmpty(obj.Isactive))
            {
                sql += " And IsActive = '" + obj.Isactive + "'";
            }

            sql += " Order By SortBy Asc";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }