예제 #1
0
        public DataTable GetAllHcServicesRecord(object param)
        {
            Database db  = DatabaseFactory.CreateDatabase();
            string   sql = @"SELECT ID, Name, Description, Icon, Type, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime, SortBy, IsView, ViewBy, ViewTime 
                FROM HC_Services Where 1=1";

            HcServicesEntity obj = new HcServicesEntity();

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

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

            sql += string.IsNullOrEmpty(obj.Sortby) ? " Order By Name Asc" : " Order By SortBy Asc";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            return(ds.Tables[0]);
        }
예제 #2
0
        public ActionResult ServiceCreate(string Id)
        {
            string eMsg = SiteMainMenuList("Service Details", "Settings", "ServiceList");

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

            ViewBag.TypeList = List_ServiceType();
            HcServicesEntity obj = new HcServicesEntity();

            obj.Icon = "fa fa-gg";
            if (!string.IsNullOrEmpty(Id))
            {
                obj = (HcServicesEntity)ExecuteDB(HCareTaks.AG_GetSingleHcServicesRecordById, Id);
                if (obj == null)
                {
                    obj = new HcServicesEntity();
                }
            }

            return(View(obj));
        }
예제 #3
0
        public JsonResult ServiceSaveUpdate(HcServicesEntity 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_SaveHcServicesInfo, 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_UpdateHcServicesInfo, obj);
            }
            string Message = Success ? "Process has been done successfully" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message, Id = obj.Id }));
        }
예제 #4
0
        public object UpdateHcServicesInfo(object param)
        {
            Database db     = DatabaseFactory.CreateDatabase();
            object   retObj = null;

            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    HcServicesEntity hcServicesEntity = (HcServicesEntity)param;
                    HcServicesDAL    hcServicesDAL    = new HcServicesDAL();
                    retObj = (object)hcServicesDAL.UpdateHcServicesInfo(hcServicesEntity, db, transaction);
                    transaction.Commit();
                }
                catch
                {
                    transaction.Rollback();
                    throw;
                }
                finally
                {
                    connection.Close();
                }
            }
            return(retObj);
        }
예제 #5
0
        public bool UpdateHcServicesInfo(HcServicesEntity hcServicesEntity, Database db, DbTransaction transaction)
        {
            string sql = "UPDATE HC_Services SET Name= @Name, Description= @Description, Icon= @Icon, Type= @Type, IsActive= @Isactive, UpdatedBy= @Updatedby, UpdatedTime= @Updatedtime, SortBy= @Sortby, IsView= @Isview, ViewBy= @Viewby, ViewTime= @Viewtime WHERE Id=@Id";

            if (hcServicesEntity.QueryFlag == "EmptyView")
            {
                sql = "UPDATE HC_Services SET IsView= @Isview, ViewBy= @Viewby, ViewTime= @Viewtime";
            }
            if (hcServicesEntity.QueryFlag == "SetView")
            {
                sql = "UPDATE HC_Services SET IsView= 'checked', ViewBy= @Viewby, ViewTime= @Viewtime WHERE Id=@Id";
            }

            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, hcServicesEntity.Id);
            db.AddInParameter(dbCommand, "Name", DbType.String, hcServicesEntity.Name);
            db.AddInParameter(dbCommand, "Description", DbType.String, hcServicesEntity.Description);
            db.AddInParameter(dbCommand, "Icon", DbType.String, hcServicesEntity.Icon);
            db.AddInParameter(dbCommand, "Type", DbType.String, hcServicesEntity.Type);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcServicesEntity.Isactive);
            db.AddInParameter(dbCommand, "Updatedby", DbType.String, hcServicesEntity.Updatedby);
            db.AddInParameter(dbCommand, "Updatedtime", DbType.String, hcServicesEntity.Updatedtime);
            db.AddInParameter(dbCommand, "SortBy", DbType.String, hcServicesEntity.Sortby);
            db.AddInParameter(dbCommand, "Isview", DbType.String, hcServicesEntity.Isview);
            db.AddInParameter(dbCommand, "Viewby", DbType.String, hcServicesEntity.Viewby);
            db.AddInParameter(dbCommand, "Viewtime", DbType.String, hcServicesEntity.Viewtime);

            db.ExecuteNonQuery(dbCommand, transaction);
            return(true);
        }
예제 #6
0
        public object SaveHcServicesInfo(HcServicesEntity hcServicesEntity, Database db, DbTransaction transaction)
        {
            string    sql       = "select Isnull(MAX(SortBy),0)+1 from HC_Services";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

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

            sql       = "INSERT INTO HC_Services ( Name, Description, Icon, Type, IsActive, CreatedBy, CreatedTime, SortBy, IsView, ViewBy, ViewTime ) output inserted.ID VALUES (  @Name,  @Description,  @Icon,  @Type,  @Isactive,  @Createdby,  @Createdtime,  @Sortby,  @Isview,  @Viewby,  @Viewtime )";
            dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Name", DbType.String, hcServicesEntity.Name);
            db.AddInParameter(dbCommand, "Description", DbType.String, hcServicesEntity.Description);
            db.AddInParameter(dbCommand, "Icon", DbType.String, hcServicesEntity.Icon);
            db.AddInParameter(dbCommand, "Type", DbType.String, hcServicesEntity.Type);
            db.AddInParameter(dbCommand, "Isactive", DbType.String, hcServicesEntity.Isactive);
            db.AddInParameter(dbCommand, "Createdby", DbType.String, hcServicesEntity.Createdby);
            db.AddInParameter(dbCommand, "Createdtime", DbType.String, hcServicesEntity.Createdtime);
            db.AddInParameter(dbCommand, "SortBy", DbType.String, hcServicesEntity.Sortby);
            db.AddInParameter(dbCommand, "Isview", DbType.String, hcServicesEntity.Isview);
            db.AddInParameter(dbCommand, "Viewby", DbType.String, hcServicesEntity.Viewby);
            db.AddInParameter(dbCommand, "Viewtime", DbType.String, hcServicesEntity.Viewtime);

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

            return(id);
        }
예제 #7
0
        public JsonResult ServiceDeleteById(string Id)
        {
            bool             Success = false;
            HcServicesEntity obj     = (HcServicesEntity)ExecuteDB(HCareTaks.AG_GetSingleHcServicesRecordById, 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_UpdateHcServicesInfo, obj);
            }
            string Message = Success ? "Delete Success" : "Sorry something went wrong!";

            return(Json(new { Success = Success, Message = Message }));
        }
예제 #8
0
        string ServicesTableData()
        {
            string           TableData = "";
            HcServicesEntity obj       = new HcServicesEntity();

            obj.Isactive = "Active";
            obj.Sortby   = "yes";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcServicesRecord, obj);

            foreach (DataRow dr in dt.Rows)
            {
                TableData += "<tr>" +
                             "<th><label class='customcheckbox'><input type='checkbox' class='listCheckbox' value='" + dr["ID"] + "' " + dr["Isview"] + " /><span class='checkmark'></span></label></th>" +
                             "<td>" + dr["SortBy"] + "</td>" +
                             "<td>" + dr["Name"] + "</td>" +
                             "<td>" + dr["Description"] + "</td>" +
                             "</tr>";
            }
            return(TableData);
        }
예제 #9
0
        string ServicesData()
        {
            string           TableData = "";
            HcServicesEntity obj       = new HcServicesEntity();

            obj.Isactive = "Active";
            obj.Sortby   = "yes";
            obj.Isview   = "checked";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcServicesRecord, obj);

            foreach (DataRow dr in dt.Rows)
            {
                TableData += "<div class='col-xs-12 col-sm-6 col-md-4'>" +
                             "<div class='text-center mb-30 p-10'>" +
                             "<i class='" + dr["Icon"] + " text-theme-colored font-30 service-icon'></i>" +
                             "<h3 class='mt-10'>" + dr["Name"] + "</h3> <p>" + dr["Description"] + "</p>" +
                             "</div>" +
                             "</div>";
            }
            return(TableData);
        }
예제 #10
0
        string ServiceListTableData()
        {
            string           TableData = "";
            HcServicesEntity obj       = new HcServicesEntity();

            obj.Sortby = "yes";
            DataTable dt = (DataTable)ExecuteDB(HCareTaks.AG_GetAllHcServicesRecord, obj);

            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>" + dr["SortBy"] + "</td>" +
                    "<td>" + dr["Name"] + "</td>" +
                    "<td>" + dr["Description"] + "</td>" +
                    "<td class='IsActive'>" + dr["IsActive"] + "</td>" +
                    "<td>" + Action + "</td>" +
                    "</tr>";
            }

            string CreateBtn = "<button class='btn btn-primary' type='button' onclick='CreateDetails()'  style='margin-bottom:10px;'> New</button>";
            string tHead     =
                "<tr>" +
                "<th>SortBy</th>" +
                "<th>Name</th>" +
                "<th width='50%'>Description</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);
        }
예제 #11
0
        public JsonResult ServicesUpdate(HcServicesEntity iGet)
        {
            bool             Success = false;
            HcServicesEntity obj     = new HcServicesEntity();

            obj.QueryFlag = "EmptyView";
            obj.Viewby    = Session["UserId"].ToString();
            obj.Viewtime  = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
            Success       = (bool)ExecuteDB(HCareTaks.AG_UpdateHcServicesInfo, obj);

            JavaScriptSerializer    serializer = new JavaScriptSerializer();
            List <HcServicesEntity> dGetObj    = serializer.Deserialize <List <HcServicesEntity> >(iGet.JsonDetails);

            obj.QueryFlag = "SetView";
            foreach (HcServicesEntity dr in dGetObj)
            {
                obj.Id  = dr.Id;
                Success = (bool)ExecuteDB(HCareTaks.AG_UpdateHcServicesInfo, obj);
            }

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

            return(Json(new { Success = Success, Message = Message }));
        }
예제 #12
0
        public HcServicesEntity GetSingleHcServicesRecordById(object param)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            string    sql       = "SELECT ID, Name, Description, Icon, Type, IsActive, CreatedBy, CreatedTime, UpdatedBy, UpdatedTime, SortBy, IsView, ViewBy, ViewTime FROM HC_Services WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);

            db.AddInParameter(dbCommand, "Id", DbType.String, param);
            HcServicesEntity hcServicesEntity = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    hcServicesEntity = new HcServicesEntity();
                    if (dataReader["ID"] != DBNull.Value)
                    {
                        hcServicesEntity.Id = dataReader["ID"].ToString();
                    }
                    if (dataReader["Name"] != DBNull.Value)
                    {
                        hcServicesEntity.Name = dataReader["Name"].ToString();
                    }
                    if (dataReader["Description"] != DBNull.Value)
                    {
                        hcServicesEntity.Description = dataReader["Description"].ToString();
                    }
                    if (dataReader["Icon"] != DBNull.Value)
                    {
                        hcServicesEntity.Icon = dataReader["Icon"].ToString();
                    }
                    if (dataReader["Type"] != DBNull.Value)
                    {
                        hcServicesEntity.Type = dataReader["Type"].ToString();
                    }
                    if (dataReader["IsActive"] != DBNull.Value)
                    {
                        hcServicesEntity.Isactive = dataReader["IsActive"].ToString();
                    }
                    if (dataReader["CreatedBy"] != DBNull.Value)
                    {
                        hcServicesEntity.Createdby = dataReader["CreatedBy"].ToString();
                    }
                    if (dataReader["CreatedTime"] != DBNull.Value)
                    {
                        hcServicesEntity.Createdtime = dataReader["CreatedTime"].ToString();
                    }
                    if (dataReader["UpdatedBy"] != DBNull.Value)
                    {
                        hcServicesEntity.Updatedby = dataReader["UpdatedBy"].ToString();
                    }
                    if (dataReader["UpdatedTime"] != DBNull.Value)
                    {
                        hcServicesEntity.Updatedtime = dataReader["UpdatedTime"].ToString();
                    }
                    if (dataReader["SortBy"] != DBNull.Value)
                    {
                        hcServicesEntity.Sortby = dataReader["SortBy"].ToString();
                    }
                    if (dataReader["IsView"] != DBNull.Value)
                    {
                        hcServicesEntity.Isview = dataReader["IsView"].ToString();
                    }
                    if (dataReader["ViewBy"] != DBNull.Value)
                    {
                        hcServicesEntity.Viewby = dataReader["ViewBy"].ToString();
                    }
                    if (dataReader["ViewTime"] != DBNull.Value)
                    {
                        hcServicesEntity.Viewtime = dataReader["ViewTime"].ToString();
                    }
                }
            }
            return(hcServicesEntity);
        }